Color conversion utilities: hex/RGB/8-bit conversions and x256 color mapping.
Color conversion utilities: hex/RGB/8-bit conversions and x256 color mapping.
(hex->8-bit s)Converts hex color digits to an 8-bit color index (0-255).
Converts hex color digits to an 8-bit color index (0-255).
(hex->rgb s)Converts a hex(a) color (string) to an [r g b] vector representation.
Converts a hex(a) color (string) to an [r g b] vector representation.
(hex->rgb* s)Converts hex digits to [[r g b] alpha], with or without a leading #. Accepts 3 (RGB), 4 (RGBA), 6 (RRGGBB), or 8 (RRGGBBAA) hex chars.
Converts hex digits to [[r g b] alpha], with or without a leading #. Accepts 3 (RGB), 4 (RGBA), 6 (RRGGBB), or 8 (RRGGBBAA) hex chars.
(hex->rgb-or-8-bit s level)Converts hex to an RGB vector (level 3) or 8-bit index (level 1-2).
Converts hex to an RGB vector (level 3) or 8-bit index (level 1-2).
(hex->rgba s)Converts a hex(a) color (string) to an [r g b a] vector representation.
Converts a hex(a) color (string) to an [r g b a] vector representation.
(rgb->8-bit r g b)Uses a Manhattan distance algorithm to convert RGB to 8-bit color. Components outside 0 to 255 are clamped to that range.
Uses a Manhattan distance algorithm to convert RGB to 8-bit color. Components outside 0 to 255 are clamped to that range.
(x256->nearest-user-color code
&
[{:keys [white-threshold dark-threshold]
:or {white-threshold 0.9 dark-threshold 0.1}}])Converts an 8-bit x256 color code (0-255) to a basic color string. Options map allows overriding :white-threshold and :dark-threshold.
Converts an 8-bit x256 color code (0-255) to a basic color string. Options map allows overriding :white-threshold and :dark-threshold.
The [r g b] value of each 8-bit color id, 0 to 255.
The [r g b] value of each 8-bit color id, 0 to 255.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |