64 Colors
| (require animate/colors) | package: animate |
animate/colors provides literal colors plus immutable palette, role, categorical-series, mix, and alpha specifications. A palette or role token is a description of a color to resolve under an explicit immutable theme; it is not a drawing color. Existing literal color strings such as "teal" and "crimson" keep their literal meaning. Animate recognizes names from its own fixed, case-insensitive X11-style table; it never asks the host drawing backend to interpret a name. Use a hexadecimal literal or rgb-color when you need a color that is not in that table.
procedure
(literal-color-spec? value) → boolean?
value : any/c
procedure
(rgb-color red green blue) → rgba-color?
red : (and/c finite-real? (>=/c 0) (<=/c 255)) green : (and/c finite-real? (>=/c 0) (<=/c 255)) blue : (and/c finite-real? (>=/c 0) (<=/c 255))
procedure
(palette-color key) → color-token?
key : symbol?
procedure
(role-color key) → color-token?
key : symbol?
procedure
(series-color index) → color-token?
index : exact-nonnegative-integer?
procedure
(color-token? value) → boolean?
value : any/c
procedure
(color-token-kind token) → (or/c 'palette 'role 'series)
token : color-token?
procedure
(color-token-key token) → symbol?
token : color-token?
procedure
(series-color? value) → boolean?
value : any/c
procedure
(series-color-index token) → exact-nonnegative-integer?
token : series-color?
procedure
(color-expression? value) → boolean?
value : any/c
procedure
(color-mix from to amount [ #:space space #:alpha-mode alpha-mode]) → color-spec? from : color-spec? to : color-spec? amount : (and/c finite-real? (>=/c 0) (<=/c 1)) space : (or/c 'srgb 'srgb-linear 'oklab) = 'srgb-linear alpha-mode : (or/c 'premultiplied 'straight) = 'premultiplied
procedure
(color-with-alpha color alpha) → color-spec?
color : color-spec? alpha : (and/c finite-real? (>=/c 0) (<=/c 1))
procedure
(color-opacity color factor) → color-spec?
color : color-spec? factor : (and/c finite-real? (>=/c 0) (<=/c 1))
64.1 Color Scales
procedure
(color-scale #:stops stops [ #:space space #:outside outside]) → color-scale? stops : list? space : (or/c 'srgb 'srgb-linear 'oklab) = 'srgb-linear outside : (or/c 'clamp 'error) = 'clamp
procedure
(color-scale? value) → boolean?
value : any/c
procedure
(color-scale-stops scale) → vector?
scale : color-scale?
procedure
(color-scale-space scale) → symbol?
scale : color-scale?
procedure
(color-scale-outside scale) → symbol?
scale : color-scale?
procedure
(color-scale-at scale coordinate) → color-spec?
scale : color-scale? coordinate : finite-real?
procedure
(sequential-color-scale #:minimum minimum #:maximum maximum [ #:low low #:high high #:missing missing #:space space #:outside outside]) → scientific-color-scale? minimum : finite-real? maximum : finite-real? low : color-spec? = aqua-d high : color-spec? = gold-d missing : color-spec? = theme-muted space : (or/c 'srgb 'srgb-linear 'oklab) = 'oklab outside : (or/c 'clamp 'error) = 'clamp
procedure
(diverging-color-scale #:minimum minimum #:maximum maximum #:midpoint midpoint [ #:low low #:middle middle #:high high #:missing missing #:space space #:outside outside]) → scientific-color-scale? minimum : finite-real? maximum : finite-real? midpoint : finite-real? low : color-spec? = aqua-d middle : color-spec? = gray-b high : color-spec? = red-d missing : color-spec? = theme-muted space : (or/c 'srgb 'srgb-linear 'oklab) = 'oklab outside : (or/c 'clamp 'error) = 'clamp
procedure
(scientific-color-scale? value) → boolean?
value : any/c
procedure
(scientific-color-scale-kind scale)
→ (or/c 'sequential 'diverging) scale : scientific-color-scale?
procedure
(scientific-color-scale-minimum scale) → finite-real?
scale : scientific-color-scale?
procedure
(scientific-color-scale-maximum scale) → finite-real?
scale : scientific-color-scale?
procedure
(scientific-color-scale-midpoint scale)
→ (or/c #f finite-real?) scale : scientific-color-scale?
procedure
(scientific-color-scale-missing scale) → color-spec?
scale : scientific-color-scale?
procedure
(scientific-color-scale-outside scale) → (or/c 'clamp 'error)
scale : scientific-color-scale?
procedure
(scientific-color-scale-at scale value) → color-spec?
scale : scientific-color-scale? value : any/c
procedure
(color-spec->datum color) → any/c
color : color-spec?
procedure
(datum->color-spec datum [ #:maximum-depth maximum-depth]) → color-spec? datum : any/c maximum-depth : exact-positive-integer? = 64
64.2 Palettes and Themes
A palette is a complete immutable table from palette keys to literal RGBA swatches. A theme owns one complete palette snapshot and maps semantic role keys to authored color specifications. Both are pure values: resolution always takes a theme explicitly and no mutable process-wide current theme exists.
Every symbol that becomes portable color data—
procedure
(color-palette #:id id #:colors colors [ #:extends parent #:display-name display-name #:version version #:groups groups #:provenance provenance]) → color-palette? id : symbol? colors : hash? parent : (or/c #f color-palette?) = #f display-name : string? = (symbol->string id) version : exact-positive-integer? = 1 groups : (or/c #f list?) = #f provenance : (or/c #f symbol? string?) = #f
procedure
(color-palette? value) → boolean?
value : any/c
procedure
(color-palette-id palette) → symbol?
palette : color-palette?
procedure
(color-palette-display-name palette) → string?
palette : color-palette?
procedure
(color-palette-version palette) → exact-positive-integer?
palette : color-palette?
procedure
(color-palette-provenance palette) → (or/c #f symbol? string?)
palette : color-palette?
procedure
(palette-ref palette key) → rgba-color?
palette : color-palette? key : symbol?
procedure
(palette-keys palette) → (listof symbol?)
palette : color-palette?
procedure
(palette-groups palette) → list?
palette : color-palette?
procedure
(palette->datum palette) → any/c
palette : color-palette?
procedure
(datum->palette datum) → color-palette?
datum : any/c
procedure
(color-theme #:id id [ #:palette palette #:roles roles #:extends parent #:display-name display-name #:series series #:provenance provenance]) → color-theme? id : symbol? palette : (or/c #f color-palette?) = #f roles : hash? = (hash) parent : (or/c #f color-theme?) = #f display-name : string? = (symbol->string id) series : (or/c #f list?) = #f provenance : (or/c #f symbol? string?) = #f
procedure
(color-theme? value) → boolean?
value : any/c
procedure
(color-theme-id theme) → symbol?
theme : color-theme?
procedure
(color-theme-display-name theme) → string?
theme : color-theme?
procedure
(color-theme-palette theme) → color-palette?
theme : color-theme?
procedure
(color-theme-provenance theme) → (or/c #f symbol? string?)
theme : color-theme?
procedure
(theme-ref theme role-key) → color-spec?
theme : color-theme? role-key : symbol?
procedure
(theme-role-keys theme) → (listof symbol?)
theme : color-theme?
procedure
(theme-series theme) → (listof rgba-color?)
theme : color-theme?
procedure
(color-theme-fingerprint theme) → bytes?
theme : color-theme?
procedure
(theme->datum theme) → any/c
theme : color-theme?
procedure
(datum->theme datum) → color-theme?
datum : any/c
procedure
(resolve-color color theme) → rgba-color?
color : color-spec? theme : color-theme?
64.3 Inspection and Diagnostics
procedure
(inspect-color color theme [ #:owner-path owner-path #:style-field style-field]) → immutable-hash? color : color-spec? theme : color-theme? owner-path : (or/c #f (listof symbol?)) = #f style-field : (or/c #f symbol?) = #f
The effective alpha belongs to the resolved color. It is distinct from a Visual’s separate opacity, and in three dimensions it is the material input to lighting rather than an observed lit pixel.
procedure
(color-inspection? value) → boolean?
value : any/c
procedure
(rgba-color->hex color) → string?
color : rgba-color?
procedure
(color-contrast-ratio foreground background) → positive-real? foreground : rgba-color? background : rgba-color?
procedure
(color-theme-diagnostics theme [ #:ordinary-text-pairs ordinary-text-pairs #:graphic-pairs graphic-pairs #:minimum-series-contrast minimum-series-contrast #:canvas canvas]) → (listof immutable-hash?) theme : color-theme?
ordinary-text-pairs : (listof (cons/c symbol? symbol?)) = '((foreground . background))
graphic-pairs : (listof (cons/c symbol? symbol?)) = '((axis . background) (accent . background)) minimum-series-contrast : (and/c finite-real? positive?) = 3 canvas : (or/c #f rgba-color?) = #f
If a requested background or the theme background is translucent, a supplied opaque canvas gives the compositing basis. Without one, the valid theme still returns a 'contrast-undetermined report instead of being treated as malformed. Returned invalid-datum reports retain a bounded immutable summary of input, never the caller’s mutable datum. Categorical-series comparisons use a fixed review budget. Their warning rows are followed by a 'categorical-series-summary report containing possible and examined pair counts, found and retained warning counts, and a 'truncated? flag. An incomplete bounded review is a warning even when every examined pair passed; the omitted pairs have not been checked.
procedure
(color-theme-datum-diagnostics datum)
→ (listof immutable-hash?) datum : any/c
procedure
(color-resolution-diagnostics color theme)
→ (listof immutable-hash?) color : color-spec? theme : color-theme?
value
value
value
value
64.4 Palette Tokens
The eight canonical hue ramps use a for the lightest and e for the darkest shade. The un-suffixed family names are aliases for their -c tokens.
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
value
64.5 Semantic Role Tokens
value
value
value
value
value
value
value
value
value
value
value
value
value
64.6 Fixed Literal Endpoints
value
value
value
value
value
value
value
value