View Source ColorPalette (ColorPalette v0.1.9)
Color Palette Functions
colors/0
: A map between the color name (e.g.,:black
) and theColorPalette.Color
struct.ansi_color_codes/0
- A list of all 256 ANSI color codesreset/0
- Delegates to theIO.ANSI.reset/0
function.ansi_color_codes_to_color_names/0
- A mapping betweenColorPalette.ANSIColorCode
and color namesfind_by_hex/1
- Finds the colors with a certain hex value, e.g., "aabb00"find_by_code/1
- Finds the colors with a certain ANSI color code (e.g., 0..255).find_by_source/1
- Finds the colors that were obtained fromsource
, wheresource
is one ofColorPalette.source()
color_names/0
- Returns the list of all color names (e.g.,[:aero_blue, :alien_armpit, :alto, ...]
)random_color_name/0
- Returns a random color nameprint_using_random_color/2
- Prints a message in a random color
Colors
See below for the color descriptions. IMPORTANT Note that there are background versions for
each color; e.g., the function tea_green_background/0
(which is not listed below) is the
background color for
Summary
Functions
A list of the 256 ANSI color codes
A mapping between the ANSI color codes (e.g, ColorPalette.ANSIColorCode
) and color
names (e.g., ColorPalette.Color.name()
)
Returns the list of all color names
The main colors data structure. A map between the color name and the ColorPalette.Color
struct
Finds the colors with a certain ANSI color code
Finds the colors with a certain hex value, e.g., "aabb00"
Finds the colors that were obtained from source
, where source
is one of ColorPalette.source()
A mapping between the ANSI color hex value and the color names associated with that hex value.
Returns a struct which provides some useful data for determining the strategy for which name "wins" (i.e., which name goes with which ANSI code)
Prints a message in a random color
Returns a random color name
See IO.ANSI.reset/0
.
Functions
@spec ansi_color_codes() :: [ColorPalette.ANSIColorCode.t()]
A list of the 256 ANSI color codes
@spec ansi_color_codes_to_color_names() :: %{ required(ColorPalette.ANSIColorCode.t()) => [ColorPalette.Color.t()] }
A mapping between the ANSI color codes (e.g, ColorPalette.ANSIColorCode
) and color
names (e.g., ColorPalette.Color.name()
)
@spec color_names() :: [ColorPalette.Color.name()]
Returns the list of all color names
@spec colors() :: %{required(ColorPalette.Color.name()) => ColorPalette.Color.t()}
The main colors data structure. A map between the color name and the ColorPalette.Color
struct
@spec find_by_code(ColorPalette.ANSIColorCode.code()) :: [ColorPalette.Color.t()]
Finds the colors with a certain ANSI color code
@spec find_by_hex(ColorPalette.ANSIColorCode.hex()) :: [ColorPalette.Color.t()]
Finds the colors with a certain hex value, e.g., "aabb00"
@spec find_by_source(ColorPalette.Color.source()) :: [ColorPalette.Color.t()]
Finds the colors that were obtained from source
, where source
is one of ColorPalette.source()