Raxol.Effects.BorderBeam.Colors (Raxol v2.6.0)

View Source

Color palettes and gradient logic for the BorderBeam effect.

Four variants mirroring the original border-beam React component: colorful (rainbow), mono (grayscale), ocean (blue-purple), sunset (orange-red).

Summary

Functions

Returns the beam head color at the given animation progress.

Returns the dim outer bloom color for a variant.

Returns CSS hex for the bloom color of a variant.

Returns CSS hex for the glow color of a variant.

Returns CSS gradient stops string for the conic-gradient beam stroke.

Returns the CSS hex palette for a variant.

Returns the muted inner glow color for a variant.

Returns the terminal color palette for a variant.

Returns the palette as a tuple for O(1) elem/2 access. Use this in per-cell hot loops to avoid the O(n) cost of Enum.at(list, idx).

Returns the trail color for a cell at distance_normalized (0.0-1.0) behind the beam head.

Types

color()

@type color() :: atom()

variant()

@type variant() :: :colorful | :mono | :ocean | :sunset | :electric | :neon | :matrix

Functions

beam_color(variant, progress, bool)

@spec beam_color(variant(), float(), boolean()) :: color()

Returns the beam head color at the given animation progress.

progress is 0.0-1.0 through the animation cycle. When static_colors is true, always returns the first palette color.

bloom_color(variant)

@spec bloom_color(variant()) :: color()

Returns the dim outer bloom color for a variant.

css_bloom_hex(atom)

@spec css_bloom_hex(variant()) :: String.t()

Returns CSS hex for the bloom color of a variant.

css_glow_hex(atom)

@spec css_glow_hex(variant()) :: String.t()

Returns CSS hex for the glow color of a variant.

css_gradient_stops(variant)

@spec css_gradient_stops(variant()) :: String.t()

Returns CSS gradient stops string for the conic-gradient beam stroke.

css_palette(variant)

@spec css_palette(variant()) :: [String.t()]

Returns the CSS hex palette for a variant.

glow_color(variant)

@spec glow_color(variant()) :: color()

Returns the muted inner glow color for a variant.

palette(variant)

@spec palette(variant()) :: [color()]

Returns the terminal color palette for a variant.

palette_tuple(variant)

@spec palette_tuple(variant()) :: tuple()

Returns the palette as a tuple for O(1) elem/2 access. Use this in per-cell hot loops to avoid the O(n) cost of Enum.at(list, idx).

trail_color(variant, distance_normalized)

@spec trail_color(variant(), float()) :: color()

Returns the trail color for a cell at distance_normalized (0.0-1.0) behind the beam head.