Palette API
Constants
ansi16
pub const ansi16 = [16]AnsiRgb{ ... };Standard ANSI 16-color palette as RGB values.
ansi16_names
pub const ansi16_names = [16][]const u8{ ... };Names for the ANSI 16-color palette.
ansi88
pub const ansi88 = [88]AnsiRgb{ ... };Full ANSI 88-color palette as RGB values (comptime-generated). Includes 16 standard colors, 8x8x8 color cube (indices 16-79), and 8 grayscale ramp (indices 80-87).
ansi88_names
pub const ansi88_names = [88][]const u8{ ... };Names for the ANSI 88-color palette.
ansi256
pub const ansi256 = [256]AnsiRgb{ ... };Full ANSI 256-color palette as RGB values (comptime-generated).
Types
AnsiRgb
pub const AnsiRgb = struct {
r: u8,
g: u8,
b: u8,
};Functions
rgb6
pub fn rgb6(r: u8, g: u8, b: u8) struct { index: u8 }Creates an ANSI 256 color from 6x6x6 RGB cube coordinates.
r,g,bmust be in range 0-5- Returns the ANSI 256 index (16-231)
rgb8
pub fn rgb8(r: u8, g: u8, b: u8) struct { index: u8 }Creates an ANSI 88 color from 8x8x8 RGB cube coordinates.
r,g,bmust be in range 0-7- Returns the ANSI 88 index (16-79)
gray
pub fn gray(level: u8) struct { index: u8 }Creates an ANSI 256 grayscale color.
levelmust be in range 0-23 (maps to indices 232-255)- Returns the ANSI 256 index
gray88
pub fn gray88(level: u8) struct { index: u8 }Creates an ANSI 88 grayscale color.
levelmust be in range 0-7 (maps to indices 80-87)- Returns the ANSI 88 index
ramp
pub fn ramp(start: RgbColor, end: RgbColor, steps: u8) [256]RgbColorGenerates a linear color interpolation between two colors.
gradient
pub fn gradient(c1: RgbColor, c2: RgbColor, c3: RgbColor, steps: u8) [256]RgbColorGenerates a three-color gradient.
multiGradient
pub fn multiGradient(stops: []const RgbColor, steps: u8) [256]RgbColorGenerates a multi-stop gradient between an array of color stops. Interpolates linearly between consecutive stops.
hueGradient
pub fn hueGradient(steps: u8) [256]RgbColorGenerates a rainbow gradient by rotating through the full hue range in HSL space.
colorWheel
pub fn colorWheel(steps: u8) [256]RgbColorGenerates a full hue rainbow.
Palette Subsets
warm_palette
pub const warm_palette = [8]RgbColor{ ... };8 warm colors (reds, oranges, yellows).
cool_palette
pub const cool_palette = [8]RgbColor{ ... };8 cool colors (blues, cyans, teals).
earth_palette
pub const earth_palette = [8]RgbColor{ ... };8 earth tones (browns, tans).
pastel_palette
pub const pastel_palette = [8]RgbColor{ ... };8 pastel colors.
neon_palette
pub const neon_palette = [8]RgbColor{ ... };8 neon/bright colors.
