@webmate-studio/builder 0.2.147 → 0.2.148
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/package.json +1 -1
- package/src/design-tokens-v2.js +13 -5
package/package.json
CHANGED
package/src/design-tokens-v2.js
CHANGED
|
@@ -110,12 +110,13 @@ export function generateDarkColorScale(baseHex, curve) {
|
|
|
110
110
|
const chromaScale = curve?.preset === 'custom' ? (curve.chromaScale ?? 0.85) : (preset?.chromaScale ?? 0.85);
|
|
111
111
|
|
|
112
112
|
const isPureNeutral = base.c < 0.008;
|
|
113
|
+
const isLowChroma = base.c < 0.04;
|
|
113
114
|
|
|
114
115
|
// Dark Mode: Base etwas heller für bessere Sichtbarkeit
|
|
115
116
|
const darkBaseL = Math.min(base.l + 0.08, 0.65);
|
|
116
117
|
|
|
117
118
|
// Lightness-Rampe adaptiv (invertiert für Dark Mode)
|
|
118
|
-
const L = buildDarkLightnessRamp(darkBaseL);
|
|
119
|
+
const L = buildDarkLightnessRamp(darkBaseL, isLowChroma);
|
|
119
120
|
|
|
120
121
|
const scale = {};
|
|
121
122
|
for (let i = 0; i < 12; i++) {
|
|
@@ -295,17 +296,24 @@ function buildLightnessRamp(baseL, isLowChroma = false) {
|
|
|
295
296
|
* Baut eine strikt monoton steigende Lightness-Rampe für Dark Mode.
|
|
296
297
|
* Steps 1-8: dunkel → darkBaseL, Steps 10-12: darkBaseL → hell.
|
|
297
298
|
*/
|
|
298
|
-
function buildDarkLightnessRamp(darkBaseL) {
|
|
299
|
-
|
|
299
|
+
function buildDarkLightnessRamp(darkBaseL, isLowChroma) {
|
|
300
|
+
// Chromatische Farben (Primary, Secondary, Accent) brauchen hellere
|
|
301
|
+
// dunkle Steps, damit der Farbton sichtbar bleibt. Neutraltöne dürfen
|
|
302
|
+
// sehr dunkel werden (Hintergrundflächen).
|
|
303
|
+
const bottomL = isLowChroma ? 0.14 : 0.22;
|
|
300
304
|
const topL = 0.94;
|
|
301
305
|
|
|
302
|
-
const safeBaseL = Math.max(0.
|
|
306
|
+
const safeBaseL = Math.max(bottomL + 0.08, Math.min(0.85, darkBaseL));
|
|
303
307
|
|
|
304
308
|
const gap = Math.max(0.02, (safeBaseL - bottomL) * 0.05);
|
|
305
309
|
const step8Target = safeBaseL - gap;
|
|
306
310
|
const range = step8Target - bottomL;
|
|
307
311
|
|
|
308
|
-
|
|
312
|
+
// Chromatische Farben: Steps stärker zur Base hin komprimiert,
|
|
313
|
+
// damit die dunklen Steps nicht zu dunkel (=farblos) werden
|
|
314
|
+
const weights = isLowChroma
|
|
315
|
+
? [0.0, 0.04, 0.10, 0.20, 0.34, 0.50, 0.70, 0.92]
|
|
316
|
+
: [0.0, 0.06, 0.14, 0.26, 0.40, 0.55, 0.72, 0.90];
|
|
309
317
|
const darkSteps = weights.map(w => bottomL + w * range);
|
|
310
318
|
|
|
311
319
|
const lightRange = topL - safeBaseL;
|