Liking cljdoc? Tell your friends :D

sugar.utils

Color conversion utilities: hex/RGB/8-bit conversions and x256 color mapping.

Color conversion utilities: hex/RGB/8-bit conversions and x256 color mapping.
raw docstring

hex->8-bitclj/s

(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).
raw docstring

hex->rgbclj/s

(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.
raw docstring

hex->rgb*clj/s

(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.
raw docstring

hex->rgb-or-8-bitclj/s

(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).
raw docstring

hex->rgbaclj/s

(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.
raw docstring

hex-color-reclj/s


rgb->8-bitclj/s

(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.
raw docstring

x256->nearest-user-colorclj/s

(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.
raw docstring

x256-rgb-tableclj/s

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.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close