Releases:
- (1) https://pastebin.com/raw/EnZR7cQe
- (2) https://pastebin.com/raw/KsWa9eLD
- (3) https://pastebin.com/raw/dWJcEg3f
- (3b) https://pastebin.com/raw/9SC7i4W1
- (4) https://pastebin.com/raw/n5G55URd
- (4b) https://pastebin.com/raw/QhRcu6x6
- (5) https://pastebin.com/raw/aJPCr10Y
- (5b) https://pastebin.com/raw/cjRGWRVG
- (6) https://pastebin.com/3TxexkDG
- (7) https://pastebin.com/wUFF5YSG
- (7b) https://pastebin.com/Mz5eiCqu
- (8) https://pastebin.com/HKQSHZXt
Colors is a small library, that you can use for easier use of Colors. It adds the new Color()
function that is able to respond to #RRGGBB
hex codes, and colors. Version 4 came out with more than 400 unique colors.
--[[
Name: Colors
Author: Anatoly
License: ISC
Description: Color()s is a function that helps you accessing all the colors very easily.
Thread: https://codea.io/talk/discussion/10043/colors
Release: 5
INCLUDE WHEN COPYING
]]
#How to generate a color using the default way?
Start with the direction of the color you want to use.
- You can use
Fill(‘red’)
instead offill(Color(‘red’))
, same asStroke()
andTint()
##Colors
###Origins
red
green
blue
cyan
magenta
yellow
orange
grassgreen
forestgreen
turquoise
skyblue
rosa
purple
violet
pink
seablue
bronze
silver
gold
diamondblue
brown
darkbrown
white
warm-white
cold-white
black
neon-green
strawberry-red
darkviolet
##Prefices
-
dark-
makes the color darker -
light-
makes the color lighter -
middle-
makes the color more medium (and less saturated) -
reddish-
makes the color more a shade of red -
blueish-
makes the color more a shade of blue -
greenish-
makes the color more a shade of green -
reduced-
makes the color less saturated. -
saturated-
makes the color more saturated. -
slightly-
withreddish-
(slightly-reddish-
),greenish
andblueish
,light
anddark
##Hue
Instead of having to specify a color by the ways mentioned above, you can very fast elect a color by its’ hue. Color(‘hue-250’)
and `Hue(200)’ for example.
##Grayscale
white-10
white-20
- …
white-90
-
gray
/grey
(=white-50
)
##SVG and X11
SVG and X11 colors are supported. Example: Color(‘svg-AliceBlue’)
and Color(‘x11-AntiqueWhite1’)
. The string is case insensitive.
##How to use?
Once you selected the color you wish to use, insert it in the Color()
function as the first argument, and there you go. For using hex codes, in Color()
start the string with the hashtag (Color('#RRGGBB')
) or use the Hex('RRGGBB')
function instead.
#How to generate a color using a table?
##First define the origin, or use black as default.
Color {
origin = 'red'
}
You could also use color()
and any other value that is supported by Color()
##Optional: Define a shade.
Color {
origin = 'red',
shade = 'greenish'
}
Shades
light
, dark
, middle
, reddish
, greenish
, blueish
, slightly-reddish
, slightly-greenish
, slightly-blueish
##Optional: Desaturate
Color {
origin = 'red',
shade = 'greenish',
desaturate = 'avg'
}
Options
avg
, hsv
, hsl
, lum
, red
, green
, blue
##Optional: Invert
Color {
origin = 'red',
shade = 'greenish',
desaturate = 'avg',
invert = true
}
##Optional: Filter
Color {
origin = 'red',
shade = 'greenish',
desaturate = 'avg',
invert = true,
filter = {r = false}
}
###What is a filter?
Using filters you can redefine what colors you want to use. Basically, filter is a table {r = .., g = .., b = ..}
. Whatever colors you set to false will be automatically 0.
#How to generate a color using svg?
If you know all svg colors well, you can use them in the form of Color('svg-SVG_COLOR_HERE')
#Examples
background(Color(‘black’))
Fill('light-green')
rect(200, 100, 400, 200)
Fill{
origin = 'svg-lightsalmon',
shade = 'greenish',
filter = {r = false}
}
rect(200, 300, 400, 200)
Fill(‘svg-aliceblue’)
rect(200, 500, 400, 200)
Fill('#ff00ff')
rect(200, 700, 400, 200)
#Notes
Note! A preview is included in the App, just copy the code and run it in a new project. This project can be selected as a dependency in another project and you can use the Color()
function there. How it looks like is attached.
Note! Also the colors
variable is reserved.
Note! colors
is a direct table (colors[color_name]
will directly output the color). _colors
is collection of all colors (sorted alphabetically). Every item is an object with the attributes n
(name) and c
color.
Note! The colors don’t always mean what they show up, it’s the way the project calculates them.
My opinion on it: I have enjoyed creating graphics in the past, but this is not a color class made using graphics skills, hardcoding every color. It’s an algorithm, that creates many different colors. You can also fastly change from light-
to the dark-
theme! Personally I like the colors.
I am open for suggestions and improvements.