[][src]Crate colorskill

Functions

change_color_lightness

Turns a color darker or lighter The amount represents HSL lightness degrees Lightness goes from 0 to 359 degrees The bigger the amount, the more it gets darker or lighter /// /// /// Example:

check_color_name

Checks if a color name exists /// Example:

color_name_to_rgb

Gets an RGB tuple from a color name The input is lowercased and the whitespaces are removed So "Light Blue" will match "lightblue" A fallback RGB tuple must be provided Example:

color_to_string

Converts a color tuple into a comma separated string (0, 0, 0) -> "0,0,0" /// Example:

color_to_string_2

Converts a color tuple into a comma separated string with spaces after commas (0, 0, 0) -> "0, 0, 0" /// /// Example:

color_to_string_3

Converts a color tuple into a comma separated string with added parenthesis (0, 0, 0) -> "(0,0,0)" /// /// Example:

color_to_string_4

Converts a color tuple into a comma separated string with added parenthesis and spaces after commas (0, 0, 0) -> "(0, 0, 0)" /// /// Example:

make_color_darker

Wrapper function to make a color darker Receives a tuple and the amount to make darker /// /// Example:

make_color_lighter

Wrapper function to make a color lighter Receives a tuple and the amount to make lighter /// /// /// Example:

parse_color

Parses a color string Useful for interpreting user input Valid inputs can be: "red", "0,0,0", "0, 0, 0" "darker", "darker2", "darker3" "lighter", "lighter2", "lighter3" or "random" to get a random color The input is lowercased and the whitespaces are removed darker3 turns it 3 times darker than darker Degrees for darker and lighter are hardcoded: DEGREES_1: f64 = 15.0 DEGREES_2: f64 = 30.0 DEGREES_3: f64 = 45.0 /// /// Examples:

random_color

Generates a random RGB tuple /// /// Example: