Defold Color

Defold Color

Library to modify, transform and convert colors. To use defined named colors and paletts, generate random colors and get a random palett.




There are a few modules in it to help with anything color. Here’s a quick overview!

color.lua

Convert to and from different color modes. Supports hex, hsv, and rgba.
The to_* methods takes vectors and the from_* returns vectors.

harmony.lua

Pick your method and a color and it will give you the colors it harmonizes with, you have a few methods to choose from:
complementary, monochromatic, analogous, split_complementary, triadic and tetradic.

If these are just weird words to use I you can always use the example in the project to check them out, but here are some examples. The color the furthest left is the input color.

math.lua

Simple color math made simpler. Can help you invert colors, get the difference, screen them together, overlay them or a few other convenient things.

palette.lua

Contains a few “ready for you” palette that I think looks nice with some words I though fit.

w3c.lua

Contains all colors from w3c (sometimes called css or html colors). You can go to something like HTML Color Names pick a color name you like and use that directly without having to memorize any color values or hex codes.

0.2.0

Changes

  • color.overlay Now uses a better algorithm, closer resembles PS.
  • Fixed type hints.
  • Added color.shift
  • Added blendmodes color_dodge, color_burn, linear_dodge, and linear_burn

color.shift(color, value)

Shifts the given color (the hue) a percentage (float number format) around the color wheel. If no value is provided it shifts a random amount of 1 to 2 percent.

11 Likes

Looks like the same idea as:

3 Likes

Interestingly enough we seems to have started them around the same time 2 years ago! I totally forgot to post about mine on the forum though, only remembered now cause I made a small app in Defold which used it.

But the libraries doesn’t seem very similar :slight_smile:

Correct me if I am wrong but klaytonkowalski/library-defold-colors seems to be for creating and managing palettes with the ability to convert to different color spaces.

While jerakin/defold-colors is for modifying and transforming colors with the ability to convert to different color spaces. It have some convenient palettes and colors that are already predefined.

Basically, one is for doing math with colors and one is for managing user defined palettes :slight_smile:

5 Likes

Perfect addition! I was using Klayton’s Defold Colors several times , it’s very useful and now we have even more, so great! :heart_eyes:

2 Likes