Module cColor
brighten/darken color by variable amount, using HSV color space
Functions
get_average (color) | get average from color |
color_table_to_value (t) | convert r,g,b into numeric representation valid for hex display (#RRGGBB) |
color_table_to_hex_string (t, prefix) | convert r,g,b table to string representation (e.g. |
value_to_color_table (val) | convert numeric representation into r,g,b table |
value_to_hex_string (val, prefix) | convert value to hexadecimal string (e.g. |
hex_string_to_value (str_val) | convert hexadecimal string to value |
rgb_to_hsv (rgb) | Converts an RGB color value to HSV. |
hsv_to_rgb (hsv) | Converts an HSV color value to RGB. |
Functions
- get_average (color)
-
get average from color
Parameters:
- color
(table
)
Returns:
-
number
- color
(table
- color_table_to_value (t)
-
convert r,g,b into numeric representation valid for hex display (#RRGGBB)
Parameters:
- t (table)
Returns:
-
number
- color_table_to_hex_string (t, prefix)
-
convert r,g,b table to string representation (e.g. "0xFFCC66")
Parameters:
- t (table)
- prefix ], string - e.g. "#" to return CSS-style color
Returns:
-
string
- value_to_color_table (val)
-
convert numeric representation into r,g,b table
Parameters:
- val (int)
Returns:
-
(table)
- value_to_hex_string (val, prefix)
-
convert value to hexadecimal string (e.g. 0xFFCC66)
Parameters:
- val (int)
- prefix ], string - e.g. "#" to return CSS-style color
Returns:
-
string
- hex_string_to_value (str_val)
-
convert hexadecimal string to value
Parameters:
- str_val (string), e.g. "5FEC99", "#5FEC99" or "0x5FEC99"
Returns:
-
int or nil if unable to convert
- rgb_to_hsv (rgb)
-
Converts an RGB color value to HSV. Conversion formula
adapted from http://en.wikipedia.org/wiki/HSV_color_space.
Parameters:
- rgb (table), the RGB representation
Returns:
-
table, the HSV representation
- hsv_to_rgb (hsv)
-
Converts an HSV color value to RGB. Conversion formula
adapted from http://en.wikipedia.org/wiki/HSV_color_space.
Parameters:
- hsv (table), the HSV representation
Returns:
-
table, the RGB representation