colors
Stability: 2 - Stable
In Auto.js, there are two ways to represent a color.
One way is a string "#AARRGGBB" or "#RRGGBB", where:
AAis the alpha channel (opacity)RRis redGGis greenBBis blue
For example, "#ffffff" means white, and "#7F000000" means semi-transparent black.
Another way is a hexadecimal 32-bit integer 0xAARRGGBB, for example:
0xFF112233represents"#112233"0x11223344represents"#11223344"
You can convert a color integer to a string with colors.toString(), and parse a color string into an integer with colors.parseColor().
colors.toString(color)
color{number} Color integer- Returns {string}
Returns the color as a string in the "#AARRGGBB" format.
colors.red(color)
color{number | string} Color value- Returns {number}
Returns the red channel value of color, range 0 ~ 255.
colors.green(color)
color{number | string} Color value- Returns {number}
Returns the green channel value of color, range 0 ~ 255.
colors.blue(color)
color{number | string} Color value- Returns {number}
Returns the blue channel value of color, range 0 ~ 255.
colors.alpha(color)
color{number | string} Color value- Returns {number}
Returns the alpha channel value of color, range 0 ~ 255.
colors.rgb(red, green, blue)
red{number} Red channel valueblue{number} Green channel valuegreen{number} Blue channel value- Returns {number}
Returns the integer color composed by these channels. Alpha is fixed to 255 (opaque).
colors.argb(alpha, red, green, blue)
alpha{number} Alpha channel valuered{number} Red channel valuegreen{number} Green channel valueblue{number} Blue channel value- Returns {number}
Returns the integer color composed by these channels.
colors.parseColor(colorStr)
colorStr{string} Color string, e.g."#112233"- Returns {number}
Returns the color as an integer value.
colors.BLACK
Black, value #FF000000.
colors.DKGRAY
Dark gray, value #FF444444.
colors.GRAY
Gray, value #FF888888.
colors.LTGRAY
Light gray, value #FFCCCCCC.
colors.WHITE
White, value #FFFFFFFF.
colors.RED
Red, value #FFFF0000.
colors.GREEN
Green, value #FF00FF00.
colors.BLUE
Blue, value #FF0000FF.
colors.YELLOW
Yellow, value #FFFFFF00.
colors.CYAN
Cyan, value #FF00FFFF.
colors.MAGENTA
Magenta, value #FFFF00FF.
colors.TRANSPARENT
Transparent, value #00000000.
