@pathscale/ui 1.1.15 → 1.1.16

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.
@@ -107,8 +107,7 @@ const hueDistance = (a, b)=>{
107
107
  const isNearColor = (color, item)=>{
108
108
  const hueDelta = hueDistance(color.hsl.h, item.hue);
109
109
  const saturationDelta = Math.abs(color.hsl.s - item.saturation);
110
- const lightnessDelta = Math.abs(color.hsl.l - item.lightness);
111
- return hueDelta <= 2 && saturationDelta <= 2 && lightnessDelta <= 2;
110
+ return hueDelta <= 5 && saturationDelta <= 15;
112
111
  };
113
112
  const LAYOUT = [
114
113
  {
@@ -419,7 +418,7 @@ const ColorWheelFlower = (props)=>{
419
418
  const hueDelta = hueDistance(current.hsl.h, item.hue);
420
419
  const saturationDelta = Math.abs(current.hsl.s - item.saturation);
421
420
  const lightnessDelta = Math.abs(current.hsl.l - item.lightness);
422
- const score = 1.4 * hueDelta + 0.8 * saturationDelta + 0.55 * lightnessDelta;
421
+ const score = 2.0 * hueDelta + +saturationDelta + 0.1 * lightnessDelta;
423
422
  if (score < bestScore) {
424
423
  bestScore = score;
425
424
  closest = index;
@@ -17,58 +17,11 @@ const checkCspAllowsInlineStyles = ()=>{
17
17
  return cspAllowsInlineStyles;
18
18
  };
19
19
  const MIN_CHROMA_SCALE = 0.3;
20
- function hslHueToOklchHue(hslHue) {
21
- const h = (hslHue % 360 + 360) % 360;
22
- const controlPoints = [
23
- [
24
- 0,
25
- 29
26
- ],
27
- [
28
- 30,
29
- 55
30
- ],
31
- [
32
- 60,
33
- 100
34
- ],
35
- [
36
- 120,
37
- 145
38
- ],
39
- [
40
- 180,
41
- 195
42
- ],
43
- [
44
- 240,
45
- 265
46
- ],
47
- [
48
- 300,
49
- 330
50
- ],
51
- [
52
- 360,
53
- 389
54
- ]
55
- ];
56
- for(let i = 0; i < controlPoints.length - 1; i++){
57
- const [h1, o1] = controlPoints[i];
58
- const [h2, o2] = controlPoints[i + 1];
59
- if (h >= h1 && h <= h2) {
60
- const t = (h - h1) / (h2 - h1);
61
- const oklchHue = o1 + t * (o2 - o1);
62
- return (oklchHue % 360 + 360) % 360;
63
- }
64
- }
65
- return h;
66
- }
67
20
  const PRIMARY_SETTINGS = {
68
21
  light: {
69
22
  "--color-primary": {
70
- l: 45,
71
- c: 0.2
23
+ l: 58,
24
+ c: 0.22
72
25
  },
73
26
  "--color-primary-content": {
74
27
  l: 98,
@@ -77,12 +30,12 @@ const PRIMARY_SETTINGS = {
77
30
  },
78
31
  dark: {
79
32
  "--color-primary": {
80
- l: 58,
81
- c: 0.233
33
+ l: 75,
34
+ c: 0.18
82
35
  },
83
36
  "--color-primary-content": {
84
- l: 96,
85
- c: 0.018
37
+ l: 15,
38
+ c: 0.02
86
39
  }
87
40
  }
88
41
  };
@@ -101,8 +54,8 @@ const HARMONY_SETTINGS = {
101
54
  c: 0.026
102
55
  },
103
56
  "--color-accent": {
104
- l: 60,
105
- c: 0.118
57
+ l: 62,
58
+ c: 0.14
106
59
  },
107
60
  "--color-accent-content": {
108
61
  l: 98,
@@ -111,19 +64,19 @@ const HARMONY_SETTINGS = {
111
64
  },
112
65
  dark: {
113
66
  "--color-secondary": {
114
- l: 63,
115
- c: 0.237
67
+ l: 72,
68
+ c: 0.16
116
69
  },
117
70
  "--color-secondary-content": {
118
- l: 97,
71
+ l: 15,
119
72
  c: 0.013
120
73
  },
121
74
  "--color-accent": {
122
- l: 70,
123
- c: 0.14
75
+ l: 78,
76
+ c: 0.12
124
77
  },
125
78
  "--color-accent-content": {
126
- l: 98,
79
+ l: 15,
127
80
  c: 0.014
128
81
  }
129
82
  }
@@ -208,16 +161,16 @@ const SEMANTIC_SETTINGS = {
208
161
  const NF_ACCENT_SETTINGS = {
209
162
  light: {
210
163
  "--nf-accent": {
211
- l: 45,
212
- c: 0.2
164
+ l: 58,
165
+ c: 0.22
213
166
  },
214
167
  "--nf-on-accent": {
215
168
  l: 98,
216
169
  c: 0.02
217
170
  },
218
171
  "--color-nf-accent": {
219
- l: 45,
220
- c: 0.2
172
+ l: 58,
173
+ c: 0.22
221
174
  },
222
175
  "--color-nf-on-accent": {
223
176
  l: 98,
@@ -226,20 +179,20 @@ const NF_ACCENT_SETTINGS = {
226
179
  },
227
180
  dark: {
228
181
  "--nf-accent": {
229
- l: 58,
230
- c: 0.233
182
+ l: 75,
183
+ c: 0.18
231
184
  },
232
185
  "--nf-on-accent": {
233
- l: 96,
234
- c: 0.018
186
+ l: 15,
187
+ c: 0.02
235
188
  },
236
189
  "--color-nf-accent": {
237
- l: 58,
238
- c: 0.233
190
+ l: 75,
191
+ c: 0.18
239
192
  },
240
193
  "--color-nf-on-accent": {
241
- l: 96,
242
- c: 0.018
194
+ l: 15,
195
+ c: 0.02
243
196
  }
244
197
  }
245
198
  };
@@ -364,7 +317,7 @@ function getResolvedTheme() {
364
317
  function applyHueShift(targetHue, saturation = 100, lightnessOffset = 0) {
365
318
  if (!checkCspAllowsInlineStyles()) return;
366
319
  const root = document.documentElement;
367
- const oklchHue = hslHueToOklchHue(targetHue);
320
+ const oklchHue = (targetHue % 360 + 360) % 360;
368
321
  const chromaScale = 0 === saturation ? 0 : MIN_CHROMA_SCALE + saturation / 100 * (1 - MIN_CHROMA_SCALE);
369
322
  const resolvedTheme = getResolvedTheme();
370
323
  const clampL = (l)=>Math.max(0, Math.min(100, l + lightnessOffset));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "1.1.15",
3
+ "version": "1.1.16",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",