color-value-tools 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # **Color Value Tools**
2
2
 
3
- ![Мой логотип](https://github.com/macrulezru/assets/blob/master/packages-images/color-value-tools.png?raw=true)
3
+ ![Color Value Tools](https://github.com/macrulezru/assets/blob/master/packages-images/color-value-tools.png?raw=true)
4
4
 
5
5
  A comprehensive utility library for parsing, converting, manipulating, and analyzing color values across all major color models — hex, RGB, HSL, HSV, HWB, Lab, LCH, Oklab, Oklch, CMYK, Display P3 — plus CSS variables and named colors. Zero dependencies.
6
6
 
package/dist/cjs/index.js CHANGED
@@ -708,6 +708,14 @@ function normalizeColor(input) {
708
708
  }
709
709
  if (str === 'transparent')
710
710
  return { type: 'named', hex: '#000000', r: 0, g: 0, b: 0, a: 0 };
711
+ const lowerStr = str.toLowerCase();
712
+ if (lowerStr in NAMED_COLORS) {
713
+ const hex = NAMED_COLORS[lowerStr];
714
+ const [r, g, b] = hexToRgb(hex);
715
+ const [h, s, l] = hexToHsl(hex);
716
+ const [, , vv] = rgbToHsv({ r, g, b });
717
+ return { type: 'named', hex, r, g, b, a: 1, h, s, l, v: vv };
718
+ }
711
719
  // oklch / oklcha
712
720
  if (isOklchColor(str)) {
713
721
  const parsed = parseOklchString(str);
@@ -708,6 +708,14 @@ function normalizeColor(input) {
708
708
  }
709
709
  if (str === 'transparent')
710
710
  return { type: 'named', hex: '#000000', r: 0, g: 0, b: 0, a: 0 };
711
+ const lowerStr = str.toLowerCase();
712
+ if (lowerStr in NAMED_COLORS) {
713
+ const hex = NAMED_COLORS[lowerStr];
714
+ const [r, g, b] = hexToRgb(hex);
715
+ const [h, s, l] = hexToHsl(hex);
716
+ const [, , vv] = rgbToHsv({ r, g, b });
717
+ return { type: 'named', hex, r, g, b, a: 1, h, s, l, v: vv };
718
+ }
711
719
  // oklch / oklcha
712
720
  if (isOklchColor(str)) {
713
721
  const parsed = parseOklchString(str);
package/dist/esm/index.js CHANGED
@@ -608,6 +608,14 @@ export function normalizeColor(input) {
608
608
  }
609
609
  if (str === 'transparent')
610
610
  return { type: 'named', hex: '#000000', r: 0, g: 0, b: 0, a: 0 };
611
+ const lowerStr = str.toLowerCase();
612
+ if (lowerStr in NAMED_COLORS) {
613
+ const hex = NAMED_COLORS[lowerStr];
614
+ const [r, g, b] = hexToRgb(hex);
615
+ const [h, s, l] = hexToHsl(hex);
616
+ const [, , vv] = rgbToHsv({ r, g, b });
617
+ return { type: 'named', hex, r, g, b, a: 1, h, s, l, v: vv };
618
+ }
611
619
  // oklch / oklcha
612
620
  if (isOklchColor(str)) {
613
621
  const parsed = parseOklchString(str);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-value-tools",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Parse, convert and manipulate colors across hex, RGB, HSL, Lab, LCH, OKLCH and CMYK, with WCAG contrast checks and CSS variables. Zero dependencies.",
5
5
  "author": "macrulez <macrulezru@gmail.com> (https://macrulez.ru/en)",
6
6
  "license": "MIT",