color-value-tools 1.0.0 → 1.0.1

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/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -124,7 +124,7 @@ function hexToHsl(hex) {
124
124
  return [Math.round(h * 360), Math.round(s * 100), Math.round(l * 100)];
125
125
  }
126
126
  function hslToHex(h, s, l) {
127
- h = h % 360;
127
+ h = ((h % 360) + 360) % 360;
128
128
  s = Math.max(0, Math.min(100, s)) / 100;
129
129
  l = Math.max(0, Math.min(100, l)) / 100;
130
130
  const c = (1 - Math.abs(2 * l - 1)) * s;
@@ -186,7 +186,7 @@ function adjustHexBrightness(hex, offsetPercent) {
186
186
  }
187
187
  function rotateHue(hex, degrees) {
188
188
  const [h, s, l] = hexToHsl(hex);
189
- const newH = (h + degrees) % 360;
189
+ const newH = ((h + degrees) % 360 + 360) % 360;
190
190
  return hslToHex(newH, s, l);
191
191
  }
192
192
  function clamp01(v) { return Math.max(0, Math.min(1, v)); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color-value-tools",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A tiny utility library for parsing, converting, and manipulating color values across common formats (hex, RGB, HSL, HSV, Lab, CMYK) and CSS variables.",
5
5
  "repository": {
6
6
  "type": "git",