color-value-tools 1.1.10 → 1.1.12

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.
Files changed (2) hide show
  1. package/README.md +42 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -25,6 +25,17 @@ A comprehensive utility library for parsing, converting, manipulating, and analy
25
25
 
26
26
  ---
27
27
 
28
+ ## When you'd reach for this
29
+
30
+ Color stops being a one-time accent pick in a design tool the moment your project needs to convert, compare, and validate it programmatically — that's exactly what Color Value Tools is for.
31
+
32
+ - **A design system built on custom tokens** — Instead of hand-tuning every shade and tint in Figma, generate the whole scale from one base color with a single function — mathematically even, not "eyeballed."
33
+ - **Your theme switches at runtime** — When the background changes dynamically (dark mode, per-client branding, a user-picked palette), you need to recompute a readable text color and check it against WCAG every time, not hardcode pairs upfront.
34
+ - **Color arrives from different sources** — An API returns hex, a designer hands you HSL, a CSS variable holds a color in the oklch format — you need to normalize all of it to one format without writing a parser for every case.
35
+ - **An accessibility audit of the UI** — You need to quickly show how the palette looks under protanopia or deuteranopia, without installing a separate browser extension.
36
+
37
+ ---
38
+
28
39
  ## Installation
29
40
 
30
41
  Requires Node.js `18+`. No runtime or peer dependencies — the package is fully framework-agnostic and works in any JS/TS environment (browser, Node, edge runtimes).
@@ -80,6 +91,37 @@ CommonJS:
80
91
  const { normalizeColor, mixColors } = require('color-value-tools')
81
92
  ```
82
93
 
94
+ ### More examples
95
+
96
+ #### What your palette looks like to a colorblind user
97
+
98
+ `simulateColorBlindness` applies the Vienot 1999 matrices to linearized RGB — you can check contrast before shipping, not guess from a checklist.
99
+
100
+ ```ts
101
+ import { simulateColorBlindness } from 'color-value-tools'
102
+
103
+ simulateColorBlindness('#e74c3c', 'deuteranopia') // '#9a7b00'
104
+ simulateColorBlindness('#3498db', 'protanopia') // '#5282db'
105
+
106
+ // Vienot 1999 matrices applied to linearized RGB — good enough to check a
107
+ // palette before it ships, not just guess from a colorblind-safe checklist.
108
+ ```
109
+
110
+ #### A harmony and a shade scale from one color
111
+
112
+ `triadic` builds three colors 120° apart, `colorShades` a light-to-dark scale of nine steps. One base color in, a coordinated palette out — no manual hue math, no hand-picked hex values.
113
+
114
+ ```ts
115
+ import { triadic, colorShades } from 'color-value-tools'
116
+
117
+ triadic('#6c3483') // ['#6c3483', '#34836c', '#83346c'] — evenly spaced 120°
118
+
119
+ const shades = colorShades('#6c3483', 9) // light-to-dark HSL scale, 9 steps
120
+
121
+ // One base color in, a coordinated palette out — no manual hue-rotation
122
+ // math, no hand-picked hex values.
123
+ ```
124
+
83
125
  ---
84
126
 
85
127
  ## Documentation & links
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-value-tools",
3
- "version": "1.1.10",
3
+ "version": "1.1.12",
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",