From 34a5d9dd9f9a0af790dd16c881c5c2acba557eb1 Mon Sep 17 00:00:00 2001 From: Gregor Aisch Date: Sun, 18 Aug 2024 01:22:25 +0200 Subject: [PATCH] docs: add code example for hex('argb') resolves https://github.com/gka/chroma.js/issues/319 --- docs/index.html | 11 +- docs/libs/chroma-light.cjs | 204 +++++++++++++++-------------- docs/libs/chroma-light.min.cjs | 2 +- docs/libs/chroma.cjs | 229 ++++++++++++++++++--------------- docs/libs/chroma.min.cjs | 2 +- docs/src/index.md | 8 +- 6 files changed, 249 insertions(+), 207 deletions(-) diff --git a/docs/index.html b/docs/index.html index 1f9acb78..6b54ffe5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -415,7 +415,7 @@

([lum, mode='rgb'])

chroma('aquamarine').luminance(0.5, 'hsl');

color.hex

-

(mode='auto|rgb|rgba')

+

(mode='auto|rgb|rgba|argb')

Finally, chroma.js allows you to output colors in various color spaces and formats. Most often you will want to output the color as hexadecimal string.

chroma('orange').hex()
 
@@ -424,6 +424,9 @@

(mode='auto|rgb|rgba')

chroma('orange').alpha(0.5).hex(); chroma('orange').alpha(0.5).hex('rgb'); +

You can use .hex('argb') in case you need to encode the color with the alpha channel as first byte rather than the last:

+
chroma('orange').hex('argb');; // '#ffffa500'
+

color.name

Returns the named color. Falls back to hexadecimal RGB string, if the color isn't present.

chroma('#ffa500').name();
@@ -700,6 +703,12 @@ 

cubehelix.scale

.colors(5);

Changelog

+

3.1.0 (pre-release)

+

3.0.0