BCUtils.ColorFuncs (bc_utils v0.11.0)
This module is used to manipulate colors. It offers a set of functions that can be used to change the color of text in the terminal, using ANSI escape codes. It covers all color combinations and effects supported by ANSI.
Summary
Functions
Lists all available colors.
Lists all available effects.
Creates a background color.
Applies an effect without changing colors.
Creates a foreground color with optional effects.
Creates a hex color for background.
Creates a hex color for foreground.
Creates RGB background color (24-bit true color).
Creates RGB foreground color (24-bit true color).
Wraps text with color/effect and automatically resets.
Functions
Lists all available colors.
Lists all available effects.
Creates a background color.
Examples
iex> ColorFuncs.bg(:blue)
"[48;5;4m"
Applies an effect without changing colors.
Examples
iex> ColorFuncs.effect(:bold)
"[1m"
Creates a foreground color with optional effects.
Examples
iex> ColorFuncs.fg(:red, [:bold])
"[38;5;1;1m"
Creates a hex color for background.
Examples
iex> ColorFuncs.hex_bg("#0080FF")
"[48;2;0;128;255m"
Creates a hex color for foreground.
Examples
iex> ColorFuncs.hex_fg("#FF8000")
"[38;2;255;128;0m"
Creates RGB background color (24-bit true color).
Examples
iex> ColorFuncs.rgb_bg(0, 128, 255)
"[48;2;0;128;255m"
Creates RGB foreground color (24-bit true color).
Examples
iex> ColorFuncs.rgb_fg(255, 128, 0)
"[38;2;255;128;0m"
Wraps text with color/effect and automatically resets.
Examples
iex> ColorFuncs.wrap("Hello", :red, [:bold])
"[38;5;1;1mHello[0m"