@symblight/md-colors 0.1.0 → 0.2.0
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 +72 -25
- package/dist/cli.js +157 -0
- package/dist/client.cjs +6492 -0
- package/dist/client.cjs.map +7 -0
- package/dist/client.esm.js +98 -673
- package/dist/client.esm.js.map +4 -4
- package/dist/client.js +3 -3
- package/dist/client.js.map +4 -4
- package/dist/index.js +108 -20
- package/dist/index.js.map +3 -3
- package/package.json +9 -4
package/dist/client.esm.js
CHANGED
|
@@ -41,10 +41,6 @@ function sanitizeDegreesDouble(degrees) {
|
|
|
41
41
|
}
|
|
42
42
|
return degrees;
|
|
43
43
|
}
|
|
44
|
-
function rotationDirection(from, to) {
|
|
45
|
-
const increasingDifference = sanitizeDegreesDouble(to - from);
|
|
46
|
-
return increasingDifference <= 180 ? 1 : -1;
|
|
47
|
-
}
|
|
48
44
|
function differenceDegrees(a, b) {
|
|
49
45
|
return 180 - Math.abs(Math.abs(a - b) - 180);
|
|
50
46
|
}
|
|
@@ -113,26 +109,6 @@ function xyzFromArgb(argb) {
|
|
|
113
109
|
const b = linearized(blueFromArgb(argb));
|
|
114
110
|
return matrixMultiply([r2, g, b], SRGB_TO_XYZ);
|
|
115
111
|
}
|
|
116
|
-
function labFromArgb(argb) {
|
|
117
|
-
const linearR = linearized(redFromArgb(argb));
|
|
118
|
-
const linearG = linearized(greenFromArgb(argb));
|
|
119
|
-
const linearB = linearized(blueFromArgb(argb));
|
|
120
|
-
const matrix = SRGB_TO_XYZ;
|
|
121
|
-
const x = matrix[0][0] * linearR + matrix[0][1] * linearG + matrix[0][2] * linearB;
|
|
122
|
-
const y = matrix[1][0] * linearR + matrix[1][1] * linearG + matrix[1][2] * linearB;
|
|
123
|
-
const z = matrix[2][0] * linearR + matrix[2][1] * linearG + matrix[2][2] * linearB;
|
|
124
|
-
const whitePoint = WHITE_POINT_D65;
|
|
125
|
-
const xNormalized = x / whitePoint[0];
|
|
126
|
-
const yNormalized = y / whitePoint[1];
|
|
127
|
-
const zNormalized = z / whitePoint[2];
|
|
128
|
-
const fx = labF(xNormalized);
|
|
129
|
-
const fy = labF(yNormalized);
|
|
130
|
-
const fz = labF(zNormalized);
|
|
131
|
-
const l = 116 * fy - 16;
|
|
132
|
-
const a = 500 * (fx - fy);
|
|
133
|
-
const b = 200 * (fy - fz);
|
|
134
|
-
return [l, a, b];
|
|
135
|
-
}
|
|
136
112
|
function argbFromLstar(lstar) {
|
|
137
113
|
const y = yFromLstar(lstar);
|
|
138
114
|
const component = delinearized(y);
|
|
@@ -1276,69 +1252,6 @@ var Hct = class _Hct {
|
|
|
1276
1252
|
}
|
|
1277
1253
|
};
|
|
1278
1254
|
|
|
1279
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/blend/blend.js
|
|
1280
|
-
var Blend = class _Blend {
|
|
1281
|
-
/**
|
|
1282
|
-
* Blend the design color's HCT hue towards the key color's HCT
|
|
1283
|
-
* hue, in a way that leaves the original color recognizable and
|
|
1284
|
-
* recognizably shifted towards the key color.
|
|
1285
|
-
*
|
|
1286
|
-
* @param designColor ARGB representation of an arbitrary color.
|
|
1287
|
-
* @param sourceColor ARGB representation of the main theme color.
|
|
1288
|
-
* @return The design color with a hue shifted towards the
|
|
1289
|
-
* system's color, a slightly warmer/cooler variant of the design
|
|
1290
|
-
* color's hue.
|
|
1291
|
-
*/
|
|
1292
|
-
static harmonize(designColor, sourceColor) {
|
|
1293
|
-
const fromHct = Hct.fromInt(designColor);
|
|
1294
|
-
const toHct = Hct.fromInt(sourceColor);
|
|
1295
|
-
const differenceDegrees2 = differenceDegrees(fromHct.hue, toHct.hue);
|
|
1296
|
-
const rotationDegrees = Math.min(differenceDegrees2 * 0.5, 15);
|
|
1297
|
-
const outputHue = sanitizeDegreesDouble(fromHct.hue + rotationDegrees * rotationDirection(fromHct.hue, toHct.hue));
|
|
1298
|
-
return Hct.from(outputHue, fromHct.chroma, fromHct.tone).toInt();
|
|
1299
|
-
}
|
|
1300
|
-
/**
|
|
1301
|
-
* Blends hue from one color into another. The chroma and tone of
|
|
1302
|
-
* the original color are maintained.
|
|
1303
|
-
*
|
|
1304
|
-
* @param from ARGB representation of color
|
|
1305
|
-
* @param to ARGB representation of color
|
|
1306
|
-
* @param amount how much blending to perform; 0.0 >= and <= 1.0
|
|
1307
|
-
* @return from, with a hue blended towards to. Chroma and tone
|
|
1308
|
-
* are constant.
|
|
1309
|
-
*/
|
|
1310
|
-
static hctHue(from, to, amount) {
|
|
1311
|
-
const ucs = _Blend.cam16Ucs(from, to, amount);
|
|
1312
|
-
const ucsCam = Cam16.fromInt(ucs);
|
|
1313
|
-
const fromCam = Cam16.fromInt(from);
|
|
1314
|
-
const blended = Hct.from(ucsCam.hue, fromCam.chroma, lstarFromArgb(from));
|
|
1315
|
-
return blended.toInt();
|
|
1316
|
-
}
|
|
1317
|
-
/**
|
|
1318
|
-
* Blend in CAM16-UCS space.
|
|
1319
|
-
*
|
|
1320
|
-
* @param from ARGB representation of color
|
|
1321
|
-
* @param to ARGB representation of color
|
|
1322
|
-
* @param amount how much blending to perform; 0.0 >= and <= 1.0
|
|
1323
|
-
* @return from, blended towards to. Hue, chroma, and tone will
|
|
1324
|
-
* change.
|
|
1325
|
-
*/
|
|
1326
|
-
static cam16Ucs(from, to, amount) {
|
|
1327
|
-
const fromCam = Cam16.fromInt(from);
|
|
1328
|
-
const toCam = Cam16.fromInt(to);
|
|
1329
|
-
const fromJ = fromCam.jstar;
|
|
1330
|
-
const fromA = fromCam.astar;
|
|
1331
|
-
const fromB = fromCam.bstar;
|
|
1332
|
-
const toJ = toCam.jstar;
|
|
1333
|
-
const toA = toCam.astar;
|
|
1334
|
-
const toB = toCam.bstar;
|
|
1335
|
-
const jstar = fromJ + (toJ - fromJ) * amount;
|
|
1336
|
-
const astar = fromA + (toA - fromA) * amount;
|
|
1337
|
-
const bstar = fromB + (toB - fromB) * amount;
|
|
1338
|
-
return Cam16.fromUcs(jstar, astar, bstar).toInt();
|
|
1339
|
-
}
|
|
1340
|
-
};
|
|
1341
|
-
|
|
1342
1255
|
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/contrast/contrast.js
|
|
1343
1256
|
var Contrast = class _Contrast {
|
|
1344
1257
|
/**
|
|
@@ -2653,522 +2566,6 @@ var DynamicScheme = class {
|
|
|
2653
2566
|
}
|
|
2654
2567
|
};
|
|
2655
2568
|
|
|
2656
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/palettes/core_palette.js
|
|
2657
|
-
var CorePalette = class _CorePalette {
|
|
2658
|
-
/**
|
|
2659
|
-
* @param argb ARGB representation of a color
|
|
2660
|
-
*/
|
|
2661
|
-
static of(argb) {
|
|
2662
|
-
return new _CorePalette(argb, false);
|
|
2663
|
-
}
|
|
2664
|
-
/**
|
|
2665
|
-
* @param argb ARGB representation of a color
|
|
2666
|
-
*/
|
|
2667
|
-
static contentOf(argb) {
|
|
2668
|
-
return new _CorePalette(argb, true);
|
|
2669
|
-
}
|
|
2670
|
-
/**
|
|
2671
|
-
* Create a [CorePalette] from a set of colors
|
|
2672
|
-
*/
|
|
2673
|
-
static fromColors(colors) {
|
|
2674
|
-
return _CorePalette.createPaletteFromColors(false, colors);
|
|
2675
|
-
}
|
|
2676
|
-
/**
|
|
2677
|
-
* Create a content [CorePalette] from a set of colors
|
|
2678
|
-
*/
|
|
2679
|
-
static contentFromColors(colors) {
|
|
2680
|
-
return _CorePalette.createPaletteFromColors(true, colors);
|
|
2681
|
-
}
|
|
2682
|
-
static createPaletteFromColors(content, colors) {
|
|
2683
|
-
const palette = new _CorePalette(colors.primary, content);
|
|
2684
|
-
if (colors.secondary) {
|
|
2685
|
-
const p4 = new _CorePalette(colors.secondary, content);
|
|
2686
|
-
palette.a2 = p4.a1;
|
|
2687
|
-
}
|
|
2688
|
-
if (colors.tertiary) {
|
|
2689
|
-
const p4 = new _CorePalette(colors.tertiary, content);
|
|
2690
|
-
palette.a3 = p4.a1;
|
|
2691
|
-
}
|
|
2692
|
-
if (colors.error) {
|
|
2693
|
-
const p4 = new _CorePalette(colors.error, content);
|
|
2694
|
-
palette.error = p4.a1;
|
|
2695
|
-
}
|
|
2696
|
-
if (colors.neutral) {
|
|
2697
|
-
const p4 = new _CorePalette(colors.neutral, content);
|
|
2698
|
-
palette.n1 = p4.n1;
|
|
2699
|
-
}
|
|
2700
|
-
if (colors.neutralVariant) {
|
|
2701
|
-
const p4 = new _CorePalette(colors.neutralVariant, content);
|
|
2702
|
-
palette.n2 = p4.n2;
|
|
2703
|
-
}
|
|
2704
|
-
return palette;
|
|
2705
|
-
}
|
|
2706
|
-
constructor(argb, isContent) {
|
|
2707
|
-
const hct = Hct.fromInt(argb);
|
|
2708
|
-
const hue3 = hct.hue;
|
|
2709
|
-
const chroma = hct.chroma;
|
|
2710
|
-
if (isContent) {
|
|
2711
|
-
this.a1 = TonalPalette.fromHueAndChroma(hue3, chroma);
|
|
2712
|
-
this.a2 = TonalPalette.fromHueAndChroma(hue3, chroma / 3);
|
|
2713
|
-
this.a3 = TonalPalette.fromHueAndChroma(hue3 + 60, chroma / 2);
|
|
2714
|
-
this.n1 = TonalPalette.fromHueAndChroma(hue3, Math.min(chroma / 12, 4));
|
|
2715
|
-
this.n2 = TonalPalette.fromHueAndChroma(hue3, Math.min(chroma / 6, 8));
|
|
2716
|
-
} else {
|
|
2717
|
-
this.a1 = TonalPalette.fromHueAndChroma(hue3, Math.max(48, chroma));
|
|
2718
|
-
this.a2 = TonalPalette.fromHueAndChroma(hue3, 16);
|
|
2719
|
-
this.a3 = TonalPalette.fromHueAndChroma(hue3 + 60, 24);
|
|
2720
|
-
this.n1 = TonalPalette.fromHueAndChroma(hue3, 4);
|
|
2721
|
-
this.n2 = TonalPalette.fromHueAndChroma(hue3, 8);
|
|
2722
|
-
}
|
|
2723
|
-
this.error = TonalPalette.fromHueAndChroma(25, 84);
|
|
2724
|
-
}
|
|
2725
|
-
};
|
|
2726
|
-
|
|
2727
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/scheme/scheme.js
|
|
2728
|
-
var Scheme = class _Scheme {
|
|
2729
|
-
get primary() {
|
|
2730
|
-
return this.props.primary;
|
|
2731
|
-
}
|
|
2732
|
-
get onPrimary() {
|
|
2733
|
-
return this.props.onPrimary;
|
|
2734
|
-
}
|
|
2735
|
-
get primaryContainer() {
|
|
2736
|
-
return this.props.primaryContainer;
|
|
2737
|
-
}
|
|
2738
|
-
get onPrimaryContainer() {
|
|
2739
|
-
return this.props.onPrimaryContainer;
|
|
2740
|
-
}
|
|
2741
|
-
get secondary() {
|
|
2742
|
-
return this.props.secondary;
|
|
2743
|
-
}
|
|
2744
|
-
get onSecondary() {
|
|
2745
|
-
return this.props.onSecondary;
|
|
2746
|
-
}
|
|
2747
|
-
get secondaryContainer() {
|
|
2748
|
-
return this.props.secondaryContainer;
|
|
2749
|
-
}
|
|
2750
|
-
get onSecondaryContainer() {
|
|
2751
|
-
return this.props.onSecondaryContainer;
|
|
2752
|
-
}
|
|
2753
|
-
get tertiary() {
|
|
2754
|
-
return this.props.tertiary;
|
|
2755
|
-
}
|
|
2756
|
-
get onTertiary() {
|
|
2757
|
-
return this.props.onTertiary;
|
|
2758
|
-
}
|
|
2759
|
-
get tertiaryContainer() {
|
|
2760
|
-
return this.props.tertiaryContainer;
|
|
2761
|
-
}
|
|
2762
|
-
get onTertiaryContainer() {
|
|
2763
|
-
return this.props.onTertiaryContainer;
|
|
2764
|
-
}
|
|
2765
|
-
get error() {
|
|
2766
|
-
return this.props.error;
|
|
2767
|
-
}
|
|
2768
|
-
get onError() {
|
|
2769
|
-
return this.props.onError;
|
|
2770
|
-
}
|
|
2771
|
-
get errorContainer() {
|
|
2772
|
-
return this.props.errorContainer;
|
|
2773
|
-
}
|
|
2774
|
-
get onErrorContainer() {
|
|
2775
|
-
return this.props.onErrorContainer;
|
|
2776
|
-
}
|
|
2777
|
-
get background() {
|
|
2778
|
-
return this.props.background;
|
|
2779
|
-
}
|
|
2780
|
-
get onBackground() {
|
|
2781
|
-
return this.props.onBackground;
|
|
2782
|
-
}
|
|
2783
|
-
get surface() {
|
|
2784
|
-
return this.props.surface;
|
|
2785
|
-
}
|
|
2786
|
-
get onSurface() {
|
|
2787
|
-
return this.props.onSurface;
|
|
2788
|
-
}
|
|
2789
|
-
get surfaceVariant() {
|
|
2790
|
-
return this.props.surfaceVariant;
|
|
2791
|
-
}
|
|
2792
|
-
get onSurfaceVariant() {
|
|
2793
|
-
return this.props.onSurfaceVariant;
|
|
2794
|
-
}
|
|
2795
|
-
get outline() {
|
|
2796
|
-
return this.props.outline;
|
|
2797
|
-
}
|
|
2798
|
-
get outlineVariant() {
|
|
2799
|
-
return this.props.outlineVariant;
|
|
2800
|
-
}
|
|
2801
|
-
get shadow() {
|
|
2802
|
-
return this.props.shadow;
|
|
2803
|
-
}
|
|
2804
|
-
get scrim() {
|
|
2805
|
-
return this.props.scrim;
|
|
2806
|
-
}
|
|
2807
|
-
get inverseSurface() {
|
|
2808
|
-
return this.props.inverseSurface;
|
|
2809
|
-
}
|
|
2810
|
-
get inverseOnSurface() {
|
|
2811
|
-
return this.props.inverseOnSurface;
|
|
2812
|
-
}
|
|
2813
|
-
get inversePrimary() {
|
|
2814
|
-
return this.props.inversePrimary;
|
|
2815
|
-
}
|
|
2816
|
-
/**
|
|
2817
|
-
* @param argb ARGB representation of a color.
|
|
2818
|
-
* @return Light Material color scheme, based on the color's hue.
|
|
2819
|
-
*/
|
|
2820
|
-
static light(argb) {
|
|
2821
|
-
return _Scheme.lightFromCorePalette(CorePalette.of(argb));
|
|
2822
|
-
}
|
|
2823
|
-
/**
|
|
2824
|
-
* @param argb ARGB representation of a color.
|
|
2825
|
-
* @return Dark Material color scheme, based on the color's hue.
|
|
2826
|
-
*/
|
|
2827
|
-
static dark(argb) {
|
|
2828
|
-
return _Scheme.darkFromCorePalette(CorePalette.of(argb));
|
|
2829
|
-
}
|
|
2830
|
-
/**
|
|
2831
|
-
* @param argb ARGB representation of a color.
|
|
2832
|
-
* @return Light Material content color scheme, based on the color's hue.
|
|
2833
|
-
*/
|
|
2834
|
-
static lightContent(argb) {
|
|
2835
|
-
return _Scheme.lightFromCorePalette(CorePalette.contentOf(argb));
|
|
2836
|
-
}
|
|
2837
|
-
/**
|
|
2838
|
-
* @param argb ARGB representation of a color.
|
|
2839
|
-
* @return Dark Material content color scheme, based on the color's hue.
|
|
2840
|
-
*/
|
|
2841
|
-
static darkContent(argb) {
|
|
2842
|
-
return _Scheme.darkFromCorePalette(CorePalette.contentOf(argb));
|
|
2843
|
-
}
|
|
2844
|
-
/**
|
|
2845
|
-
* Light scheme from core palette
|
|
2846
|
-
*/
|
|
2847
|
-
static lightFromCorePalette(core) {
|
|
2848
|
-
return new _Scheme({
|
|
2849
|
-
primary: core.a1.tone(40),
|
|
2850
|
-
onPrimary: core.a1.tone(100),
|
|
2851
|
-
primaryContainer: core.a1.tone(90),
|
|
2852
|
-
onPrimaryContainer: core.a1.tone(10),
|
|
2853
|
-
secondary: core.a2.tone(40),
|
|
2854
|
-
onSecondary: core.a2.tone(100),
|
|
2855
|
-
secondaryContainer: core.a2.tone(90),
|
|
2856
|
-
onSecondaryContainer: core.a2.tone(10),
|
|
2857
|
-
tertiary: core.a3.tone(40),
|
|
2858
|
-
onTertiary: core.a3.tone(100),
|
|
2859
|
-
tertiaryContainer: core.a3.tone(90),
|
|
2860
|
-
onTertiaryContainer: core.a3.tone(10),
|
|
2861
|
-
error: core.error.tone(40),
|
|
2862
|
-
onError: core.error.tone(100),
|
|
2863
|
-
errorContainer: core.error.tone(90),
|
|
2864
|
-
onErrorContainer: core.error.tone(10),
|
|
2865
|
-
background: core.n1.tone(99),
|
|
2866
|
-
onBackground: core.n1.tone(10),
|
|
2867
|
-
surface: core.n1.tone(99),
|
|
2868
|
-
onSurface: core.n1.tone(10),
|
|
2869
|
-
surfaceVariant: core.n2.tone(90),
|
|
2870
|
-
onSurfaceVariant: core.n2.tone(30),
|
|
2871
|
-
outline: core.n2.tone(50),
|
|
2872
|
-
outlineVariant: core.n2.tone(80),
|
|
2873
|
-
shadow: core.n1.tone(0),
|
|
2874
|
-
scrim: core.n1.tone(0),
|
|
2875
|
-
inverseSurface: core.n1.tone(20),
|
|
2876
|
-
inverseOnSurface: core.n1.tone(95),
|
|
2877
|
-
inversePrimary: core.a1.tone(80)
|
|
2878
|
-
});
|
|
2879
|
-
}
|
|
2880
|
-
/**
|
|
2881
|
-
* Dark scheme from core palette
|
|
2882
|
-
*/
|
|
2883
|
-
static darkFromCorePalette(core) {
|
|
2884
|
-
return new _Scheme({
|
|
2885
|
-
primary: core.a1.tone(80),
|
|
2886
|
-
onPrimary: core.a1.tone(20),
|
|
2887
|
-
primaryContainer: core.a1.tone(30),
|
|
2888
|
-
onPrimaryContainer: core.a1.tone(90),
|
|
2889
|
-
secondary: core.a2.tone(80),
|
|
2890
|
-
onSecondary: core.a2.tone(20),
|
|
2891
|
-
secondaryContainer: core.a2.tone(30),
|
|
2892
|
-
onSecondaryContainer: core.a2.tone(90),
|
|
2893
|
-
tertiary: core.a3.tone(80),
|
|
2894
|
-
onTertiary: core.a3.tone(20),
|
|
2895
|
-
tertiaryContainer: core.a3.tone(30),
|
|
2896
|
-
onTertiaryContainer: core.a3.tone(90),
|
|
2897
|
-
error: core.error.tone(80),
|
|
2898
|
-
onError: core.error.tone(20),
|
|
2899
|
-
errorContainer: core.error.tone(30),
|
|
2900
|
-
onErrorContainer: core.error.tone(80),
|
|
2901
|
-
background: core.n1.tone(10),
|
|
2902
|
-
onBackground: core.n1.tone(90),
|
|
2903
|
-
surface: core.n1.tone(10),
|
|
2904
|
-
onSurface: core.n1.tone(90),
|
|
2905
|
-
surfaceVariant: core.n2.tone(30),
|
|
2906
|
-
onSurfaceVariant: core.n2.tone(80),
|
|
2907
|
-
outline: core.n2.tone(60),
|
|
2908
|
-
outlineVariant: core.n2.tone(30),
|
|
2909
|
-
shadow: core.n1.tone(0),
|
|
2910
|
-
scrim: core.n1.tone(0),
|
|
2911
|
-
inverseSurface: core.n1.tone(90),
|
|
2912
|
-
inverseOnSurface: core.n1.tone(20),
|
|
2913
|
-
inversePrimary: core.a1.tone(40)
|
|
2914
|
-
});
|
|
2915
|
-
}
|
|
2916
|
-
constructor(props) {
|
|
2917
|
-
this.props = props;
|
|
2918
|
-
}
|
|
2919
|
-
toJSON() {
|
|
2920
|
-
return {
|
|
2921
|
-
...this.props
|
|
2922
|
-
};
|
|
2923
|
-
}
|
|
2924
|
-
};
|
|
2925
|
-
|
|
2926
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/temperature/temperature_cache.js
|
|
2927
|
-
var TemperatureCache = class _TemperatureCache {
|
|
2928
|
-
constructor(input) {
|
|
2929
|
-
this.input = input;
|
|
2930
|
-
this.hctsByTempCache = [];
|
|
2931
|
-
this.hctsByHueCache = [];
|
|
2932
|
-
this.tempsByHctCache = /* @__PURE__ */ new Map();
|
|
2933
|
-
this.inputRelativeTemperatureCache = -1;
|
|
2934
|
-
this.complementCache = null;
|
|
2935
|
-
}
|
|
2936
|
-
get hctsByTemp() {
|
|
2937
|
-
if (this.hctsByTempCache.length > 0) {
|
|
2938
|
-
return this.hctsByTempCache;
|
|
2939
|
-
}
|
|
2940
|
-
const hcts = this.hctsByHue.concat([this.input]);
|
|
2941
|
-
const temperaturesByHct = this.tempsByHct;
|
|
2942
|
-
hcts.sort((a, b) => temperaturesByHct.get(a) - temperaturesByHct.get(b));
|
|
2943
|
-
this.hctsByTempCache = hcts;
|
|
2944
|
-
return hcts;
|
|
2945
|
-
}
|
|
2946
|
-
get warmest() {
|
|
2947
|
-
return this.hctsByTemp[this.hctsByTemp.length - 1];
|
|
2948
|
-
}
|
|
2949
|
-
get coldest() {
|
|
2950
|
-
return this.hctsByTemp[0];
|
|
2951
|
-
}
|
|
2952
|
-
/**
|
|
2953
|
-
* A set of colors with differing hues, equidistant in temperature.
|
|
2954
|
-
*
|
|
2955
|
-
* In art, this is usually described as a set of 5 colors on a color wheel
|
|
2956
|
-
* divided into 12 sections. This method allows provision of either of those
|
|
2957
|
-
* values.
|
|
2958
|
-
*
|
|
2959
|
-
* Behavior is undefined when [count] or [divisions] is 0.
|
|
2960
|
-
* When divisions < count, colors repeat.
|
|
2961
|
-
*
|
|
2962
|
-
* [count] The number of colors to return, includes the input color.
|
|
2963
|
-
* [divisions] The number of divisions on the color wheel.
|
|
2964
|
-
*/
|
|
2965
|
-
analogous(count = 5, divisions = 12) {
|
|
2966
|
-
const startHue = Math.round(this.input.hue);
|
|
2967
|
-
const startHct = this.hctsByHue[startHue];
|
|
2968
|
-
let lastTemp = this.relativeTemperature(startHct);
|
|
2969
|
-
const allColors = [startHct];
|
|
2970
|
-
let absoluteTotalTempDelta = 0;
|
|
2971
|
-
for (let i = 0; i < 360; i++) {
|
|
2972
|
-
const hue3 = sanitizeDegreesInt(startHue + i);
|
|
2973
|
-
const hct = this.hctsByHue[hue3];
|
|
2974
|
-
const temp = this.relativeTemperature(hct);
|
|
2975
|
-
const tempDelta = Math.abs(temp - lastTemp);
|
|
2976
|
-
lastTemp = temp;
|
|
2977
|
-
absoluteTotalTempDelta += tempDelta;
|
|
2978
|
-
}
|
|
2979
|
-
let hueAddend = 1;
|
|
2980
|
-
const tempStep = absoluteTotalTempDelta / divisions;
|
|
2981
|
-
let totalTempDelta = 0;
|
|
2982
|
-
lastTemp = this.relativeTemperature(startHct);
|
|
2983
|
-
while (allColors.length < divisions) {
|
|
2984
|
-
const hue3 = sanitizeDegreesInt(startHue + hueAddend);
|
|
2985
|
-
const hct = this.hctsByHue[hue3];
|
|
2986
|
-
const temp = this.relativeTemperature(hct);
|
|
2987
|
-
const tempDelta = Math.abs(temp - lastTemp);
|
|
2988
|
-
totalTempDelta += tempDelta;
|
|
2989
|
-
const desiredTotalTempDeltaForIndex = allColors.length * tempStep;
|
|
2990
|
-
let indexSatisfied = totalTempDelta >= desiredTotalTempDeltaForIndex;
|
|
2991
|
-
let indexAddend = 1;
|
|
2992
|
-
while (indexSatisfied && allColors.length < divisions) {
|
|
2993
|
-
allColors.push(hct);
|
|
2994
|
-
const desiredTotalTempDeltaForIndex2 = (allColors.length + indexAddend) * tempStep;
|
|
2995
|
-
indexSatisfied = totalTempDelta >= desiredTotalTempDeltaForIndex2;
|
|
2996
|
-
indexAddend++;
|
|
2997
|
-
}
|
|
2998
|
-
lastTemp = temp;
|
|
2999
|
-
hueAddend++;
|
|
3000
|
-
if (hueAddend > 360) {
|
|
3001
|
-
while (allColors.length < divisions) {
|
|
3002
|
-
allColors.push(hct);
|
|
3003
|
-
}
|
|
3004
|
-
break;
|
|
3005
|
-
}
|
|
3006
|
-
}
|
|
3007
|
-
const answers = [this.input];
|
|
3008
|
-
const increaseHueCount = Math.floor((count - 1) / 2);
|
|
3009
|
-
for (let i = 1; i < increaseHueCount + 1; i++) {
|
|
3010
|
-
let index = 0 - i;
|
|
3011
|
-
while (index < 0) {
|
|
3012
|
-
index = allColors.length + index;
|
|
3013
|
-
}
|
|
3014
|
-
if (index >= allColors.length) {
|
|
3015
|
-
index = index % allColors.length;
|
|
3016
|
-
}
|
|
3017
|
-
answers.splice(0, 0, allColors[index]);
|
|
3018
|
-
}
|
|
3019
|
-
const decreaseHueCount = count - increaseHueCount - 1;
|
|
3020
|
-
for (let i = 1; i < decreaseHueCount + 1; i++) {
|
|
3021
|
-
let index = i;
|
|
3022
|
-
while (index < 0) {
|
|
3023
|
-
index = allColors.length + index;
|
|
3024
|
-
}
|
|
3025
|
-
if (index >= allColors.length) {
|
|
3026
|
-
index = index % allColors.length;
|
|
3027
|
-
}
|
|
3028
|
-
answers.push(allColors[index]);
|
|
3029
|
-
}
|
|
3030
|
-
return answers;
|
|
3031
|
-
}
|
|
3032
|
-
/**
|
|
3033
|
-
* A color that complements the input color aesthetically.
|
|
3034
|
-
*
|
|
3035
|
-
* In art, this is usually described as being across the color wheel.
|
|
3036
|
-
* History of this shows intent as a color that is just as cool-warm as the
|
|
3037
|
-
* input color is warm-cool.
|
|
3038
|
-
*/
|
|
3039
|
-
get complement() {
|
|
3040
|
-
if (this.complementCache != null) {
|
|
3041
|
-
return this.complementCache;
|
|
3042
|
-
}
|
|
3043
|
-
const coldestHue = this.coldest.hue;
|
|
3044
|
-
const coldestTemp = this.tempsByHct.get(this.coldest);
|
|
3045
|
-
const warmestHue = this.warmest.hue;
|
|
3046
|
-
const warmestTemp = this.tempsByHct.get(this.warmest);
|
|
3047
|
-
const range = warmestTemp - coldestTemp;
|
|
3048
|
-
const startHueIsColdestToWarmest = _TemperatureCache.isBetween(this.input.hue, coldestHue, warmestHue);
|
|
3049
|
-
const startHue = startHueIsColdestToWarmest ? warmestHue : coldestHue;
|
|
3050
|
-
const endHue = startHueIsColdestToWarmest ? coldestHue : warmestHue;
|
|
3051
|
-
const directionOfRotation = 1;
|
|
3052
|
-
let smallestError = 1e3;
|
|
3053
|
-
let answer = this.hctsByHue[Math.round(this.input.hue)];
|
|
3054
|
-
const complementRelativeTemp = 1 - this.inputRelativeTemperature;
|
|
3055
|
-
for (let hueAddend = 0; hueAddend <= 360; hueAddend += 1) {
|
|
3056
|
-
const hue3 = sanitizeDegreesDouble(startHue + directionOfRotation * hueAddend);
|
|
3057
|
-
if (!_TemperatureCache.isBetween(hue3, startHue, endHue)) {
|
|
3058
|
-
continue;
|
|
3059
|
-
}
|
|
3060
|
-
const possibleAnswer = this.hctsByHue[Math.round(hue3)];
|
|
3061
|
-
const relativeTemp = (this.tempsByHct.get(possibleAnswer) - coldestTemp) / range;
|
|
3062
|
-
const error = Math.abs(complementRelativeTemp - relativeTemp);
|
|
3063
|
-
if (error < smallestError) {
|
|
3064
|
-
smallestError = error;
|
|
3065
|
-
answer = possibleAnswer;
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
this.complementCache = answer;
|
|
3069
|
-
return this.complementCache;
|
|
3070
|
-
}
|
|
3071
|
-
/**
|
|
3072
|
-
* Temperature relative to all colors with the same chroma and tone.
|
|
3073
|
-
* Value on a scale from 0 to 1.
|
|
3074
|
-
*/
|
|
3075
|
-
relativeTemperature(hct) {
|
|
3076
|
-
const range = this.tempsByHct.get(this.warmest) - this.tempsByHct.get(this.coldest);
|
|
3077
|
-
const differenceFromColdest = this.tempsByHct.get(hct) - this.tempsByHct.get(this.coldest);
|
|
3078
|
-
if (range === 0) {
|
|
3079
|
-
return 0.5;
|
|
3080
|
-
}
|
|
3081
|
-
return differenceFromColdest / range;
|
|
3082
|
-
}
|
|
3083
|
-
/** Relative temperature of the input color. See [relativeTemperature]. */
|
|
3084
|
-
get inputRelativeTemperature() {
|
|
3085
|
-
if (this.inputRelativeTemperatureCache >= 0) {
|
|
3086
|
-
return this.inputRelativeTemperatureCache;
|
|
3087
|
-
}
|
|
3088
|
-
this.inputRelativeTemperatureCache = this.relativeTemperature(this.input);
|
|
3089
|
-
return this.inputRelativeTemperatureCache;
|
|
3090
|
-
}
|
|
3091
|
-
/** A Map with keys of HCTs in [hctsByTemp], values of raw temperature. */
|
|
3092
|
-
get tempsByHct() {
|
|
3093
|
-
if (this.tempsByHctCache.size > 0) {
|
|
3094
|
-
return this.tempsByHctCache;
|
|
3095
|
-
}
|
|
3096
|
-
const allHcts = this.hctsByHue.concat([this.input]);
|
|
3097
|
-
const temperaturesByHct = /* @__PURE__ */ new Map();
|
|
3098
|
-
for (const e4 of allHcts) {
|
|
3099
|
-
temperaturesByHct.set(e4, _TemperatureCache.rawTemperature(e4));
|
|
3100
|
-
}
|
|
3101
|
-
this.tempsByHctCache = temperaturesByHct;
|
|
3102
|
-
return temperaturesByHct;
|
|
3103
|
-
}
|
|
3104
|
-
/**
|
|
3105
|
-
* HCTs for all hues, with the same chroma/tone as the input.
|
|
3106
|
-
* Sorted ascending, hue 0 to 360.
|
|
3107
|
-
*/
|
|
3108
|
-
get hctsByHue() {
|
|
3109
|
-
if (this.hctsByHueCache.length > 0) {
|
|
3110
|
-
return this.hctsByHueCache;
|
|
3111
|
-
}
|
|
3112
|
-
const hcts = [];
|
|
3113
|
-
for (let hue3 = 0; hue3 <= 360; hue3 += 1) {
|
|
3114
|
-
const colorAtHue = Hct.from(hue3, this.input.chroma, this.input.tone);
|
|
3115
|
-
hcts.push(colorAtHue);
|
|
3116
|
-
}
|
|
3117
|
-
this.hctsByHueCache = hcts;
|
|
3118
|
-
return this.hctsByHueCache;
|
|
3119
|
-
}
|
|
3120
|
-
/** Determines if an angle is between two other angles, rotating clockwise. */
|
|
3121
|
-
static isBetween(angle, a, b) {
|
|
3122
|
-
if (a < b) {
|
|
3123
|
-
return a <= angle && angle <= b;
|
|
3124
|
-
}
|
|
3125
|
-
return a <= angle || angle <= b;
|
|
3126
|
-
}
|
|
3127
|
-
/**
|
|
3128
|
-
* Value representing cool-warm factor of a color.
|
|
3129
|
-
* Values below 0 are considered cool, above, warm.
|
|
3130
|
-
*
|
|
3131
|
-
* Color science has researched emotion and harmony, which art uses to select
|
|
3132
|
-
* colors. Warm-cool is the foundation of analogous and complementary colors.
|
|
3133
|
-
* See:
|
|
3134
|
-
* - Li-Chen Ou's Chapter 19 in Handbook of Color Psychology (2015).
|
|
3135
|
-
* - Josef Albers' Interaction of Color chapters 19 and 21.
|
|
3136
|
-
*
|
|
3137
|
-
* Implementation of Ou, Woodcock and Wright's algorithm, which uses
|
|
3138
|
-
* L*a*b* / LCH color space.
|
|
3139
|
-
* Return value has these properties:
|
|
3140
|
-
* - Values below 0 are cool, above 0 are warm.
|
|
3141
|
-
* - Lower bound: -0.52 - (chroma ^ 1.07 / 20). L*a*b* chroma is infinite.
|
|
3142
|
-
* Assuming max of 130 chroma, -9.66.
|
|
3143
|
-
* - Upper bound: -0.52 + (chroma ^ 1.07 / 20). L*a*b* chroma is infinite.
|
|
3144
|
-
* Assuming max of 130 chroma, 8.61.
|
|
3145
|
-
*/
|
|
3146
|
-
static rawTemperature(color) {
|
|
3147
|
-
const lab2 = labFromArgb(color.toInt());
|
|
3148
|
-
const hue3 = sanitizeDegreesDouble(Math.atan2(lab2[2], lab2[1]) * 180 / Math.PI);
|
|
3149
|
-
const chroma = Math.sqrt(lab2[1] * lab2[1] + lab2[2] * lab2[2]);
|
|
3150
|
-
const temperature = -0.5 + 0.02 * Math.pow(chroma, 1.07) * Math.cos(sanitizeDegreesDouble(hue3 - 50) * Math.PI / 180);
|
|
3151
|
-
return temperature;
|
|
3152
|
-
}
|
|
3153
|
-
};
|
|
3154
|
-
|
|
3155
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/scheme/scheme_content.js
|
|
3156
|
-
var SchemeContent = class extends DynamicScheme {
|
|
3157
|
-
constructor(sourceColorHct, isDark, contrastLevel) {
|
|
3158
|
-
super({
|
|
3159
|
-
sourceColorArgb: sourceColorHct.toInt(),
|
|
3160
|
-
variant: Variant.CONTENT,
|
|
3161
|
-
contrastLevel,
|
|
3162
|
-
isDark,
|
|
3163
|
-
primaryPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma),
|
|
3164
|
-
secondaryPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, Math.max(sourceColorHct.chroma - 32, sourceColorHct.chroma * 0.5)),
|
|
3165
|
-
tertiaryPalette: TonalPalette.fromInt(DislikeAnalyzer.fixIfDisliked(new TemperatureCache(sourceColorHct).analogous(3, 6)[2]).toInt()),
|
|
3166
|
-
neutralPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8),
|
|
3167
|
-
neutralVariantPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8 + 4)
|
|
3168
|
-
});
|
|
3169
|
-
}
|
|
3170
|
-
};
|
|
3171
|
-
|
|
3172
2569
|
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/scheme/scheme_expressive.js
|
|
3173
2570
|
var SchemeExpressive = class _SchemeExpressive extends DynamicScheme {
|
|
3174
2571
|
constructor(sourceColorHct, isDark, contrastLevel) {
|
|
@@ -3219,6 +2616,23 @@ SchemeExpressive.tertiaryRotations = [
|
|
|
3219
2616
|
120
|
|
3220
2617
|
];
|
|
3221
2618
|
|
|
2619
|
+
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/scheme/scheme_tonal_spot.js
|
|
2620
|
+
var SchemeTonalSpot = class extends DynamicScheme {
|
|
2621
|
+
constructor(sourceColorHct, isDark, contrastLevel) {
|
|
2622
|
+
super({
|
|
2623
|
+
sourceColorArgb: sourceColorHct.toInt(),
|
|
2624
|
+
variant: Variant.TONAL_SPOT,
|
|
2625
|
+
contrastLevel,
|
|
2626
|
+
isDark,
|
|
2627
|
+
primaryPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36),
|
|
2628
|
+
secondaryPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16),
|
|
2629
|
+
tertiaryPalette: TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 60), 24),
|
|
2630
|
+
neutralPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6),
|
|
2631
|
+
neutralVariantPalette: TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8)
|
|
2632
|
+
});
|
|
2633
|
+
}
|
|
2634
|
+
};
|
|
2635
|
+
|
|
3222
2636
|
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/scheme/scheme_vibrant.js
|
|
3223
2637
|
var SchemeVibrant = class _SchemeVibrant extends DynamicScheme {
|
|
3224
2638
|
constructor(sourceColorHct, isDark, contrastLevel) {
|
|
@@ -3410,53 +2824,6 @@ function parseIntHex(value) {
|
|
|
3410
2824
|
return parseInt(value, 16);
|
|
3411
2825
|
}
|
|
3412
2826
|
|
|
3413
|
-
// ../../node_modules/.pnpm/@material+material-color-utilities@0.3.0/node_modules/@material/material-color-utilities/utils/theme_utils.js
|
|
3414
|
-
function themeFromSourceColor(source, customColors = []) {
|
|
3415
|
-
const palette = CorePalette.of(source);
|
|
3416
|
-
return {
|
|
3417
|
-
source,
|
|
3418
|
-
schemes: {
|
|
3419
|
-
light: Scheme.light(source),
|
|
3420
|
-
dark: Scheme.dark(source)
|
|
3421
|
-
},
|
|
3422
|
-
palettes: {
|
|
3423
|
-
primary: palette.a1,
|
|
3424
|
-
secondary: palette.a2,
|
|
3425
|
-
tertiary: palette.a3,
|
|
3426
|
-
neutral: palette.n1,
|
|
3427
|
-
neutralVariant: palette.n2,
|
|
3428
|
-
error: palette.error
|
|
3429
|
-
},
|
|
3430
|
-
customColors: customColors.map((c2) => customColor(source, c2))
|
|
3431
|
-
};
|
|
3432
|
-
}
|
|
3433
|
-
function customColor(source, color) {
|
|
3434
|
-
let value = color.value;
|
|
3435
|
-
const from = value;
|
|
3436
|
-
const to = source;
|
|
3437
|
-
if (color.blend) {
|
|
3438
|
-
value = Blend.harmonize(from, to);
|
|
3439
|
-
}
|
|
3440
|
-
const palette = CorePalette.of(value);
|
|
3441
|
-
const tones = palette.a1;
|
|
3442
|
-
return {
|
|
3443
|
-
color,
|
|
3444
|
-
value,
|
|
3445
|
-
light: {
|
|
3446
|
-
color: tones.tone(40),
|
|
3447
|
-
onColor: tones.tone(100),
|
|
3448
|
-
colorContainer: tones.tone(90),
|
|
3449
|
-
onColorContainer: tones.tone(10)
|
|
3450
|
-
},
|
|
3451
|
-
dark: {
|
|
3452
|
-
color: tones.tone(80),
|
|
3453
|
-
onColor: tones.tone(20),
|
|
3454
|
-
colorContainer: tones.tone(30),
|
|
3455
|
-
onColorContainer: tones.tone(90)
|
|
3456
|
-
}
|
|
3457
|
-
};
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
2827
|
// ../../node_modules/.pnpm/culori@4.0.2/node_modules/culori/src/rgb/parseNumber.js
|
|
3461
2828
|
var parseNumber = (color, len) => {
|
|
3462
2829
|
if (typeof color !== "number") return;
|
|
@@ -6902,14 +6269,74 @@ var yiq = useMode(definition_default28);
|
|
|
6902
6269
|
|
|
6903
6270
|
// tokens.mjs
|
|
6904
6271
|
var oklch2 = converter_default("oklch");
|
|
6905
|
-
var
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6272
|
+
var DEFAULT_SOURCE_COLOR = "#1D5D78";
|
|
6273
|
+
var HEX_RE = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
6274
|
+
var COLOR_ROLES = (
|
|
6275
|
+
/** @type {const} */
|
|
6276
|
+
[
|
|
6277
|
+
"primary",
|
|
6278
|
+
"onPrimary",
|
|
6279
|
+
"primaryContainer",
|
|
6280
|
+
"onPrimaryContainer",
|
|
6281
|
+
"inversePrimary",
|
|
6282
|
+
"primaryFixed",
|
|
6283
|
+
"primaryFixedDim",
|
|
6284
|
+
"onPrimaryFixed",
|
|
6285
|
+
"onPrimaryFixedVariant",
|
|
6286
|
+
"secondary",
|
|
6287
|
+
"onSecondary",
|
|
6288
|
+
"secondaryContainer",
|
|
6289
|
+
"onSecondaryContainer",
|
|
6290
|
+
"secondaryFixed",
|
|
6291
|
+
"secondaryFixedDim",
|
|
6292
|
+
"onSecondaryFixed",
|
|
6293
|
+
"onSecondaryFixedVariant",
|
|
6294
|
+
"tertiary",
|
|
6295
|
+
"onTertiary",
|
|
6296
|
+
"tertiaryContainer",
|
|
6297
|
+
"onTertiaryContainer",
|
|
6298
|
+
"tertiaryFixed",
|
|
6299
|
+
"tertiaryFixedDim",
|
|
6300
|
+
"onTertiaryFixed",
|
|
6301
|
+
"onTertiaryFixedVariant",
|
|
6302
|
+
"error",
|
|
6303
|
+
"onError",
|
|
6304
|
+
"errorContainer",
|
|
6305
|
+
"onErrorContainer",
|
|
6306
|
+
"surface",
|
|
6307
|
+
"onSurface",
|
|
6308
|
+
"surfaceVariant",
|
|
6309
|
+
"onSurfaceVariant",
|
|
6310
|
+
"surfaceDim",
|
|
6311
|
+
"surfaceBright",
|
|
6312
|
+
"surfaceContainerLowest",
|
|
6313
|
+
"surfaceContainerLow",
|
|
6314
|
+
"surfaceContainer",
|
|
6315
|
+
"surfaceContainerHigh",
|
|
6316
|
+
"surfaceContainerHighest",
|
|
6317
|
+
"surfaceTint",
|
|
6318
|
+
"inverseSurface",
|
|
6319
|
+
"inverseOnSurface",
|
|
6320
|
+
"outline",
|
|
6321
|
+
"outlineVariant",
|
|
6322
|
+
"shadow",
|
|
6323
|
+
"scrim",
|
|
6324
|
+
"background",
|
|
6325
|
+
"onBackground"
|
|
6326
|
+
]
|
|
6327
|
+
);
|
|
6328
|
+
function resolveConfig({ sourceColor = DEFAULT_SOURCE_COLOR, scheme = "light" } = {}) {
|
|
6329
|
+
if (typeof sourceColor !== "string" || !HEX_RE.test(sourceColor)) {
|
|
6330
|
+
throw new TypeError(`sourceColor must be a hex color like "#6750A4", got ${JSON.stringify(sourceColor)}`);
|
|
6331
|
+
}
|
|
6332
|
+
if (scheme !== "light" && scheme !== "dark") {
|
|
6333
|
+
throw new TypeError(`scheme must be "light" or "dark", got ${JSON.stringify(scheme)}`);
|
|
6334
|
+
}
|
|
6335
|
+
return { sourceColor, scheme: (
|
|
6336
|
+
/** @type {ColorScheme} */
|
|
6337
|
+
scheme
|
|
6338
|
+
) };
|
|
6339
|
+
}
|
|
6913
6340
|
function setSchemeProperties(scheme, suffix = "") {
|
|
6914
6341
|
let result = {};
|
|
6915
6342
|
for (const [key, value] of Object.entries(scheme)) {
|
|
@@ -6922,32 +6349,30 @@ function setSchemeProperties(scheme, suffix = "") {
|
|
|
6922
6349
|
}
|
|
6923
6350
|
return result;
|
|
6924
6351
|
}
|
|
6925
|
-
function generateTokens(config = {
|
|
6926
|
-
const
|
|
6927
|
-
const
|
|
6928
|
-
Hct.fromInt(argbFromHex(
|
|
6929
|
-
|
|
6352
|
+
function generateTokens(config = {}) {
|
|
6353
|
+
const { sourceColor, scheme } = resolveConfig(config);
|
|
6354
|
+
const dynamicScheme = new SchemeTonalSpot(
|
|
6355
|
+
Hct.fromInt(argbFromHex(sourceColor)),
|
|
6356
|
+
scheme === "dark",
|
|
6930
6357
|
0
|
|
6931
6358
|
);
|
|
6932
6359
|
let palette = {};
|
|
6933
|
-
for (const
|
|
6934
|
-
palette[
|
|
6360
|
+
for (const role of COLOR_ROLES) {
|
|
6361
|
+
palette[role] = MaterialDynamicColors[role].getArgb(dynamicScheme);
|
|
6935
6362
|
}
|
|
6936
|
-
|
|
6937
|
-
const tokens = setSchemeProperties({ ...currentTheme, ...palette });
|
|
6938
|
-
return tokens;
|
|
6363
|
+
return setSchemeProperties(palette);
|
|
6939
6364
|
}
|
|
6940
6365
|
|
|
6941
6366
|
// client.mjs
|
|
6942
|
-
|
|
6943
|
-
const tokens = generateTokens(
|
|
6944
|
-
sourceColor,
|
|
6945
|
-
scheme
|
|
6946
|
-
});
|
|
6367
|
+
function generateTheme(options = {}) {
|
|
6368
|
+
const tokens = generateTokens(options);
|
|
6947
6369
|
const root = document.documentElement;
|
|
6948
6370
|
for (const [variable, value] of Object.entries(tokens)) {
|
|
6949
6371
|
root.style.setProperty(variable, value);
|
|
6950
6372
|
}
|
|
6373
|
+
}
|
|
6374
|
+
export {
|
|
6375
|
+
generateTheme
|
|
6951
6376
|
};
|
|
6952
6377
|
/*! Bundled license information:
|
|
6953
6378
|
|