Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Visamp Docs

Colors

Visript provides 32 named color constants plus RGB and HSL color constructors.

Named Colors

Use color constants with the $COLOR_ prefix:

draw::circle(x: 400.0, y: 300.0, radius: 50.0, color: $COLOR_RED)

Full Palette

$COLOR_BLACK$COLOR_WHITE$COLOR_RED$COLOR_GREEN
$COLOR_BLUE$COLOR_ORANGE$COLOR_YELLOW$COLOR_PINK
$COLOR_MAGENTA$COLOR_CYAN$COLOR_TEAL$COLOR_TURQUOISE
$COLOR_NAVY$COLOR_INDIGO$COLOR_VIOLET$COLOR_PURPLE
$COLOR_LAVENDER$COLOR_BROWN$COLOR_MAROON$COLOR_OLIVE
$COLOR_FOREST_GREEN$COLOR_GOLD$COLOR_SILVER$COLOR_GRAY
$COLOR_DARK_GRAY$COLOR_LIGHT_GRAY$COLOR_CRIMSON$COLOR_CORAL
$COLOR_SALMON$COLOR_SAND$COLOR_BEIGE$COLOR_SKY_BLUE
$COLOR_AMBER$COLOR_LIME$COLOR_CHARTREUSE$COLOR_TAN

Color Constructors

For custom colors, use color::rgb() or color::hsl().

RGB

color::rgb(r: 1.0, g: 0.5, b: 0.0, a: 0.8)
ParameterRangeDefaultDescription
r0.0 - 1.00.0Red component
g0.0 - 1.00.0Green component
b0.0 - 1.00.0Blue component
a0.0 - 1.01.0Alpha (0 = transparent, 1 = opaque)

All parameters are optional.

HSL

color::hsl(h: 0.5, s: 0.8, l: 0.5, a: 1.0)
ParameterRangeDefaultDescription
h0.0 - 1.00.0Hue (wraps around)
s0.0 - 1.00.0Color intensity
l0.0 - 1.00.0Brightness (0 = black, 0.5 = color, 1 = white)
a0.0 - 1.01.0Alpha (0 = transparent, 1 = opaque)

All parameters are optional.

Examples

// Custom orange
let my_orange = color::rgb(r: 1.0, g: 0.65, b: 0.0)

// Semi-transparent blue
let ghost_blue = color::rgb(b: 1.0, a: 0.5)

// Rainbow colors using HSL
let red = color::hsl(h: 0.0, s: 1.0, l: 0.5)
let green = color::hsl(h: 0.33, s: 1.0, l: 0.5)
let blue = color::hsl(h: 0.66, s: 1.0, l: 0.5)