Git Product home page Git Product logo

afgc-colorpalette's Introduction

afgc-ColorPalette

Generate a Dictionary with complimentary range of colors for the given input Color, itself included.

Install

Just copy ColorPalette.gd into the Godot project folder where you wish to use it.

Usage

Once you have copied the file, to generate a palette of colors based on a main color you provide:

#Test with a random color

var MyColor 	:Color 		= Color(randf(),randf(),randf())
var MyPalette	:Dictionary	= ColorPalette.new().Generate(MyColor)

MyPalette now contains a Dictionary with complimentary colors.

To access a specific color in the Dictionary:

#Look at the script for the string labels used to name the colors; change them to suit your preferences

var NeutralColor = MyPalette["Neutral"] #Assigns the neutral color to variable NeutralColor

To iterate through the Dictionary (Please note: To test the code below you will need a Node that implements the _draw() method such as Node2d):

func _draw():
	var TextSize := 32
	var font = Label.new().get_theme_font("") #Hacky quick way to get a default font

	#Test with a random color
	var MyColor 	:Color 		= Color(randf(),randf(),randf())
	var MyPalette	:Dictionary	= ColorPalette.new().Generate(MyColor)

	var position = Vector2.ZERO

	for ColorName in MyPalette:
		position.y += TextSize + TextSize
		draw_string(font,position,ColorName,-1,-1,TextSize,MyPalette[ColorName])

This will output the current color text strings in their current color.

Configuration

You should change the labels in the script to whatever suits you best.

You should also play with the values, especially for the "Adjacent" colors.

Notes

This is pretty straightforward but njamster on mastodon.gamedev.place was asking me to open source it so here it is. I hope it is useful for someone.

afgc-colorpalette's People

Contributors

afreytes avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.