color-value-tools 1.1.7 → 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,13 +1,6 @@
1
- <div align="center" style="background:#111827;border-radius:20px;padding:28px 20px 20px;margin-bottom:32px">
2
- <h1 style="color:#f9fafb;margin:0 0 32px;font-size:2.2em;letter-spacing:-0.03em;font-weight:700;font-family:sans-serif">
3
- color-value-tools
4
- </h1>
5
- <img
6
- src="https://s3.twcstorage.ru/c9a2cc89-780f97fd-311d-4a1a-b86f-c25665c9dc46/images/npm/color-value-tools.webp"
7
- alt="color-value-tools"
8
- style="max-width:100%;width:auto;height:300px;border-radius:12px"
9
- />
10
- </div>
1
+ # **Color Value Tools**
2
+
3
+ ![Color Value Tools](https://github.com/macrulezru/assets/blob/master/packages-images/color-value-tools.png?raw=true)
11
4
 
12
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.
13
6
 
@@ -759,7 +752,7 @@ MIT
759
752
 
760
753
  Danil Lisin Vladimirovich aka Macrulez
761
754
 
762
- GitHub: [macrulezru](https://github.com/macrulezru) · Website: [macrulez.ru/en](https://macrulez.ru/en)
755
+ GitHub: [macrulezru](https://github.com/macrulezru) · Website: [npm.vuecraft.ru/en/](https://npm.vuecraft.ru/en/packages/color-value-tools/)
763
756
 
764
757
  Bugs and questions — [issues](https://github.com/macrulezru/color-value-tools/issues)
765
758
 
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,10 +1,10 @@
1
1
  {
2
2
  "name": "color-value-tools",
3
- "version": "1.1.7",
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",
7
- "homepage": "https://github.com/macrulezru/color-value-tools#readme",
7
+ "homepage": "https://npm.vuecraft.ru/en/packages/color-value-tools/",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+https://github.com/macrulezru/color-value-tools.git"