@xenknight/framework7 0.0.5 → 0.0.7
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/components/app/app.less +1 -1
- package/components/block/block-vars.less +6 -6
- package/components/button/button-vars.less +11 -10
- package/components/dialog/dialog-class.js +6 -3
- package/components/dialog/dialog-ios.less +10 -34
- package/components/dialog/dialog-md.less +2 -22
- package/components/dialog/dialog-rtl.css +1 -1
- package/components/dialog/dialog-vars.less +8 -10
- package/components/dialog/dialog.css +1 -1
- package/components/dialog/dialog.js +3 -3
- package/components/dialog/dialog.less +6 -25
- package/components/icon/icon-ios.less +9 -0
- package/components/icon/icon-md.less +9 -0
- package/components/icon/icon.less +2 -1
- package/components/list/list-vars.less +8 -6
- package/components/list/list.less +1 -1
- package/components/messagebar/messagebar-rtl.css +1 -1
- package/components/messagebar/messagebar-vars.less +1 -1
- package/components/messagebar/messagebar.css +1 -1
- package/components/messages/messages-rtl.css +1 -1
- package/components/messages/messages-vars.less +7 -7
- package/components/messages/messages.css +1 -1
- package/components/navbar-new/navbar-ios.less +135 -0
- package/components/navbar-new/navbar-md.less +105 -0
- package/components/navbar-new/navbar-vars.less +78 -0
- package/components/navbar-new/navbar.d.ts +77 -0
- package/components/navbar-new/navbar.js +568 -0
- package/components/navbar-new/navbar.less +268 -0
- package/components/notification/notification-class.js +6 -6
- package/components/notification/notification-ios.less +3 -8
- package/components/notification/notification-md.less +1 -20
- package/components/notification/notification-rtl.css +1 -1
- package/components/notification/notification-vars.less +13 -16
- package/components/notification/notification.css +1 -1
- package/components/notification/notification.less +13 -1
- package/components/popover/popover-class.js +21 -58
- package/components/popover/popover-ios.less +66 -2
- package/components/popover/popover-md.less +2 -27
- package/components/popover/popover-rtl.css +1 -1
- package/components/popover/popover-vars.less +2 -3
- package/components/popover/popover.css +1 -1
- package/components/popover/popover.d.ts +0 -2
- package/components/popover/popover.js +0 -1
- package/components/popover/popover.less +28 -50
- package/components/range/range-class.js +34 -27
- package/components/range/range-ios.less +60 -0
- package/components/range/range-md.less +67 -4
- package/components/range/range-rtl.css +1 -1
- package/components/range/range-vars.less +18 -13
- package/components/range/range.css +1 -1
- package/components/range/range.d.ts +3 -1
- package/components/range/range.less +11 -24
- package/components/searchbar-new/remove-diacritics.js +271 -0
- package/components/searchbar-new/searchbar-ios.less +131 -0
- package/components/searchbar-new/searchbar-md.less +153 -0
- package/components/searchbar-new/searchbar-new-class.js +592 -0
- package/components/searchbar-new/searchbar-vars.less +75 -0
- package/components/searchbar-new/searchbar.js +122 -0
- package/components/searchbar-new/searchbar.less +331 -0
- package/components/swipeout/swipeout-ios.less +37 -0
- package/components/swipeout/swipeout-md.less +56 -0
- package/components/swipeout/swipeout-rtl.css +1 -1
- package/components/swipeout/swipeout-vars.less +13 -2
- package/components/swipeout/swipeout.css +1 -1
- package/components/swipeout/swipeout.js +98 -23
- package/components/swipeout/swipeout.less +20 -44
- package/components/tabs/tabs.js +5 -0
- package/components/toast/toast-class.js +2 -2
- package/components/toast/toast-ios.less +2 -0
- package/components/toast/toast-rtl.css +1 -1
- package/components/toast/toast-vars.less +2 -4
- package/components/toast/toast.css +1 -1
- package/components/toast/toast.less +1 -1
- package/components/toolbar-new/tabbar-highlight.js +134 -0
- package/components/toolbar-new/toolbar-ios.less +193 -0
- package/components/toolbar-new/toolbar-md.less +152 -0
- package/components/toolbar-new/toolbar-vars.less +77 -0
- package/components/toolbar-new/toolbar.js +223 -0
- package/components/toolbar-new/toolbar.less +261 -0
- package/framework7-bundle-rtl.css +2606 -746
- package/framework7-bundle-rtl.min.css +12 -6
- package/framework7-bundle.css +2603 -743
- package/framework7-bundle.esm.js +11 -4
- package/framework7-bundle.js +4536 -1038
- package/framework7-bundle.js.map +1 -1
- package/framework7-bundle.less +6 -3
- package/framework7-bundle.min.css +12 -6
- package/framework7-bundle.min.js +4 -4
- package/framework7-bundle.min.js.map +1 -1
- package/framework7-lite-bundle.esm.js +11 -4
- package/framework7-lite.esm.js +11 -4
- package/framework7-lite.js +8 -1
- package/framework7-rtl.css +2212 -399
- package/framework7-rtl.min.css +11 -5
- package/framework7.css +2211 -398
- package/framework7.esm.js +11 -4
- package/framework7.js +8 -1
- package/framework7.less +6 -3
- package/framework7.min.css +11 -5
- package/package.json +1 -1
- package/shared/get-support.d.ts +0 -6
- package/shared/get-support.js +1 -20
- package/shared/material-color-utils.js +2153 -679
- package/shared/material-colors.js +97 -17
- package/shared/utils.js +18 -6
|
@@ -11,14 +11,11 @@ function clampInt(min, max, input) {
|
|
|
11
11
|
function clampDouble(min, max, input) {
|
|
12
12
|
return input < min ? min : input > max ? max : input;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function sanitizeDegreesInt(degrees) {
|
|
15
15
|
return (degrees %= 360) < 0 && (degrees += 360), degrees;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
function differenceDegrees(a, b) {
|
|
21
|
-
return 180 - Math.abs(Math.abs(a - b) - 180);
|
|
17
|
+
function sanitizeDegreesDouble(degrees) {
|
|
18
|
+
return (degrees %= 360) < 0 && (degrees += 360), degrees;
|
|
22
19
|
}
|
|
23
20
|
function matrixMultiply(row, matrix) {
|
|
24
21
|
return [row[0] * matrix[0][0] + row[1] * matrix[0][1] + row[2] * matrix[0][2], row[0] * matrix[1][0] + row[1] * matrix[1][1] + row[2] * matrix[1][2], row[0] * matrix[2][0] + row[1] * matrix[2][1] + row[2] * matrix[2][2]];
|
|
@@ -51,6 +48,20 @@ function argbFromXyz(x, y, z) {
|
|
|
51
48
|
function xyzFromArgb(argb) {
|
|
52
49
|
return matrixMultiply([linearized(redFromArgb(argb)), linearized(greenFromArgb(argb)), linearized(blueFromArgb(argb))], SRGB_TO_XYZ);
|
|
53
50
|
}
|
|
51
|
+
function labFromArgb(argb) {
|
|
52
|
+
const linearR = linearized(redFromArgb(argb)),
|
|
53
|
+
linearG = linearized(greenFromArgb(argb)),
|
|
54
|
+
linearB = linearized(blueFromArgb(argb)),
|
|
55
|
+
matrix = SRGB_TO_XYZ,
|
|
56
|
+
x = matrix[0][0] * linearR + matrix[0][1] * linearG + matrix[0][2] * linearB,
|
|
57
|
+
y = matrix[1][0] * linearR + matrix[1][1] * linearG + matrix[1][2] * linearB,
|
|
58
|
+
z = matrix[2][0] * linearR + matrix[2][1] * linearG + matrix[2][2] * linearB,
|
|
59
|
+
yNormalized = y / WHITE_POINT_D65[1],
|
|
60
|
+
zNormalized = z / WHITE_POINT_D65[2],
|
|
61
|
+
fx = labF(x / WHITE_POINT_D65[0]),
|
|
62
|
+
fy = labF(yNormalized);
|
|
63
|
+
return [116 * fy - 16, 500 * (fx - fy), 200 * (fy - labF(zNormalized))];
|
|
64
|
+
}
|
|
54
65
|
function argbFromLstar(lstar) {
|
|
55
66
|
const component = delinearized(yFromLstar(lstar));
|
|
56
67
|
return argbFromRgb(component, component, component);
|
|
@@ -166,8 +177,7 @@ class Cam16 {
|
|
|
166
177
|
b = (rA + gA - 2 * bA) / 9,
|
|
167
178
|
u = (20 * rA + 20 * gA + 21 * bA) / 20,
|
|
168
179
|
p2 = (40 * rA + 20 * gA + bA) / 20,
|
|
169
|
-
|
|
170
|
-
hue = atanDegrees < 0 ? atanDegrees + 360 : atanDegrees >= 360 ? atanDegrees - 360 : atanDegrees,
|
|
180
|
+
hue = sanitizeDegreesDouble(180 * Math.atan2(b, a) / Math.PI),
|
|
171
181
|
hueRadians = hue * Math.PI / 180,
|
|
172
182
|
ac = p2 * viewingConditions.nbb,
|
|
173
183
|
j = 100 * Math.pow(ac / viewingConditions.aw, viewingConditions.c * viewingConditions.z),
|
|
@@ -487,6 +497,21 @@ class Hct {
|
|
|
487
497
|
set tone(newTone) {
|
|
488
498
|
this.setInternalState(HctSolver.solveToInt(this.internalHue, this.internalChroma, newTone));
|
|
489
499
|
}
|
|
500
|
+
setValue(propertyName, value) {
|
|
501
|
+
this[propertyName] = value;
|
|
502
|
+
}
|
|
503
|
+
toString() {
|
|
504
|
+
return `HCT(${this.hue.toFixed(0)}, ${this.chroma.toFixed(0)}, ${this.tone.toFixed(0)})`;
|
|
505
|
+
}
|
|
506
|
+
static isBlue(hue) {
|
|
507
|
+
return hue >= 250 && hue < 270;
|
|
508
|
+
}
|
|
509
|
+
static isYellow(hue) {
|
|
510
|
+
return hue >= 105 && hue < 125;
|
|
511
|
+
}
|
|
512
|
+
static isCyan(hue) {
|
|
513
|
+
return hue >= 170 && hue < 207;
|
|
514
|
+
}
|
|
490
515
|
constructor(argb) {
|
|
491
516
|
this.argb = argb;
|
|
492
517
|
const cam = Cam16.fromInt(argb);
|
|
@@ -502,33 +527,6 @@ class Hct {
|
|
|
502
527
|
return Hct.from(recastInVc.hue, recastInVc.chroma, lstarFromY(viewedInVc[1]));
|
|
503
528
|
}
|
|
504
529
|
}
|
|
505
|
-
class Blend {
|
|
506
|
-
static harmonize(designColor, sourceColor) {
|
|
507
|
-
const fromHct = Hct.fromInt(designColor),
|
|
508
|
-
toHct = Hct.fromInt(sourceColor),
|
|
509
|
-
differenceDegrees$1 = differenceDegrees(fromHct.hue, toHct.hue),
|
|
510
|
-
rotationDegrees = Math.min(.5 * differenceDegrees$1, 15),
|
|
511
|
-
outputHue = sanitizeDegreesDouble(fromHct.hue + rotationDegrees * rotationDirection(fromHct.hue, toHct.hue));
|
|
512
|
-
return Hct.from(outputHue, fromHct.chroma, fromHct.tone).toInt();
|
|
513
|
-
}
|
|
514
|
-
static hctHue(from, to, amount) {
|
|
515
|
-
const ucs = Blend.cam16Ucs(from, to, amount),
|
|
516
|
-
ucsCam = Cam16.fromInt(ucs),
|
|
517
|
-
fromCam = Cam16.fromInt(from);
|
|
518
|
-
return Hct.from(ucsCam.hue, fromCam.chroma, lstarFromArgb(from)).toInt();
|
|
519
|
-
}
|
|
520
|
-
static cam16Ucs(from, to, amount) {
|
|
521
|
-
const fromCam = Cam16.fromInt(from),
|
|
522
|
-
toCam = Cam16.fromInt(to),
|
|
523
|
-
fromJ = fromCam.jstar,
|
|
524
|
-
fromA = fromCam.astar,
|
|
525
|
-
fromB = fromCam.bstar,
|
|
526
|
-
jstar = fromJ + (toCam.jstar - fromJ) * amount,
|
|
527
|
-
astar = fromA + (toCam.astar - fromA) * amount,
|
|
528
|
-
bstar = fromB + (toCam.bstar - fromB) * amount;
|
|
529
|
-
return Cam16.fromUcs(jstar, astar, bstar).toInt();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
530
|
class Contrast {
|
|
533
531
|
static ratioOfTones(toneA, toneB) {
|
|
534
532
|
return toneA = clampDouble(0, 100, toneA), toneB = clampDouble(0, 100, toneB), Contrast.ratioOfYs(yFromLstar(toneA), yFromLstar(toneB));
|
|
@@ -577,66 +575,77 @@ class DislikeAnalyzer {
|
|
|
577
575
|
return DislikeAnalyzer.isDisliked(hct) ? Hct.from(hct.hue, hct.chroma, 70) : hct;
|
|
578
576
|
}
|
|
579
577
|
}
|
|
578
|
+
function validateExtendedColor(originalColor, specVersion, extendedColor) {
|
|
579
|
+
if (originalColor.name !== extendedColor.name) throw new Error(`Attempting to extend color ${originalColor.name} with color ${extendedColor.name} of different name for spec version ${specVersion}.`);
|
|
580
|
+
if (originalColor.isBackground !== extendedColor.isBackground) throw new Error(`Attempting to extend color ${originalColor.name} as a ${originalColor.isBackground ? "background" : "foreground"} with color ${extendedColor.name} as a ${extendedColor.isBackground ? "background" : "foreground"} for spec version ${specVersion}.`);
|
|
581
|
+
}
|
|
582
|
+
function extendSpecVersion(originlColor, specVersion, extendedColor) {
|
|
583
|
+
return validateExtendedColor(originlColor, specVersion, extendedColor), DynamicColor.fromPalette({
|
|
584
|
+
name: originlColor.name,
|
|
585
|
+
palette: s => s.specVersion === specVersion ? extendedColor.palette(s) : originlColor.palette(s),
|
|
586
|
+
tone: s => s.specVersion === specVersion ? extendedColor.tone(s) : originlColor.tone(s),
|
|
587
|
+
isBackground: originlColor.isBackground,
|
|
588
|
+
chromaMultiplier: s => {
|
|
589
|
+
const chromaMultiplier = s.specVersion === specVersion ? extendedColor.chromaMultiplier : originlColor.chromaMultiplier;
|
|
590
|
+
return void 0 !== chromaMultiplier ? chromaMultiplier(s) : 1;
|
|
591
|
+
},
|
|
592
|
+
background: s => {
|
|
593
|
+
const background = s.specVersion === specVersion ? extendedColor.background : originlColor.background;
|
|
594
|
+
return void 0 !== background ? background(s) : void 0;
|
|
595
|
+
},
|
|
596
|
+
secondBackground: s => {
|
|
597
|
+
const secondBackground = s.specVersion === specVersion ? extendedColor.secondBackground : originlColor.secondBackground;
|
|
598
|
+
return void 0 !== secondBackground ? secondBackground(s) : void 0;
|
|
599
|
+
},
|
|
600
|
+
contrastCurve: s => {
|
|
601
|
+
const contrastCurve = s.specVersion === specVersion ? extendedColor.contrastCurve : originlColor.contrastCurve;
|
|
602
|
+
return void 0 !== contrastCurve ? contrastCurve(s) : void 0;
|
|
603
|
+
},
|
|
604
|
+
toneDeltaPair: s => {
|
|
605
|
+
const toneDeltaPair = s.specVersion === specVersion ? extendedColor.toneDeltaPair : originlColor.toneDeltaPair;
|
|
606
|
+
return void 0 !== toneDeltaPair ? toneDeltaPair(s) : void 0;
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
}
|
|
580
610
|
class DynamicColor {
|
|
581
611
|
static fromPalette(args) {
|
|
582
|
-
return new DynamicColor(args.name ?? "", args.palette, args.tone, args.isBackground ?? !1, args.background, args.secondBackground, args.contrastCurve, args.toneDeltaPair);
|
|
612
|
+
return new DynamicColor(args.name ?? "", args.palette, args.tone ?? DynamicColor.getInitialToneFromBackground(args.background), args.isBackground ?? !1, args.chromaMultiplier, args.background, args.secondBackground, args.contrastCurve, args.toneDeltaPair);
|
|
583
613
|
}
|
|
584
|
-
|
|
585
|
-
|
|
614
|
+
static getInitialToneFromBackground(background) {
|
|
615
|
+
return void 0 === background ? s => 50 : s => background(s) ? background(s).getTone(s) : 50;
|
|
616
|
+
}
|
|
617
|
+
constructor(name, palette, tone, isBackground, chromaMultiplier, background, secondBackground, contrastCurve, toneDeltaPair) {
|
|
618
|
+
if (this.name = name, this.palette = palette, this.tone = tone, this.isBackground = isBackground, this.chromaMultiplier = chromaMultiplier, this.background = background, this.secondBackground = secondBackground, this.contrastCurve = contrastCurve, this.toneDeltaPair = toneDeltaPair, this.hctCache = new Map(), !background && secondBackground) throw new Error(`Color ${name} has secondBackgrounddefined, but background is not defined.`);
|
|
586
619
|
if (!background && contrastCurve) throw new Error(`Color ${name} has contrastCurvedefined, but background is not defined.`);
|
|
587
620
|
if (background && !contrastCurve) throw new Error(`Color ${name} has backgrounddefined, but contrastCurve is not defined.`);
|
|
588
621
|
}
|
|
622
|
+
clone() {
|
|
623
|
+
return DynamicColor.fromPalette({
|
|
624
|
+
name: this.name,
|
|
625
|
+
palette: this.palette,
|
|
626
|
+
tone: this.tone,
|
|
627
|
+
isBackground: this.isBackground,
|
|
628
|
+
chromaMultiplier: this.chromaMultiplier,
|
|
629
|
+
background: this.background,
|
|
630
|
+
secondBackground: this.secondBackground,
|
|
631
|
+
contrastCurve: this.contrastCurve,
|
|
632
|
+
toneDeltaPair: this.toneDeltaPair
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
clearCache() {
|
|
636
|
+
this.hctCache.clear();
|
|
637
|
+
}
|
|
589
638
|
getArgb(scheme) {
|
|
590
639
|
return this.getHct(scheme).toInt();
|
|
591
640
|
}
|
|
592
641
|
getHct(scheme) {
|
|
593
642
|
const cachedAnswer = this.hctCache.get(scheme);
|
|
594
643
|
if (null != cachedAnswer) return cachedAnswer;
|
|
595
|
-
const
|
|
596
|
-
answer = this.palette(scheme).getHct(tone);
|
|
644
|
+
const answer = getSpec$1(scheme.specVersion).getHct(scheme, this);
|
|
597
645
|
return this.hctCache.size > 4 && this.hctCache.clear(), this.hctCache.set(scheme, answer), answer;
|
|
598
646
|
}
|
|
599
647
|
getTone(scheme) {
|
|
600
|
-
|
|
601
|
-
if (this.toneDeltaPair) {
|
|
602
|
-
const toneDeltaPair = this.toneDeltaPair(scheme),
|
|
603
|
-
roleA = toneDeltaPair.roleA,
|
|
604
|
-
roleB = toneDeltaPair.roleB,
|
|
605
|
-
delta = toneDeltaPair.delta,
|
|
606
|
-
polarity = toneDeltaPair.polarity,
|
|
607
|
-
stayTogether = toneDeltaPair.stayTogether,
|
|
608
|
-
bgTone = this.background(scheme).getTone(scheme),
|
|
609
|
-
aIsNearer = "nearer" === polarity || "lighter" === polarity && !scheme.isDark || "darker" === polarity && scheme.isDark,
|
|
610
|
-
nearer = aIsNearer ? roleA : roleB,
|
|
611
|
-
farther = aIsNearer ? roleB : roleA,
|
|
612
|
-
amNearer = this.name === nearer.name,
|
|
613
|
-
expansionDir = scheme.isDark ? 1 : -1,
|
|
614
|
-
nContrast = nearer.contrastCurve.getContrast(scheme.contrastLevel),
|
|
615
|
-
fContrast = farther.contrastCurve.getContrast(scheme.contrastLevel),
|
|
616
|
-
nInitialTone = nearer.tone(scheme);
|
|
617
|
-
let nTone = Contrast.ratioOfTones(bgTone, nInitialTone) >= nContrast ? nInitialTone : DynamicColor.foregroundTone(bgTone, nContrast);
|
|
618
|
-
const fInitialTone = farther.tone(scheme);
|
|
619
|
-
let fTone = Contrast.ratioOfTones(bgTone, fInitialTone) >= fContrast ? fInitialTone : DynamicColor.foregroundTone(bgTone, fContrast);
|
|
620
|
-
return decreasingContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast), fTone = DynamicColor.foregroundTone(bgTone, fContrast)), (fTone - nTone) * expansionDir >= delta || (fTone = clampDouble(0, 100, nTone + delta * expansionDir), (fTone - nTone) * expansionDir >= delta || (nTone = clampDouble(0, 100, fTone - delta * expansionDir))), 50 <= nTone && nTone < 60 ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : 50 <= fTone && fTone < 60 && (stayTogether ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : fTone = expansionDir > 0 ? 60 : 49), amNearer ? nTone : fTone;
|
|
621
|
-
}
|
|
622
|
-
{
|
|
623
|
-
let answer = this.tone(scheme);
|
|
624
|
-
if (null == this.background) return answer;
|
|
625
|
-
const bgTone = this.background(scheme).getTone(scheme),
|
|
626
|
-
desiredRatio = this.contrastCurve.getContrast(scheme.contrastLevel);
|
|
627
|
-
if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio || (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), decreasingContrast && (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), this.isBackground && 50 <= answer && answer < 60 && (answer = Contrast.ratioOfTones(49, bgTone) >= desiredRatio ? 49 : 60), this.secondBackground) {
|
|
628
|
-
const [bg1, bg2] = [this.background, this.secondBackground],
|
|
629
|
-
[bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
|
|
630
|
-
[upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
|
|
631
|
-
if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
|
|
632
|
-
const lightOption = Contrast.lighter(upper, desiredRatio),
|
|
633
|
-
darkOption = Contrast.darker(lower, desiredRatio),
|
|
634
|
-
availables = [];
|
|
635
|
-
-1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
|
|
636
|
-
return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
|
|
637
|
-
}
|
|
638
|
-
return answer;
|
|
639
|
-
}
|
|
648
|
+
return getSpec$1(scheme.specVersion).getTone(scheme, this);
|
|
640
649
|
}
|
|
641
650
|
static foregroundTone(bgTone, ratio) {
|
|
642
651
|
const lighterTone = Contrast.lighterUnsafe(bgTone, ratio),
|
|
@@ -659,23 +668,309 @@ class DynamicColor {
|
|
|
659
668
|
return DynamicColor.tonePrefersLightForeground(tone) && !DynamicColor.toneAllowsLightForeground(tone) ? 49 : tone;
|
|
660
669
|
}
|
|
661
670
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
671
|
+
class ColorCalculationDelegateImpl2021 {
|
|
672
|
+
getHct(scheme, color) {
|
|
673
|
+
const tone = color.getTone(scheme);
|
|
674
|
+
return color.palette(scheme).getHct(tone);
|
|
675
|
+
}
|
|
676
|
+
getTone(scheme, color) {
|
|
677
|
+
const decreasingContrast = scheme.contrastLevel < 0,
|
|
678
|
+
toneDeltaPair = color.toneDeltaPair ? color.toneDeltaPair(scheme) : void 0;
|
|
679
|
+
if (toneDeltaPair) {
|
|
680
|
+
const roleA = toneDeltaPair.roleA,
|
|
681
|
+
roleB = toneDeltaPair.roleB,
|
|
682
|
+
delta = toneDeltaPair.delta,
|
|
683
|
+
polarity = toneDeltaPair.polarity,
|
|
684
|
+
stayTogether = toneDeltaPair.stayTogether,
|
|
685
|
+
aIsNearer = "nearer" === polarity || "lighter" === polarity && !scheme.isDark || "darker" === polarity && scheme.isDark,
|
|
686
|
+
nearer = aIsNearer ? roleA : roleB,
|
|
687
|
+
farther = aIsNearer ? roleB : roleA,
|
|
688
|
+
amNearer = color.name === nearer.name,
|
|
689
|
+
expansionDir = scheme.isDark ? 1 : -1;
|
|
690
|
+
let nTone = nearer.tone(scheme),
|
|
691
|
+
fTone = farther.tone(scheme);
|
|
692
|
+
if (color.background && nearer.contrastCurve && farther.contrastCurve) {
|
|
693
|
+
const bg = color.background(scheme),
|
|
694
|
+
nContrastCurve = nearer.contrastCurve(scheme),
|
|
695
|
+
fContrastCurve = farther.contrastCurve(scheme);
|
|
696
|
+
if (bg && nContrastCurve && fContrastCurve) {
|
|
697
|
+
const bgTone = bg.getTone(scheme),
|
|
698
|
+
nContrast = nContrastCurve.get(scheme.contrastLevel),
|
|
699
|
+
fContrast = fContrastCurve.get(scheme.contrastLevel);
|
|
700
|
+
Contrast.ratioOfTones(bgTone, nTone) < nContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast)), Contrast.ratioOfTones(bgTone, fTone) < fContrast && (fTone = DynamicColor.foregroundTone(bgTone, fContrast)), decreasingContrast && (nTone = DynamicColor.foregroundTone(bgTone, nContrast), fTone = DynamicColor.foregroundTone(bgTone, fContrast));
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
return (fTone - nTone) * expansionDir < delta && (fTone = clampDouble(0, 100, nTone + delta * expansionDir), (fTone - nTone) * expansionDir >= delta || (nTone = clampDouble(0, 100, fTone - delta * expansionDir))), 50 <= nTone && nTone < 60 ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : 50 <= fTone && fTone < 60 && (stayTogether ? expansionDir > 0 ? (nTone = 60, fTone = Math.max(fTone, nTone + delta * expansionDir)) : (nTone = 49, fTone = Math.min(fTone, nTone + delta * expansionDir)) : fTone = expansionDir > 0 ? 60 : 49), amNearer ? nTone : fTone;
|
|
704
|
+
}
|
|
705
|
+
{
|
|
706
|
+
let answer = color.tone(scheme);
|
|
707
|
+
if (null == color.background || void 0 === color.background(scheme) || null == color.contrastCurve || void 0 === color.contrastCurve(scheme)) return answer;
|
|
708
|
+
const bgTone = color.background(scheme).getTone(scheme),
|
|
709
|
+
desiredRatio = color.contrastCurve(scheme).get(scheme.contrastLevel);
|
|
710
|
+
if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio || (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), decreasingContrast && (answer = DynamicColor.foregroundTone(bgTone, desiredRatio)), color.isBackground && 50 <= answer && answer < 60 && (answer = Contrast.ratioOfTones(49, bgTone) >= desiredRatio ? 49 : 60), null == color.secondBackground || void 0 === color.secondBackground(scheme)) return answer;
|
|
711
|
+
const [bg1, bg2] = [color.background, color.secondBackground],
|
|
712
|
+
[bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
|
|
713
|
+
[upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
|
|
714
|
+
if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
|
|
715
|
+
const lightOption = Contrast.lighter(upper, desiredRatio),
|
|
716
|
+
darkOption = Contrast.darker(lower, desiredRatio),
|
|
717
|
+
availables = [];
|
|
718
|
+
-1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
|
|
719
|
+
return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
class ColorCalculationDelegateImpl2025 {
|
|
724
|
+
getHct(scheme, color) {
|
|
725
|
+
const palette = color.palette(scheme),
|
|
726
|
+
tone = color.getTone(scheme),
|
|
727
|
+
hue = palette.hue,
|
|
728
|
+
chroma = palette.chroma * (color.chromaMultiplier ? color.chromaMultiplier(scheme) : 1);
|
|
729
|
+
return Hct.from(hue, chroma, tone);
|
|
730
|
+
}
|
|
731
|
+
getTone(scheme, color) {
|
|
732
|
+
const toneDeltaPair = color.toneDeltaPair ? color.toneDeltaPair(scheme) : void 0;
|
|
733
|
+
if (toneDeltaPair) {
|
|
734
|
+
const roleA = toneDeltaPair.roleA,
|
|
735
|
+
roleB = toneDeltaPair.roleB,
|
|
736
|
+
polarity = toneDeltaPair.polarity,
|
|
737
|
+
constraint = toneDeltaPair.constraint,
|
|
738
|
+
absoluteDelta = "darker" === polarity || "relative_lighter" === polarity && scheme.isDark || "relative_darker" === polarity && !scheme.isDark ? -toneDeltaPair.delta : toneDeltaPair.delta,
|
|
739
|
+
amRoleA = color.name === roleA.name,
|
|
740
|
+
refRole = amRoleA ? roleB : roleA;
|
|
741
|
+
let selfTone = (amRoleA ? roleA : roleB).tone(scheme),
|
|
742
|
+
refTone = refRole.getTone(scheme);
|
|
743
|
+
const relativeDelta = absoluteDelta * (amRoleA ? 1 : -1);
|
|
744
|
+
if ("exact" === constraint ? selfTone = clampDouble(0, 100, refTone + relativeDelta) : "nearer" === constraint ? selfTone = clampDouble(0, 100, relativeDelta > 0 ? clampDouble(refTone, refTone + relativeDelta, selfTone) : clampDouble(refTone + relativeDelta, refTone, selfTone)) : "farther" === constraint && (selfTone = relativeDelta > 0 ? clampDouble(refTone + relativeDelta, 100, selfTone) : clampDouble(0, refTone + relativeDelta, selfTone)), color.background && color.contrastCurve) {
|
|
745
|
+
const background = color.background(scheme),
|
|
746
|
+
contrastCurve = color.contrastCurve(scheme);
|
|
747
|
+
if (background && contrastCurve) {
|
|
748
|
+
const bgTone = background.getTone(scheme),
|
|
749
|
+
selfContrast = contrastCurve.get(scheme.contrastLevel);
|
|
750
|
+
selfTone = Contrast.ratioOfTones(bgTone, selfTone) >= selfContrast && scheme.contrastLevel >= 0 ? selfTone : DynamicColor.foregroundTone(bgTone, selfContrast);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
return color.isBackground && !color.name.endsWith("_fixed_dim") && (selfTone = selfTone >= 57 ? clampDouble(65, 100, selfTone) : clampDouble(0, 49, selfTone)), selfTone;
|
|
754
|
+
}
|
|
755
|
+
{
|
|
756
|
+
let answer = color.tone(scheme);
|
|
757
|
+
if (null == color.background || void 0 === color.background(scheme) || null == color.contrastCurve || void 0 === color.contrastCurve(scheme)) return answer;
|
|
758
|
+
const bgTone = color.background(scheme).getTone(scheme),
|
|
759
|
+
desiredRatio = color.contrastCurve(scheme).get(scheme.contrastLevel);
|
|
760
|
+
if (answer = Contrast.ratioOfTones(bgTone, answer) >= desiredRatio && scheme.contrastLevel >= 0 ? answer : DynamicColor.foregroundTone(bgTone, desiredRatio), color.isBackground && !color.name.endsWith("_fixed_dim") && (answer = answer >= 57 ? clampDouble(65, 100, answer) : clampDouble(0, 49, answer)), null == color.secondBackground || void 0 === color.secondBackground(scheme)) return answer;
|
|
761
|
+
const [bg1, bg2] = [color.background, color.secondBackground],
|
|
762
|
+
[bgTone1, bgTone2] = [bg1(scheme).getTone(scheme), bg2(scheme).getTone(scheme)],
|
|
763
|
+
[upper, lower] = [Math.max(bgTone1, bgTone2), Math.min(bgTone1, bgTone2)];
|
|
764
|
+
if (Contrast.ratioOfTones(upper, answer) >= desiredRatio && Contrast.ratioOfTones(lower, answer) >= desiredRatio) return answer;
|
|
765
|
+
const lightOption = Contrast.lighter(upper, desiredRatio),
|
|
766
|
+
darkOption = Contrast.darker(lower, desiredRatio),
|
|
767
|
+
availables = [];
|
|
768
|
+
-1 !== lightOption && availables.push(lightOption), -1 !== darkOption && availables.push(darkOption);
|
|
769
|
+
return DynamicColor.tonePrefersLightForeground(bgTone1) || DynamicColor.tonePrefersLightForeground(bgTone2) ? lightOption < 0 ? 100 : lightOption : 1 === availables.length ? availables[0] : darkOption < 0 ? 0 : darkOption;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
const spec2021$1 = new ColorCalculationDelegateImpl2021(),
|
|
774
|
+
spec2025$1 = new ColorCalculationDelegateImpl2025();
|
|
775
|
+
function getSpec$1(specVersion) {
|
|
776
|
+
return "2025" === specVersion ? spec2025$1 : spec2021$1;
|
|
777
|
+
}
|
|
778
|
+
class TonalPalette {
|
|
779
|
+
static fromInt(argb) {
|
|
780
|
+
const hct = Hct.fromInt(argb);
|
|
781
|
+
return TonalPalette.fromHct(hct);
|
|
782
|
+
}
|
|
783
|
+
static fromHct(hct) {
|
|
784
|
+
return new TonalPalette(hct.hue, hct.chroma, hct);
|
|
785
|
+
}
|
|
786
|
+
static fromHueAndChroma(hue, chroma) {
|
|
787
|
+
const keyColor = new KeyColor(hue, chroma).create();
|
|
788
|
+
return new TonalPalette(hue, chroma, keyColor);
|
|
789
|
+
}
|
|
790
|
+
constructor(hue, chroma, keyColor) {
|
|
791
|
+
this.hue = hue, this.chroma = chroma, this.keyColor = keyColor, this.cache = new Map();
|
|
792
|
+
}
|
|
793
|
+
tone(tone) {
|
|
794
|
+
let argb = this.cache.get(tone);
|
|
795
|
+
return void 0 === argb && (argb = 99 == tone && Hct.isYellow(this.hue) ? this.averageArgb(this.tone(98), this.tone(100)) : Hct.from(this.hue, this.chroma, tone).toInt(), this.cache.set(tone, argb)), argb;
|
|
796
|
+
}
|
|
797
|
+
getHct(tone) {
|
|
798
|
+
return Hct.fromInt(this.tone(tone));
|
|
799
|
+
}
|
|
800
|
+
averageArgb(argb1, argb2) {
|
|
801
|
+
const red1 = argb1 >>> 16 & 255,
|
|
802
|
+
green1 = argb1 >>> 8 & 255,
|
|
803
|
+
blue1 = 255 & argb1,
|
|
804
|
+
red2 = argb2 >>> 16 & 255,
|
|
805
|
+
green2 = argb2 >>> 8 & 255,
|
|
806
|
+
blue2 = 255 & argb2;
|
|
807
|
+
return (255 << 24 | (255 & Math.round((red1 + red2) / 2)) << 16 | (255 & Math.round((green1 + green2) / 2)) << 8 | 255 & Math.round((blue1 + blue2) / 2)) >>> 0;
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
class KeyColor {
|
|
811
|
+
constructor(hue, requestedChroma) {
|
|
812
|
+
this.hue = hue, this.requestedChroma = requestedChroma, this.chromaCache = new Map(), this.maxChromaValue = 200;
|
|
813
|
+
}
|
|
814
|
+
create() {
|
|
815
|
+
let lowerTone = 0,
|
|
816
|
+
upperTone = 100;
|
|
817
|
+
for (; lowerTone < upperTone;) {
|
|
818
|
+
const midTone = Math.floor((lowerTone + upperTone) / 2),
|
|
819
|
+
isAscending = this.maxChroma(midTone) < this.maxChroma(midTone + 1);
|
|
820
|
+
if (this.maxChroma(midTone) >= this.requestedChroma - .01) {
|
|
821
|
+
if (Math.abs(lowerTone - 50) < Math.abs(upperTone - 50)) upperTone = midTone;else {
|
|
822
|
+
if (lowerTone === midTone) return Hct.from(this.hue, this.requestedChroma, lowerTone);
|
|
823
|
+
lowerTone = midTone;
|
|
824
|
+
}
|
|
825
|
+
} else isAscending ? lowerTone = midTone + 1 : upperTone = midTone;
|
|
826
|
+
}
|
|
827
|
+
return Hct.from(this.hue, this.requestedChroma, lowerTone);
|
|
828
|
+
}
|
|
829
|
+
maxChroma(tone) {
|
|
830
|
+
if (this.chromaCache.has(tone)) return this.chromaCache.get(tone);
|
|
831
|
+
const chroma = Hct.from(this.hue, this.maxChromaValue, tone).chroma;
|
|
832
|
+
return this.chromaCache.set(tone, chroma), chroma;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
class TemperatureCache {
|
|
836
|
+
constructor(input) {
|
|
837
|
+
this.input = input, this.hctsByTempCache = [], this.hctsByHueCache = [], this.tempsByHctCache = new Map(), this.inputRelativeTemperatureCache = -1, this.complementCache = null;
|
|
838
|
+
}
|
|
839
|
+
get hctsByTemp() {
|
|
840
|
+
if (this.hctsByTempCache.length > 0) return this.hctsByTempCache;
|
|
841
|
+
const hcts = this.hctsByHue.concat([this.input]),
|
|
842
|
+
temperaturesByHct = this.tempsByHct;
|
|
843
|
+
return hcts.sort((a, b) => temperaturesByHct.get(a) - temperaturesByHct.get(b)), this.hctsByTempCache = hcts, hcts;
|
|
844
|
+
}
|
|
845
|
+
get warmest() {
|
|
846
|
+
return this.hctsByTemp[this.hctsByTemp.length - 1];
|
|
847
|
+
}
|
|
848
|
+
get coldest() {
|
|
849
|
+
return this.hctsByTemp[0];
|
|
850
|
+
}
|
|
851
|
+
analogous(count, divisions) {
|
|
852
|
+
if (count === void 0) {
|
|
853
|
+
count = 5;
|
|
854
|
+
}
|
|
855
|
+
if (divisions === void 0) {
|
|
856
|
+
divisions = 12;
|
|
857
|
+
}
|
|
858
|
+
const startHue = Math.round(this.input.hue),
|
|
859
|
+
startHct = this.hctsByHue[startHue];
|
|
860
|
+
let lastTemp = this.relativeTemperature(startHct);
|
|
861
|
+
const allColors = [startHct];
|
|
862
|
+
let absoluteTotalTempDelta = 0;
|
|
863
|
+
for (let i = 0; i < 360; i++) {
|
|
864
|
+
const hue = sanitizeDegreesInt(startHue + i),
|
|
865
|
+
hct = this.hctsByHue[hue],
|
|
866
|
+
temp = this.relativeTemperature(hct),
|
|
867
|
+
tempDelta = Math.abs(temp - lastTemp);
|
|
868
|
+
lastTemp = temp, absoluteTotalTempDelta += tempDelta;
|
|
869
|
+
}
|
|
870
|
+
let hueAddend = 1;
|
|
871
|
+
const tempStep = absoluteTotalTempDelta / divisions;
|
|
872
|
+
let totalTempDelta = 0;
|
|
873
|
+
for (lastTemp = this.relativeTemperature(startHct); allColors.length < divisions;) {
|
|
874
|
+
const hue = sanitizeDegreesInt(startHue + hueAddend),
|
|
875
|
+
hct = this.hctsByHue[hue],
|
|
876
|
+
temp = this.relativeTemperature(hct);
|
|
877
|
+
totalTempDelta += Math.abs(temp - lastTemp);
|
|
878
|
+
let indexSatisfied = totalTempDelta >= allColors.length * tempStep,
|
|
879
|
+
indexAddend = 1;
|
|
880
|
+
for (; indexSatisfied && allColors.length < divisions;) {
|
|
881
|
+
allColors.push(hct);
|
|
882
|
+
indexSatisfied = totalTempDelta >= (allColors.length + indexAddend) * tempStep, indexAddend++;
|
|
883
|
+
}
|
|
884
|
+
if (lastTemp = temp, hueAddend++, hueAddend > 360) {
|
|
885
|
+
for (; allColors.length < divisions;) allColors.push(hct);
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
const answers = [this.input],
|
|
890
|
+
increaseHueCount = Math.floor((count - 1) / 2);
|
|
891
|
+
for (let i = 1; i < increaseHueCount + 1; i++) {
|
|
892
|
+
let index = 0 - i;
|
|
893
|
+
for (; index < 0;) index = allColors.length + index;
|
|
894
|
+
index >= allColors.length && (index %= allColors.length), answers.splice(0, 0, allColors[index]);
|
|
895
|
+
}
|
|
896
|
+
const decreaseHueCount = count - increaseHueCount - 1;
|
|
897
|
+
for (let i = 1; i < decreaseHueCount + 1; i++) {
|
|
898
|
+
let index = i;
|
|
899
|
+
for (; index < 0;) index = allColors.length + index;
|
|
900
|
+
index >= allColors.length && (index %= allColors.length), answers.push(allColors[index]);
|
|
901
|
+
}
|
|
902
|
+
return answers;
|
|
903
|
+
}
|
|
904
|
+
get complement() {
|
|
905
|
+
if (null != this.complementCache) return this.complementCache;
|
|
906
|
+
const coldestHue = this.coldest.hue,
|
|
907
|
+
coldestTemp = this.tempsByHct.get(this.coldest),
|
|
908
|
+
warmestHue = this.warmest.hue,
|
|
909
|
+
range = this.tempsByHct.get(this.warmest) - coldestTemp,
|
|
910
|
+
startHueIsColdestToWarmest = TemperatureCache.isBetween(this.input.hue, coldestHue, warmestHue),
|
|
911
|
+
startHue = startHueIsColdestToWarmest ? warmestHue : coldestHue,
|
|
912
|
+
endHue = startHueIsColdestToWarmest ? coldestHue : warmestHue;
|
|
913
|
+
let smallestError = 1e3,
|
|
914
|
+
answer = this.hctsByHue[Math.round(this.input.hue)];
|
|
915
|
+
const complementRelativeTemp = 1 - this.inputRelativeTemperature;
|
|
916
|
+
for (let hueAddend = 0; hueAddend <= 360; hueAddend += 1) {
|
|
917
|
+
const hue = sanitizeDegreesDouble(startHue + 1 * hueAddend);
|
|
918
|
+
if (!TemperatureCache.isBetween(hue, startHue, endHue)) continue;
|
|
919
|
+
const possibleAnswer = this.hctsByHue[Math.round(hue)],
|
|
920
|
+
relativeTemp = (this.tempsByHct.get(possibleAnswer) - coldestTemp) / range,
|
|
921
|
+
error = Math.abs(complementRelativeTemp - relativeTemp);
|
|
922
|
+
error < smallestError && (smallestError = error, answer = possibleAnswer);
|
|
923
|
+
}
|
|
924
|
+
return this.complementCache = answer, this.complementCache;
|
|
925
|
+
}
|
|
926
|
+
relativeTemperature(hct) {
|
|
927
|
+
const range = this.tempsByHct.get(this.warmest) - this.tempsByHct.get(this.coldest),
|
|
928
|
+
differenceFromColdest = this.tempsByHct.get(hct) - this.tempsByHct.get(this.coldest);
|
|
929
|
+
return 0 === range ? .5 : differenceFromColdest / range;
|
|
930
|
+
}
|
|
931
|
+
get inputRelativeTemperature() {
|
|
932
|
+
return this.inputRelativeTemperatureCache >= 0 || (this.inputRelativeTemperatureCache = this.relativeTemperature(this.input)), this.inputRelativeTemperatureCache;
|
|
933
|
+
}
|
|
934
|
+
get tempsByHct() {
|
|
935
|
+
if (this.tempsByHctCache.size > 0) return this.tempsByHctCache;
|
|
936
|
+
const allHcts = this.hctsByHue.concat([this.input]),
|
|
937
|
+
temperaturesByHct = new Map();
|
|
938
|
+
for (const e of allHcts) temperaturesByHct.set(e, TemperatureCache.rawTemperature(e));
|
|
939
|
+
return this.tempsByHctCache = temperaturesByHct, temperaturesByHct;
|
|
940
|
+
}
|
|
941
|
+
get hctsByHue() {
|
|
942
|
+
if (this.hctsByHueCache.length > 0) return this.hctsByHueCache;
|
|
943
|
+
const hcts = [];
|
|
944
|
+
for (let hue = 0; hue <= 360; hue += 1) {
|
|
945
|
+
const colorAtHue = Hct.from(hue, this.input.chroma, this.input.tone);
|
|
946
|
+
hcts.push(colorAtHue);
|
|
947
|
+
}
|
|
948
|
+
return this.hctsByHueCache = hcts, this.hctsByHueCache;
|
|
949
|
+
}
|
|
950
|
+
static isBetween(angle, a, b) {
|
|
951
|
+
return a < b ? a <= angle && angle <= b : a <= angle || angle <= b;
|
|
952
|
+
}
|
|
953
|
+
static rawTemperature(color) {
|
|
954
|
+
const lab = labFromArgb(color.toInt()),
|
|
955
|
+
hue = sanitizeDegreesDouble(180 * Math.atan2(lab[2], lab[1]) / Math.PI),
|
|
956
|
+
chroma = Math.sqrt(lab[1] * lab[1] + lab[2] * lab[2]);
|
|
957
|
+
return .02 * Math.pow(chroma, 1.07) * Math.cos(sanitizeDegreesDouble(hue - 50) * Math.PI / 180) - .5;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
666
960
|
class ContrastCurve {
|
|
667
961
|
constructor(low, normal, medium, high) {
|
|
668
962
|
this.low = low, this.normal = normal, this.medium = medium, this.high = high;
|
|
669
963
|
}
|
|
670
|
-
|
|
964
|
+
get(contrastLevel) {
|
|
671
965
|
return contrastLevel <= -1 ? this.low : contrastLevel < 0 ? lerp(this.low, this.normal, (contrastLevel - -1) / 1) : contrastLevel < .5 ? lerp(this.normal, this.medium, (contrastLevel - 0) / .5) : contrastLevel < 1 ? lerp(this.medium, this.high, (contrastLevel - .5) / .5) : this.high;
|
|
672
966
|
}
|
|
673
967
|
}
|
|
674
968
|
class ToneDeltaPair {
|
|
675
|
-
constructor(roleA, roleB, delta, polarity, stayTogether) {
|
|
676
|
-
this.roleA = roleA, this.roleB = roleB, this.delta = delta, this.polarity = polarity, this.stayTogether = stayTogether;
|
|
969
|
+
constructor(roleA, roleB, delta, polarity, stayTogether, constraint) {
|
|
970
|
+
this.roleA = roleA, this.roleB = roleB, this.delta = delta, this.polarity = polarity, this.stayTogether = stayTogether, this.constraint = constraint, this.constraint = constraint ?? "exact";
|
|
677
971
|
}
|
|
678
972
|
}
|
|
973
|
+
var Variant;
|
|
679
974
|
function isFidelity(scheme) {
|
|
680
975
|
return scheme.variant === Variant.FIDELITY || scheme.variant === Variant.CONTENT;
|
|
681
976
|
}
|
|
@@ -697,615 +992,1839 @@ function findDesiredChromaByTone(hue, chroma, tone, byDecreasingTone) {
|
|
|
697
992
|
}
|
|
698
993
|
return answer;
|
|
699
994
|
}
|
|
700
|
-
function
|
|
701
|
-
|
|
995
|
+
!function (Variant) {
|
|
996
|
+
Variant[Variant.MONOCHROME = 0] = "MONOCHROME", Variant[Variant.NEUTRAL = 1] = "NEUTRAL", Variant[Variant.TONAL_SPOT = 2] = "TONAL_SPOT", Variant[Variant.VIBRANT = 3] = "VIBRANT", Variant[Variant.EXPRESSIVE = 4] = "EXPRESSIVE", Variant[Variant.FIDELITY = 5] = "FIDELITY", Variant[Variant.CONTENT = 6] = "CONTENT", Variant[Variant.RAINBOW = 7] = "RAINBOW", Variant[Variant.FRUIT_SALAD = 8] = "FRUIT_SALAD";
|
|
997
|
+
}(Variant || (Variant = {}));
|
|
998
|
+
class ColorSpecDelegateImpl2021 {
|
|
999
|
+
primaryPaletteKeyColor() {
|
|
1000
|
+
return DynamicColor.fromPalette({
|
|
1001
|
+
name: "primary_palette_key_color",
|
|
1002
|
+
palette: s => s.primaryPalette,
|
|
1003
|
+
tone: s => s.primaryPalette.keyColor.tone
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1006
|
+
secondaryPaletteKeyColor() {
|
|
1007
|
+
return DynamicColor.fromPalette({
|
|
1008
|
+
name: "secondary_palette_key_color",
|
|
1009
|
+
palette: s => s.secondaryPalette,
|
|
1010
|
+
tone: s => s.secondaryPalette.keyColor.tone
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
tertiaryPaletteKeyColor() {
|
|
1014
|
+
return DynamicColor.fromPalette({
|
|
1015
|
+
name: "tertiary_palette_key_color",
|
|
1016
|
+
palette: s => s.tertiaryPalette,
|
|
1017
|
+
tone: s => s.tertiaryPalette.keyColor.tone
|
|
1018
|
+
});
|
|
1019
|
+
}
|
|
1020
|
+
neutralPaletteKeyColor() {
|
|
1021
|
+
return DynamicColor.fromPalette({
|
|
1022
|
+
name: "neutral_palette_key_color",
|
|
1023
|
+
palette: s => s.neutralPalette,
|
|
1024
|
+
tone: s => s.neutralPalette.keyColor.tone
|
|
1025
|
+
});
|
|
1026
|
+
}
|
|
1027
|
+
neutralVariantPaletteKeyColor() {
|
|
1028
|
+
return DynamicColor.fromPalette({
|
|
1029
|
+
name: "neutral_variant_palette_key_color",
|
|
1030
|
+
palette: s => s.neutralVariantPalette,
|
|
1031
|
+
tone: s => s.neutralVariantPalette.keyColor.tone
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
errorPaletteKeyColor() {
|
|
1035
|
+
return DynamicColor.fromPalette({
|
|
1036
|
+
name: "error_palette_key_color",
|
|
1037
|
+
palette: s => s.errorPalette,
|
|
1038
|
+
tone: s => s.errorPalette.keyColor.tone
|
|
1039
|
+
});
|
|
1040
|
+
}
|
|
1041
|
+
background() {
|
|
1042
|
+
return DynamicColor.fromPalette({
|
|
1043
|
+
name: "background",
|
|
1044
|
+
palette: s => s.neutralPalette,
|
|
1045
|
+
tone: s => s.isDark ? 6 : 98,
|
|
1046
|
+
isBackground: !0
|
|
1047
|
+
});
|
|
1048
|
+
}
|
|
1049
|
+
onBackground() {
|
|
1050
|
+
return DynamicColor.fromPalette({
|
|
1051
|
+
name: "on_background",
|
|
1052
|
+
palette: s => s.neutralPalette,
|
|
1053
|
+
tone: s => s.isDark ? 90 : 10,
|
|
1054
|
+
background: s => this.background(),
|
|
1055
|
+
contrastCurve: s => new ContrastCurve(3, 3, 4.5, 7)
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
surface() {
|
|
1059
|
+
return DynamicColor.fromPalette({
|
|
1060
|
+
name: "surface",
|
|
1061
|
+
palette: s => s.neutralPalette,
|
|
1062
|
+
tone: s => s.isDark ? 6 : 98,
|
|
1063
|
+
isBackground: !0
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
surfaceDim() {
|
|
1067
|
+
return DynamicColor.fromPalette({
|
|
1068
|
+
name: "surface_dim",
|
|
1069
|
+
palette: s => s.neutralPalette,
|
|
1070
|
+
tone: s => s.isDark ? 6 : new ContrastCurve(87, 87, 80, 75).get(s.contrastLevel),
|
|
1071
|
+
isBackground: !0
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
surfaceBright() {
|
|
1075
|
+
return DynamicColor.fromPalette({
|
|
1076
|
+
name: "surface_bright",
|
|
1077
|
+
palette: s => s.neutralPalette,
|
|
1078
|
+
tone: s => s.isDark ? new ContrastCurve(24, 24, 29, 34).get(s.contrastLevel) : 98,
|
|
1079
|
+
isBackground: !0
|
|
1080
|
+
});
|
|
1081
|
+
}
|
|
1082
|
+
surfaceContainerLowest() {
|
|
1083
|
+
return DynamicColor.fromPalette({
|
|
1084
|
+
name: "surface_container_lowest",
|
|
1085
|
+
palette: s => s.neutralPalette,
|
|
1086
|
+
tone: s => s.isDark ? new ContrastCurve(4, 4, 2, 0).get(s.contrastLevel) : 100,
|
|
1087
|
+
isBackground: !0
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
surfaceContainerLow() {
|
|
1091
|
+
return DynamicColor.fromPalette({
|
|
1092
|
+
name: "surface_container_low",
|
|
1093
|
+
palette: s => s.neutralPalette,
|
|
1094
|
+
tone: s => s.isDark ? new ContrastCurve(10, 10, 11, 12).get(s.contrastLevel) : new ContrastCurve(96, 96, 96, 95).get(s.contrastLevel),
|
|
1095
|
+
isBackground: !0
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
surfaceContainer() {
|
|
1099
|
+
return DynamicColor.fromPalette({
|
|
1100
|
+
name: "surface_container",
|
|
1101
|
+
palette: s => s.neutralPalette,
|
|
1102
|
+
tone: s => s.isDark ? new ContrastCurve(12, 12, 16, 20).get(s.contrastLevel) : new ContrastCurve(94, 94, 92, 90).get(s.contrastLevel),
|
|
1103
|
+
isBackground: !0
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
surfaceContainerHigh() {
|
|
1107
|
+
return DynamicColor.fromPalette({
|
|
1108
|
+
name: "surface_container_high",
|
|
1109
|
+
palette: s => s.neutralPalette,
|
|
1110
|
+
tone: s => s.isDark ? new ContrastCurve(17, 17, 21, 25).get(s.contrastLevel) : new ContrastCurve(92, 92, 88, 85).get(s.contrastLevel),
|
|
1111
|
+
isBackground: !0
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
surfaceContainerHighest() {
|
|
1115
|
+
return DynamicColor.fromPalette({
|
|
1116
|
+
name: "surface_container_highest",
|
|
1117
|
+
palette: s => s.neutralPalette,
|
|
1118
|
+
tone: s => s.isDark ? new ContrastCurve(22, 22, 26, 30).get(s.contrastLevel) : new ContrastCurve(90, 90, 84, 80).get(s.contrastLevel),
|
|
1119
|
+
isBackground: !0
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
onSurface() {
|
|
1123
|
+
return DynamicColor.fromPalette({
|
|
1124
|
+
name: "on_surface",
|
|
1125
|
+
palette: s => s.neutralPalette,
|
|
1126
|
+
tone: s => s.isDark ? 90 : 10,
|
|
1127
|
+
background: s => this.highestSurface(s),
|
|
1128
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
surfaceVariant() {
|
|
1132
|
+
return DynamicColor.fromPalette({
|
|
1133
|
+
name: "surface_variant",
|
|
1134
|
+
palette: s => s.neutralVariantPalette,
|
|
1135
|
+
tone: s => s.isDark ? 30 : 90,
|
|
1136
|
+
isBackground: !0
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
onSurfaceVariant() {
|
|
1140
|
+
return DynamicColor.fromPalette({
|
|
1141
|
+
name: "on_surface_variant",
|
|
1142
|
+
palette: s => s.neutralVariantPalette,
|
|
1143
|
+
tone: s => s.isDark ? 80 : 30,
|
|
1144
|
+
background: s => this.highestSurface(s),
|
|
1145
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
inverseSurface() {
|
|
1149
|
+
return DynamicColor.fromPalette({
|
|
1150
|
+
name: "inverse_surface",
|
|
1151
|
+
palette: s => s.neutralPalette,
|
|
1152
|
+
tone: s => s.isDark ? 90 : 20,
|
|
1153
|
+
isBackground: !0
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
inverseOnSurface() {
|
|
1157
|
+
return DynamicColor.fromPalette({
|
|
1158
|
+
name: "inverse_on_surface",
|
|
1159
|
+
palette: s => s.neutralPalette,
|
|
1160
|
+
tone: s => s.isDark ? 20 : 95,
|
|
1161
|
+
background: s => this.inverseSurface(),
|
|
1162
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
outline() {
|
|
1166
|
+
return DynamicColor.fromPalette({
|
|
1167
|
+
name: "outline",
|
|
1168
|
+
palette: s => s.neutralVariantPalette,
|
|
1169
|
+
tone: s => s.isDark ? 60 : 50,
|
|
1170
|
+
background: s => this.highestSurface(s),
|
|
1171
|
+
contrastCurve: s => new ContrastCurve(1.5, 3, 4.5, 7)
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
outlineVariant() {
|
|
1175
|
+
return DynamicColor.fromPalette({
|
|
1176
|
+
name: "outline_variant",
|
|
1177
|
+
palette: s => s.neutralVariantPalette,
|
|
1178
|
+
tone: s => s.isDark ? 30 : 80,
|
|
1179
|
+
background: s => this.highestSurface(s),
|
|
1180
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5)
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
shadow() {
|
|
1184
|
+
return DynamicColor.fromPalette({
|
|
1185
|
+
name: "shadow",
|
|
1186
|
+
palette: s => s.neutralPalette,
|
|
1187
|
+
tone: s => 0
|
|
1188
|
+
});
|
|
1189
|
+
}
|
|
1190
|
+
scrim() {
|
|
1191
|
+
return DynamicColor.fromPalette({
|
|
1192
|
+
name: "scrim",
|
|
1193
|
+
palette: s => s.neutralPalette,
|
|
1194
|
+
tone: s => 0
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
surfaceTint() {
|
|
1198
|
+
return DynamicColor.fromPalette({
|
|
1199
|
+
name: "surface_tint",
|
|
1200
|
+
palette: s => s.primaryPalette,
|
|
1201
|
+
tone: s => s.isDark ? 80 : 40,
|
|
1202
|
+
isBackground: !0
|
|
1203
|
+
});
|
|
1204
|
+
}
|
|
1205
|
+
primary() {
|
|
1206
|
+
return DynamicColor.fromPalette({
|
|
1207
|
+
name: "primary",
|
|
1208
|
+
palette: s => s.primaryPalette,
|
|
1209
|
+
tone: s => isMonochrome(s) ? s.isDark ? 100 : 0 : s.isDark ? 80 : 40,
|
|
1210
|
+
isBackground: !0,
|
|
1211
|
+
background: s => this.highestSurface(s),
|
|
1212
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
|
|
1213
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryContainer(), this.primary(), 10, "nearer", !1)
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
primaryDim() {}
|
|
1217
|
+
onPrimary() {
|
|
1218
|
+
return DynamicColor.fromPalette({
|
|
1219
|
+
name: "on_primary",
|
|
1220
|
+
palette: s => s.primaryPalette,
|
|
1221
|
+
tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
|
|
1222
|
+
background: s => this.primary(),
|
|
1223
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
primaryContainer() {
|
|
1227
|
+
return DynamicColor.fromPalette({
|
|
1228
|
+
name: "primary_container",
|
|
1229
|
+
palette: s => s.primaryPalette,
|
|
1230
|
+
tone: s => isFidelity(s) ? s.sourceColorHct.tone : isMonochrome(s) ? s.isDark ? 85 : 25 : s.isDark ? 30 : 90,
|
|
1231
|
+
isBackground: !0,
|
|
1232
|
+
background: s => this.highestSurface(s),
|
|
1233
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1234
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryContainer(), this.primary(), 10, "nearer", !1)
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
onPrimaryContainer() {
|
|
1238
|
+
return DynamicColor.fromPalette({
|
|
1239
|
+
name: "on_primary_container",
|
|
1240
|
+
palette: s => s.primaryPalette,
|
|
1241
|
+
tone: s => isFidelity(s) ? DynamicColor.foregroundTone(this.primaryContainer().tone(s), 4.5) : isMonochrome(s) ? s.isDark ? 0 : 100 : s.isDark ? 90 : 30,
|
|
1242
|
+
background: s => this.primaryContainer(),
|
|
1243
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
inversePrimary() {
|
|
1247
|
+
return DynamicColor.fromPalette({
|
|
1248
|
+
name: "inverse_primary",
|
|
1249
|
+
palette: s => s.primaryPalette,
|
|
1250
|
+
tone: s => s.isDark ? 40 : 80,
|
|
1251
|
+
background: s => this.inverseSurface(),
|
|
1252
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7)
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
secondary() {
|
|
1256
|
+
return DynamicColor.fromPalette({
|
|
1257
|
+
name: "secondary",
|
|
1258
|
+
palette: s => s.secondaryPalette,
|
|
1259
|
+
tone: s => s.isDark ? 80 : 40,
|
|
1260
|
+
isBackground: !0,
|
|
1261
|
+
background: s => this.highestSurface(s),
|
|
1262
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
|
|
1263
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
secondaryDim() {}
|
|
1267
|
+
onSecondary() {
|
|
1268
|
+
return DynamicColor.fromPalette({
|
|
1269
|
+
name: "on_secondary",
|
|
1270
|
+
palette: s => s.secondaryPalette,
|
|
1271
|
+
tone: s => isMonochrome(s) ? s.isDark ? 10 : 100 : s.isDark ? 20 : 100,
|
|
1272
|
+
background: s => this.secondary(),
|
|
1273
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1274
|
+
});
|
|
1275
|
+
}
|
|
1276
|
+
secondaryContainer() {
|
|
1277
|
+
return DynamicColor.fromPalette({
|
|
1278
|
+
name: "secondary_container",
|
|
1279
|
+
palette: s => s.secondaryPalette,
|
|
1280
|
+
tone: s => {
|
|
1281
|
+
const initialTone = s.isDark ? 30 : 90;
|
|
1282
|
+
return isMonochrome(s) ? s.isDark ? 30 : 85 : isFidelity(s) ? findDesiredChromaByTone(s.secondaryPalette.hue, s.secondaryPalette.chroma, initialTone, !s.isDark) : initialTone;
|
|
1283
|
+
},
|
|
1284
|
+
isBackground: !0,
|
|
1285
|
+
background: s => this.highestSurface(s),
|
|
1286
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1287
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 10, "nearer", !1)
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
onSecondaryContainer() {
|
|
1291
|
+
return DynamicColor.fromPalette({
|
|
1292
|
+
name: "on_secondary_container",
|
|
1293
|
+
palette: s => s.secondaryPalette,
|
|
1294
|
+
tone: s => isMonochrome(s) ? s.isDark ? 90 : 10 : isFidelity(s) ? DynamicColor.foregroundTone(this.secondaryContainer().tone(s), 4.5) : s.isDark ? 90 : 30,
|
|
1295
|
+
background: s => this.secondaryContainer(),
|
|
1296
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
tertiary() {
|
|
1300
|
+
return DynamicColor.fromPalette({
|
|
1301
|
+
name: "tertiary",
|
|
1302
|
+
palette: s => s.tertiaryPalette,
|
|
1303
|
+
tone: s => isMonochrome(s) ? s.isDark ? 90 : 25 : s.isDark ? 80 : 40,
|
|
1304
|
+
isBackground: !0,
|
|
1305
|
+
background: s => this.highestSurface(s),
|
|
1306
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
|
|
1307
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
tertiaryDim() {}
|
|
1311
|
+
onTertiary() {
|
|
1312
|
+
return DynamicColor.fromPalette({
|
|
1313
|
+
name: "on_tertiary",
|
|
1314
|
+
palette: s => s.tertiaryPalette,
|
|
1315
|
+
tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
|
|
1316
|
+
background: s => this.tertiary(),
|
|
1317
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
tertiaryContainer() {
|
|
1321
|
+
return DynamicColor.fromPalette({
|
|
1322
|
+
name: "tertiary_container",
|
|
1323
|
+
palette: s => s.tertiaryPalette,
|
|
1324
|
+
tone: s => {
|
|
1325
|
+
if (isMonochrome(s)) return s.isDark ? 60 : 49;
|
|
1326
|
+
if (!isFidelity(s)) return s.isDark ? 30 : 90;
|
|
1327
|
+
const proposedHct = s.tertiaryPalette.getHct(s.sourceColorHct.tone);
|
|
1328
|
+
return DislikeAnalyzer.fixIfDisliked(proposedHct).tone;
|
|
1329
|
+
},
|
|
1330
|
+
isBackground: !0,
|
|
1331
|
+
background: s => this.highestSurface(s),
|
|
1332
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1333
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 10, "nearer", !1)
|
|
1334
|
+
});
|
|
1335
|
+
}
|
|
1336
|
+
onTertiaryContainer() {
|
|
1337
|
+
return DynamicColor.fromPalette({
|
|
1338
|
+
name: "on_tertiary_container",
|
|
1339
|
+
palette: s => s.tertiaryPalette,
|
|
1340
|
+
tone: s => isMonochrome(s) ? s.isDark ? 0 : 100 : isFidelity(s) ? DynamicColor.foregroundTone(this.tertiaryContainer().tone(s), 4.5) : s.isDark ? 90 : 30,
|
|
1341
|
+
background: s => this.tertiaryContainer(),
|
|
1342
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
error() {
|
|
1346
|
+
return DynamicColor.fromPalette({
|
|
1347
|
+
name: "error",
|
|
1348
|
+
palette: s => s.errorPalette,
|
|
1349
|
+
tone: s => s.isDark ? 80 : 40,
|
|
1350
|
+
isBackground: !0,
|
|
1351
|
+
background: s => this.highestSurface(s),
|
|
1352
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 7),
|
|
1353
|
+
toneDeltaPair: s => new ToneDeltaPair(this.errorContainer(), this.error(), 10, "nearer", !1)
|
|
1354
|
+
});
|
|
1355
|
+
}
|
|
1356
|
+
errorDim() {}
|
|
1357
|
+
onError() {
|
|
1358
|
+
return DynamicColor.fromPalette({
|
|
1359
|
+
name: "on_error",
|
|
1360
|
+
palette: s => s.errorPalette,
|
|
1361
|
+
tone: s => s.isDark ? 20 : 100,
|
|
1362
|
+
background: s => this.error(),
|
|
1363
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
errorContainer() {
|
|
1367
|
+
return DynamicColor.fromPalette({
|
|
1368
|
+
name: "error_container",
|
|
1369
|
+
palette: s => s.errorPalette,
|
|
1370
|
+
tone: s => s.isDark ? 30 : 90,
|
|
1371
|
+
isBackground: !0,
|
|
1372
|
+
background: s => this.highestSurface(s),
|
|
1373
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1374
|
+
toneDeltaPair: s => new ToneDeltaPair(this.errorContainer(), this.error(), 10, "nearer", !1)
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
onErrorContainer() {
|
|
1378
|
+
return DynamicColor.fromPalette({
|
|
1379
|
+
name: "on_error_container",
|
|
1380
|
+
palette: s => s.errorPalette,
|
|
1381
|
+
tone: s => isMonochrome(s) ? s.isDark ? 90 : 10 : s.isDark ? 90 : 30,
|
|
1382
|
+
background: s => this.errorContainer(),
|
|
1383
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
primaryFixed() {
|
|
1387
|
+
return DynamicColor.fromPalette({
|
|
1388
|
+
name: "primary_fixed",
|
|
1389
|
+
palette: s => s.primaryPalette,
|
|
1390
|
+
tone: s => isMonochrome(s) ? 40 : 90,
|
|
1391
|
+
isBackground: !0,
|
|
1392
|
+
background: s => this.highestSurface(s),
|
|
1393
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1394
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
|
|
1395
|
+
});
|
|
1396
|
+
}
|
|
1397
|
+
primaryFixedDim() {
|
|
1398
|
+
return DynamicColor.fromPalette({
|
|
1399
|
+
name: "primary_fixed_dim",
|
|
1400
|
+
palette: s => s.primaryPalette,
|
|
1401
|
+
tone: s => isMonochrome(s) ? 30 : 80,
|
|
1402
|
+
isBackground: !0,
|
|
1403
|
+
background: s => this.highestSurface(s),
|
|
1404
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1405
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryFixed(), this.primaryFixedDim(), 10, "lighter", !0)
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
onPrimaryFixed() {
|
|
1409
|
+
return DynamicColor.fromPalette({
|
|
1410
|
+
name: "on_primary_fixed",
|
|
1411
|
+
palette: s => s.primaryPalette,
|
|
1412
|
+
tone: s => isMonochrome(s) ? 100 : 10,
|
|
1413
|
+
background: s => this.primaryFixedDim(),
|
|
1414
|
+
secondBackground: s => this.primaryFixed(),
|
|
1415
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1416
|
+
});
|
|
1417
|
+
}
|
|
1418
|
+
onPrimaryFixedVariant() {
|
|
1419
|
+
return DynamicColor.fromPalette({
|
|
1420
|
+
name: "on_primary_fixed_variant",
|
|
1421
|
+
palette: s => s.primaryPalette,
|
|
1422
|
+
tone: s => isMonochrome(s) ? 90 : 30,
|
|
1423
|
+
background: s => this.primaryFixedDim(),
|
|
1424
|
+
secondBackground: s => this.primaryFixed(),
|
|
1425
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1426
|
+
});
|
|
1427
|
+
}
|
|
1428
|
+
secondaryFixed() {
|
|
1429
|
+
return DynamicColor.fromPalette({
|
|
1430
|
+
name: "secondary_fixed",
|
|
1431
|
+
palette: s => s.secondaryPalette,
|
|
1432
|
+
tone: s => isMonochrome(s) ? 80 : 90,
|
|
1433
|
+
isBackground: !0,
|
|
1434
|
+
background: s => this.highestSurface(s),
|
|
1435
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1436
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
|
|
1437
|
+
});
|
|
1438
|
+
}
|
|
1439
|
+
secondaryFixedDim() {
|
|
1440
|
+
return DynamicColor.fromPalette({
|
|
1441
|
+
name: "secondary_fixed_dim",
|
|
1442
|
+
palette: s => s.secondaryPalette,
|
|
1443
|
+
tone: s => isMonochrome(s) ? 70 : 80,
|
|
1444
|
+
isBackground: !0,
|
|
1445
|
+
background: s => this.highestSurface(s),
|
|
1446
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1447
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixed(), this.secondaryFixedDim(), 10, "lighter", !0)
|
|
1448
|
+
});
|
|
1449
|
+
}
|
|
1450
|
+
onSecondaryFixed() {
|
|
1451
|
+
return DynamicColor.fromPalette({
|
|
1452
|
+
name: "on_secondary_fixed",
|
|
1453
|
+
palette: s => s.secondaryPalette,
|
|
1454
|
+
tone: s => 10,
|
|
1455
|
+
background: s => this.secondaryFixedDim(),
|
|
1456
|
+
secondBackground: s => this.secondaryFixed(),
|
|
1457
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1458
|
+
});
|
|
1459
|
+
}
|
|
1460
|
+
onSecondaryFixedVariant() {
|
|
1461
|
+
return DynamicColor.fromPalette({
|
|
1462
|
+
name: "on_secondary_fixed_variant",
|
|
1463
|
+
palette: s => s.secondaryPalette,
|
|
1464
|
+
tone: s => isMonochrome(s) ? 25 : 30,
|
|
1465
|
+
background: s => this.secondaryFixedDim(),
|
|
1466
|
+
secondBackground: s => this.secondaryFixed(),
|
|
1467
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1468
|
+
});
|
|
1469
|
+
}
|
|
1470
|
+
tertiaryFixed() {
|
|
1471
|
+
return DynamicColor.fromPalette({
|
|
1472
|
+
name: "tertiary_fixed",
|
|
1473
|
+
palette: s => s.tertiaryPalette,
|
|
1474
|
+
tone: s => isMonochrome(s) ? 40 : 90,
|
|
1475
|
+
isBackground: !0,
|
|
1476
|
+
background: s => this.highestSurface(s),
|
|
1477
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1478
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
|
|
1479
|
+
});
|
|
1480
|
+
}
|
|
1481
|
+
tertiaryFixedDim() {
|
|
1482
|
+
return DynamicColor.fromPalette({
|
|
1483
|
+
name: "tertiary_fixed_dim",
|
|
1484
|
+
palette: s => s.tertiaryPalette,
|
|
1485
|
+
tone: s => isMonochrome(s) ? 30 : 80,
|
|
1486
|
+
isBackground: !0,
|
|
1487
|
+
background: s => this.highestSurface(s),
|
|
1488
|
+
contrastCurve: s => new ContrastCurve(1, 1, 3, 4.5),
|
|
1489
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixed(), this.tertiaryFixedDim(), 10, "lighter", !0)
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
onTertiaryFixed() {
|
|
1493
|
+
return DynamicColor.fromPalette({
|
|
1494
|
+
name: "on_tertiary_fixed",
|
|
1495
|
+
palette: s => s.tertiaryPalette,
|
|
1496
|
+
tone: s => isMonochrome(s) ? 100 : 10,
|
|
1497
|
+
background: s => this.tertiaryFixedDim(),
|
|
1498
|
+
secondBackground: s => this.tertiaryFixed(),
|
|
1499
|
+
contrastCurve: s => new ContrastCurve(4.5, 7, 11, 21)
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
onTertiaryFixedVariant() {
|
|
1503
|
+
return DynamicColor.fromPalette({
|
|
1504
|
+
name: "on_tertiary_fixed_variant",
|
|
1505
|
+
palette: s => s.tertiaryPalette,
|
|
1506
|
+
tone: s => isMonochrome(s) ? 90 : 30,
|
|
1507
|
+
background: s => this.tertiaryFixedDim(),
|
|
1508
|
+
secondBackground: s => this.tertiaryFixed(),
|
|
1509
|
+
contrastCurve: s => new ContrastCurve(3, 4.5, 7, 11)
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
highestSurface(s) {
|
|
1513
|
+
return s.isDark ? this.surfaceBright() : this.surfaceDim();
|
|
1514
|
+
}
|
|
702
1515
|
}
|
|
703
|
-
function
|
|
704
|
-
|
|
705
|
-
|
|
1516
|
+
function tMaxC(palette, lowerBound, upperBound, chromaMultiplier) {
|
|
1517
|
+
if (lowerBound === void 0) {
|
|
1518
|
+
lowerBound = 0;
|
|
1519
|
+
}
|
|
1520
|
+
if (upperBound === void 0) {
|
|
1521
|
+
upperBound = 100;
|
|
1522
|
+
}
|
|
1523
|
+
if (chromaMultiplier === void 0) {
|
|
1524
|
+
chromaMultiplier = 1;
|
|
1525
|
+
}
|
|
1526
|
+
return clampDouble(lowerBound, upperBound, findBestToneForChroma(palette.hue, palette.chroma * chromaMultiplier, 100, !0));
|
|
706
1527
|
}
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
1528
|
+
function tMinC(palette, lowerBound, upperBound) {
|
|
1529
|
+
if (lowerBound === void 0) {
|
|
1530
|
+
lowerBound = 0;
|
|
1531
|
+
}
|
|
1532
|
+
if (upperBound === void 0) {
|
|
1533
|
+
upperBound = 100;
|
|
710
1534
|
}
|
|
1535
|
+
return clampDouble(lowerBound, upperBound, findBestToneForChroma(palette.hue, palette.chroma, 0, !1));
|
|
711
1536
|
}
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
tone
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
tone: s => s.secondaryPalette.keyColor.tone
|
|
720
|
-
}), MaterialDynamicColors.tertiaryPaletteKeyColor = DynamicColor.fromPalette({
|
|
721
|
-
name: "tertiary_palette_key_color",
|
|
722
|
-
palette: s => s.tertiaryPalette,
|
|
723
|
-
tone: s => s.tertiaryPalette.keyColor.tone
|
|
724
|
-
}), MaterialDynamicColors.neutralPaletteKeyColor = DynamicColor.fromPalette({
|
|
725
|
-
name: "neutral_palette_key_color",
|
|
726
|
-
palette: s => s.neutralPalette,
|
|
727
|
-
tone: s => s.neutralPalette.keyColor.tone
|
|
728
|
-
}), MaterialDynamicColors.neutralVariantPaletteKeyColor = DynamicColor.fromPalette({
|
|
729
|
-
name: "neutral_variant_palette_key_color",
|
|
730
|
-
palette: s => s.neutralVariantPalette,
|
|
731
|
-
tone: s => s.neutralVariantPalette.keyColor.tone
|
|
732
|
-
}), MaterialDynamicColors.background = DynamicColor.fromPalette({
|
|
733
|
-
name: "background",
|
|
734
|
-
palette: s => s.neutralPalette,
|
|
735
|
-
tone: s => s.isDark ? 6 : 98,
|
|
736
|
-
isBackground: !0
|
|
737
|
-
}), MaterialDynamicColors.onBackground = DynamicColor.fromPalette({
|
|
738
|
-
name: "on_background",
|
|
739
|
-
palette: s => s.neutralPalette,
|
|
740
|
-
tone: s => s.isDark ? 90 : 10,
|
|
741
|
-
background: s => MaterialDynamicColors.background,
|
|
742
|
-
contrastCurve: new ContrastCurve(3, 3, 4.5, 7)
|
|
743
|
-
}), MaterialDynamicColors.surface = DynamicColor.fromPalette({
|
|
744
|
-
name: "surface",
|
|
745
|
-
palette: s => s.neutralPalette,
|
|
746
|
-
tone: s => s.isDark ? 6 : 98,
|
|
747
|
-
isBackground: !0
|
|
748
|
-
}), MaterialDynamicColors.surfaceDim = DynamicColor.fromPalette({
|
|
749
|
-
name: "surface_dim",
|
|
750
|
-
palette: s => s.neutralPalette,
|
|
751
|
-
tone: s => s.isDark ? 6 : 87,
|
|
752
|
-
isBackground: !0
|
|
753
|
-
}), MaterialDynamicColors.surfaceBright = DynamicColor.fromPalette({
|
|
754
|
-
name: "surface_bright",
|
|
755
|
-
palette: s => s.neutralPalette,
|
|
756
|
-
tone: s => s.isDark ? 24 : 98,
|
|
757
|
-
isBackground: !0
|
|
758
|
-
}), MaterialDynamicColors.surfaceContainerLowest = DynamicColor.fromPalette({
|
|
759
|
-
name: "surface_container_lowest",
|
|
760
|
-
palette: s => s.neutralPalette,
|
|
761
|
-
tone: s => s.isDark ? 4 : 100,
|
|
762
|
-
isBackground: !0
|
|
763
|
-
}), MaterialDynamicColors.surfaceContainerLow = DynamicColor.fromPalette({
|
|
764
|
-
name: "surface_container_low",
|
|
765
|
-
palette: s => s.neutralPalette,
|
|
766
|
-
tone: s => s.isDark ? 10 : 96,
|
|
767
|
-
isBackground: !0
|
|
768
|
-
}), MaterialDynamicColors.surfaceContainer = DynamicColor.fromPalette({
|
|
769
|
-
name: "surface_container",
|
|
770
|
-
palette: s => s.neutralPalette,
|
|
771
|
-
tone: s => s.isDark ? 12 : 94,
|
|
772
|
-
isBackground: !0
|
|
773
|
-
}), MaterialDynamicColors.surfaceContainerHigh = DynamicColor.fromPalette({
|
|
774
|
-
name: "surface_container_high",
|
|
775
|
-
palette: s => s.neutralPalette,
|
|
776
|
-
tone: s => s.isDark ? 17 : 92,
|
|
777
|
-
isBackground: !0
|
|
778
|
-
}), MaterialDynamicColors.surfaceContainerHighest = DynamicColor.fromPalette({
|
|
779
|
-
name: "surface_container_highest",
|
|
780
|
-
palette: s => s.neutralPalette,
|
|
781
|
-
tone: s => s.isDark ? 22 : 90,
|
|
782
|
-
isBackground: !0
|
|
783
|
-
}), MaterialDynamicColors.onSurface = DynamicColor.fromPalette({
|
|
784
|
-
name: "on_surface",
|
|
785
|
-
palette: s => s.neutralPalette,
|
|
786
|
-
tone: s => s.isDark ? 90 : 10,
|
|
787
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
788
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
789
|
-
}), MaterialDynamicColors.surfaceVariant = DynamicColor.fromPalette({
|
|
790
|
-
name: "surface_variant",
|
|
791
|
-
palette: s => s.neutralVariantPalette,
|
|
792
|
-
tone: s => s.isDark ? 30 : 90,
|
|
793
|
-
isBackground: !0
|
|
794
|
-
}), MaterialDynamicColors.onSurfaceVariant = DynamicColor.fromPalette({
|
|
795
|
-
name: "on_surface_variant",
|
|
796
|
-
palette: s => s.neutralVariantPalette,
|
|
797
|
-
tone: s => s.isDark ? 80 : 30,
|
|
798
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
799
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
|
|
800
|
-
}), MaterialDynamicColors.inverseSurface = DynamicColor.fromPalette({
|
|
801
|
-
name: "inverse_surface",
|
|
802
|
-
palette: s => s.neutralPalette,
|
|
803
|
-
tone: s => s.isDark ? 90 : 20
|
|
804
|
-
}), MaterialDynamicColors.inverseOnSurface = DynamicColor.fromPalette({
|
|
805
|
-
name: "inverse_on_surface",
|
|
806
|
-
palette: s => s.neutralPalette,
|
|
807
|
-
tone: s => s.isDark ? 20 : 95,
|
|
808
|
-
background: s => MaterialDynamicColors.inverseSurface,
|
|
809
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
810
|
-
}), MaterialDynamicColors.outline = DynamicColor.fromPalette({
|
|
811
|
-
name: "outline",
|
|
812
|
-
palette: s => s.neutralVariantPalette,
|
|
813
|
-
tone: s => s.isDark ? 60 : 50,
|
|
814
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
815
|
-
contrastCurve: new ContrastCurve(1.5, 3, 4.5, 7)
|
|
816
|
-
}), MaterialDynamicColors.outlineVariant = DynamicColor.fromPalette({
|
|
817
|
-
name: "outline_variant",
|
|
818
|
-
palette: s => s.neutralVariantPalette,
|
|
819
|
-
tone: s => s.isDark ? 30 : 80,
|
|
820
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
821
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7)
|
|
822
|
-
}), MaterialDynamicColors.shadow = DynamicColor.fromPalette({
|
|
823
|
-
name: "shadow",
|
|
824
|
-
palette: s => s.neutralPalette,
|
|
825
|
-
tone: s => 0
|
|
826
|
-
}), MaterialDynamicColors.scrim = DynamicColor.fromPalette({
|
|
827
|
-
name: "scrim",
|
|
828
|
-
palette: s => s.neutralPalette,
|
|
829
|
-
tone: s => 0
|
|
830
|
-
}), MaterialDynamicColors.surfaceTint = DynamicColor.fromPalette({
|
|
831
|
-
name: "surface_tint",
|
|
832
|
-
palette: s => s.primaryPalette,
|
|
833
|
-
tone: s => s.isDark ? 80 : 40,
|
|
834
|
-
isBackground: !0
|
|
835
|
-
}), MaterialDynamicColors.primary = DynamicColor.fromPalette({
|
|
836
|
-
name: "primary",
|
|
837
|
-
palette: s => s.primaryPalette,
|
|
838
|
-
tone: s => isMonochrome(s) ? s.isDark ? 100 : 0 : s.isDark ? 80 : 40,
|
|
839
|
-
isBackground: !0,
|
|
840
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
841
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
|
|
842
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryContainer, MaterialDynamicColors.primary, 15, "nearer", !1)
|
|
843
|
-
}), MaterialDynamicColors.onPrimary = DynamicColor.fromPalette({
|
|
844
|
-
name: "on_primary",
|
|
845
|
-
palette: s => s.primaryPalette,
|
|
846
|
-
tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
|
|
847
|
-
background: s => MaterialDynamicColors.primary,
|
|
848
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
849
|
-
}), MaterialDynamicColors.primaryContainer = DynamicColor.fromPalette({
|
|
850
|
-
name: "primary_container",
|
|
851
|
-
palette: s => s.primaryPalette,
|
|
852
|
-
tone: s => isFidelity(s) ? performAlbers(s.sourceColorHct, s) : isMonochrome(s) ? s.isDark ? 85 : 25 : s.isDark ? 30 : 90,
|
|
853
|
-
isBackground: !0,
|
|
854
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
855
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
856
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryContainer, MaterialDynamicColors.primary, 15, "nearer", !1)
|
|
857
|
-
}), MaterialDynamicColors.onPrimaryContainer = DynamicColor.fromPalette({
|
|
858
|
-
name: "on_primary_container",
|
|
859
|
-
palette: s => s.primaryPalette,
|
|
860
|
-
tone: s => isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.primaryContainer.tone(s), 4.5) : isMonochrome(s) ? s.isDark ? 0 : 100 : s.isDark ? 90 : 10,
|
|
861
|
-
background: s => MaterialDynamicColors.primaryContainer,
|
|
862
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
863
|
-
}), MaterialDynamicColors.inversePrimary = DynamicColor.fromPalette({
|
|
864
|
-
name: "inverse_primary",
|
|
865
|
-
palette: s => s.primaryPalette,
|
|
866
|
-
tone: s => s.isDark ? 40 : 80,
|
|
867
|
-
background: s => MaterialDynamicColors.inverseSurface,
|
|
868
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
|
|
869
|
-
}), MaterialDynamicColors.secondary = DynamicColor.fromPalette({
|
|
870
|
-
name: "secondary",
|
|
871
|
-
palette: s => s.secondaryPalette,
|
|
872
|
-
tone: s => s.isDark ? 80 : 40,
|
|
873
|
-
isBackground: !0,
|
|
874
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
875
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
|
|
876
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryContainer, MaterialDynamicColors.secondary, 15, "nearer", !1)
|
|
877
|
-
}), MaterialDynamicColors.onSecondary = DynamicColor.fromPalette({
|
|
878
|
-
name: "on_secondary",
|
|
879
|
-
palette: s => s.secondaryPalette,
|
|
880
|
-
tone: s => isMonochrome(s) ? s.isDark ? 10 : 100 : s.isDark ? 20 : 100,
|
|
881
|
-
background: s => MaterialDynamicColors.secondary,
|
|
882
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
883
|
-
}), MaterialDynamicColors.secondaryContainer = DynamicColor.fromPalette({
|
|
884
|
-
name: "secondary_container",
|
|
885
|
-
palette: s => s.secondaryPalette,
|
|
886
|
-
tone: s => {
|
|
887
|
-
const initialTone = s.isDark ? 30 : 90;
|
|
888
|
-
if (isMonochrome(s)) return s.isDark ? 30 : 85;
|
|
889
|
-
if (!isFidelity(s)) return initialTone;
|
|
890
|
-
let answer = findDesiredChromaByTone(s.secondaryPalette.hue, s.secondaryPalette.chroma, initialTone, !s.isDark);
|
|
891
|
-
return answer = performAlbers(s.secondaryPalette.getHct(answer), s), answer;
|
|
892
|
-
},
|
|
893
|
-
isBackground: !0,
|
|
894
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
895
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
896
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryContainer, MaterialDynamicColors.secondary, 15, "nearer", !1)
|
|
897
|
-
}), MaterialDynamicColors.onSecondaryContainer = DynamicColor.fromPalette({
|
|
898
|
-
name: "on_secondary_container",
|
|
899
|
-
palette: s => s.secondaryPalette,
|
|
900
|
-
tone: s => isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.secondaryContainer.tone(s), 4.5) : s.isDark ? 90 : 10,
|
|
901
|
-
background: s => MaterialDynamicColors.secondaryContainer,
|
|
902
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
903
|
-
}), MaterialDynamicColors.tertiary = DynamicColor.fromPalette({
|
|
904
|
-
name: "tertiary",
|
|
905
|
-
palette: s => s.tertiaryPalette,
|
|
906
|
-
tone: s => isMonochrome(s) ? s.isDark ? 90 : 25 : s.isDark ? 80 : 40,
|
|
907
|
-
isBackground: !0,
|
|
908
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
909
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
|
|
910
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryContainer, MaterialDynamicColors.tertiary, 15, "nearer", !1)
|
|
911
|
-
}), MaterialDynamicColors.onTertiary = DynamicColor.fromPalette({
|
|
912
|
-
name: "on_tertiary",
|
|
913
|
-
palette: s => s.tertiaryPalette,
|
|
914
|
-
tone: s => isMonochrome(s) ? s.isDark ? 10 : 90 : s.isDark ? 20 : 100,
|
|
915
|
-
background: s => MaterialDynamicColors.tertiary,
|
|
916
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
917
|
-
}), MaterialDynamicColors.tertiaryContainer = DynamicColor.fromPalette({
|
|
918
|
-
name: "tertiary_container",
|
|
919
|
-
palette: s => s.tertiaryPalette,
|
|
920
|
-
tone: s => {
|
|
921
|
-
if (isMonochrome(s)) return s.isDark ? 60 : 49;
|
|
922
|
-
if (!isFidelity(s)) return s.isDark ? 30 : 90;
|
|
923
|
-
const albersTone = performAlbers(s.tertiaryPalette.getHct(s.sourceColorHct.tone), s),
|
|
924
|
-
proposedHct = s.tertiaryPalette.getHct(albersTone);
|
|
925
|
-
return DislikeAnalyzer.fixIfDisliked(proposedHct).tone;
|
|
926
|
-
},
|
|
927
|
-
isBackground: !0,
|
|
928
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
929
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
930
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryContainer, MaterialDynamicColors.tertiary, 15, "nearer", !1)
|
|
931
|
-
}), MaterialDynamicColors.onTertiaryContainer = DynamicColor.fromPalette({
|
|
932
|
-
name: "on_tertiary_container",
|
|
933
|
-
palette: s => s.tertiaryPalette,
|
|
934
|
-
tone: s => isMonochrome(s) ? s.isDark ? 0 : 100 : isFidelity(s) ? DynamicColor.foregroundTone(MaterialDynamicColors.tertiaryContainer.tone(s), 4.5) : s.isDark ? 90 : 10,
|
|
935
|
-
background: s => MaterialDynamicColors.tertiaryContainer,
|
|
936
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
937
|
-
}), MaterialDynamicColors.error = DynamicColor.fromPalette({
|
|
938
|
-
name: "error",
|
|
939
|
-
palette: s => s.errorPalette,
|
|
940
|
-
tone: s => s.isDark ? 80 : 40,
|
|
941
|
-
isBackground: !0,
|
|
942
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
943
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11),
|
|
944
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.errorContainer, MaterialDynamicColors.error, 15, "nearer", !1)
|
|
945
|
-
}), MaterialDynamicColors.onError = DynamicColor.fromPalette({
|
|
946
|
-
name: "on_error",
|
|
947
|
-
palette: s => s.errorPalette,
|
|
948
|
-
tone: s => s.isDark ? 20 : 100,
|
|
949
|
-
background: s => MaterialDynamicColors.error,
|
|
950
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
951
|
-
}), MaterialDynamicColors.errorContainer = DynamicColor.fromPalette({
|
|
952
|
-
name: "error_container",
|
|
953
|
-
palette: s => s.errorPalette,
|
|
954
|
-
tone: s => s.isDark ? 30 : 90,
|
|
955
|
-
isBackground: !0,
|
|
956
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
957
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
958
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.errorContainer, MaterialDynamicColors.error, 15, "nearer", !1)
|
|
959
|
-
}), MaterialDynamicColors.onErrorContainer = DynamicColor.fromPalette({
|
|
960
|
-
name: "on_error_container",
|
|
961
|
-
palette: s => s.errorPalette,
|
|
962
|
-
tone: s => s.isDark ? 90 : 10,
|
|
963
|
-
background: s => MaterialDynamicColors.errorContainer,
|
|
964
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
965
|
-
}), MaterialDynamicColors.primaryFixed = DynamicColor.fromPalette({
|
|
966
|
-
name: "primary_fixed",
|
|
967
|
-
palette: s => s.primaryPalette,
|
|
968
|
-
tone: s => isMonochrome(s) ? 40 : 90,
|
|
969
|
-
isBackground: !0,
|
|
970
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
971
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
972
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryFixed, MaterialDynamicColors.primaryFixedDim, 10, "lighter", !0)
|
|
973
|
-
}), MaterialDynamicColors.primaryFixedDim = DynamicColor.fromPalette({
|
|
974
|
-
name: "primary_fixed_dim",
|
|
975
|
-
palette: s => s.primaryPalette,
|
|
976
|
-
tone: s => isMonochrome(s) ? 30 : 80,
|
|
977
|
-
isBackground: !0,
|
|
978
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
979
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
980
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.primaryFixed, MaterialDynamicColors.primaryFixedDim, 10, "lighter", !0)
|
|
981
|
-
}), MaterialDynamicColors.onPrimaryFixed = DynamicColor.fromPalette({
|
|
982
|
-
name: "on_primary_fixed",
|
|
983
|
-
palette: s => s.primaryPalette,
|
|
984
|
-
tone: s => isMonochrome(s) ? 100 : 10,
|
|
985
|
-
background: s => MaterialDynamicColors.primaryFixedDim,
|
|
986
|
-
secondBackground: s => MaterialDynamicColors.primaryFixed,
|
|
987
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
988
|
-
}), MaterialDynamicColors.onPrimaryFixedVariant = DynamicColor.fromPalette({
|
|
989
|
-
name: "on_primary_fixed_variant",
|
|
990
|
-
palette: s => s.primaryPalette,
|
|
991
|
-
tone: s => isMonochrome(s) ? 90 : 30,
|
|
992
|
-
background: s => MaterialDynamicColors.primaryFixedDim,
|
|
993
|
-
secondBackground: s => MaterialDynamicColors.primaryFixed,
|
|
994
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
|
|
995
|
-
}), MaterialDynamicColors.secondaryFixed = DynamicColor.fromPalette({
|
|
996
|
-
name: "secondary_fixed",
|
|
997
|
-
palette: s => s.secondaryPalette,
|
|
998
|
-
tone: s => isMonochrome(s) ? 80 : 90,
|
|
999
|
-
isBackground: !0,
|
|
1000
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
1001
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
1002
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryFixed, MaterialDynamicColors.secondaryFixedDim, 10, "lighter", !0)
|
|
1003
|
-
}), MaterialDynamicColors.secondaryFixedDim = DynamicColor.fromPalette({
|
|
1004
|
-
name: "secondary_fixed_dim",
|
|
1005
|
-
palette: s => s.secondaryPalette,
|
|
1006
|
-
tone: s => isMonochrome(s) ? 70 : 80,
|
|
1007
|
-
isBackground: !0,
|
|
1008
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
1009
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
1010
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.secondaryFixed, MaterialDynamicColors.secondaryFixedDim, 10, "lighter", !0)
|
|
1011
|
-
}), MaterialDynamicColors.onSecondaryFixed = DynamicColor.fromPalette({
|
|
1012
|
-
name: "on_secondary_fixed",
|
|
1013
|
-
palette: s => s.secondaryPalette,
|
|
1014
|
-
tone: s => 10,
|
|
1015
|
-
background: s => MaterialDynamicColors.secondaryFixedDim,
|
|
1016
|
-
secondBackground: s => MaterialDynamicColors.secondaryFixed,
|
|
1017
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
1018
|
-
}), MaterialDynamicColors.onSecondaryFixedVariant = DynamicColor.fromPalette({
|
|
1019
|
-
name: "on_secondary_fixed_variant",
|
|
1020
|
-
palette: s => s.secondaryPalette,
|
|
1021
|
-
tone: s => isMonochrome(s) ? 25 : 30,
|
|
1022
|
-
background: s => MaterialDynamicColors.secondaryFixedDim,
|
|
1023
|
-
secondBackground: s => MaterialDynamicColors.secondaryFixed,
|
|
1024
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
|
|
1025
|
-
}), MaterialDynamicColors.tertiaryFixed = DynamicColor.fromPalette({
|
|
1026
|
-
name: "tertiary_fixed",
|
|
1027
|
-
palette: s => s.tertiaryPalette,
|
|
1028
|
-
tone: s => isMonochrome(s) ? 40 : 90,
|
|
1029
|
-
isBackground: !0,
|
|
1030
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
1031
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
1032
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryFixed, MaterialDynamicColors.tertiaryFixedDim, 10, "lighter", !0)
|
|
1033
|
-
}), MaterialDynamicColors.tertiaryFixedDim = DynamicColor.fromPalette({
|
|
1034
|
-
name: "tertiary_fixed_dim",
|
|
1035
|
-
palette: s => s.tertiaryPalette,
|
|
1036
|
-
tone: s => isMonochrome(s) ? 30 : 80,
|
|
1037
|
-
isBackground: !0,
|
|
1038
|
-
background: s => MaterialDynamicColors.highestSurface(s),
|
|
1039
|
-
contrastCurve: new ContrastCurve(1, 1, 3, 7),
|
|
1040
|
-
toneDeltaPair: s => new ToneDeltaPair(MaterialDynamicColors.tertiaryFixed, MaterialDynamicColors.tertiaryFixedDim, 10, "lighter", !0)
|
|
1041
|
-
}), MaterialDynamicColors.onTertiaryFixed = DynamicColor.fromPalette({
|
|
1042
|
-
name: "on_tertiary_fixed",
|
|
1043
|
-
palette: s => s.tertiaryPalette,
|
|
1044
|
-
tone: s => isMonochrome(s) ? 100 : 10,
|
|
1045
|
-
background: s => MaterialDynamicColors.tertiaryFixedDim,
|
|
1046
|
-
secondBackground: s => MaterialDynamicColors.tertiaryFixed,
|
|
1047
|
-
contrastCurve: new ContrastCurve(4.5, 7, 11, 21)
|
|
1048
|
-
}), MaterialDynamicColors.onTertiaryFixedVariant = DynamicColor.fromPalette({
|
|
1049
|
-
name: "on_tertiary_fixed_variant",
|
|
1050
|
-
palette: s => s.tertiaryPalette,
|
|
1051
|
-
tone: s => isMonochrome(s) ? 90 : 30,
|
|
1052
|
-
background: s => MaterialDynamicColors.tertiaryFixedDim,
|
|
1053
|
-
secondBackground: s => MaterialDynamicColors.tertiaryFixed,
|
|
1054
|
-
contrastCurve: new ContrastCurve(3, 4.5, 7, 11)
|
|
1055
|
-
});
|
|
1056
|
-
class TonalPalette {
|
|
1057
|
-
static fromInt(argb) {
|
|
1058
|
-
const hct = Hct.fromInt(argb);
|
|
1059
|
-
return TonalPalette.fromHct(hct);
|
|
1537
|
+
function findBestToneForChroma(hue, chroma, tone, byDecreasingTone) {
|
|
1538
|
+
let answer = tone,
|
|
1539
|
+
bestCandidate = Hct.from(hue, chroma, answer);
|
|
1540
|
+
for (; bestCandidate.chroma < chroma && !(tone < 0 || tone > 100);) {
|
|
1541
|
+
tone += byDecreasingTone ? -1 : 1;
|
|
1542
|
+
const newCandidate = Hct.from(hue, chroma, tone);
|
|
1543
|
+
bestCandidate.chroma < newCandidate.chroma && (bestCandidate = newCandidate, answer = tone);
|
|
1060
1544
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1545
|
+
return answer;
|
|
1546
|
+
}
|
|
1547
|
+
function getCurve(defaultContrast) {
|
|
1548
|
+
return 1.5 === defaultContrast ? new ContrastCurve(1.5, 1.5, 3, 5.5) : 3 === defaultContrast ? new ContrastCurve(3, 3, 4.5, 7) : 4.5 === defaultContrast ? new ContrastCurve(4.5, 4.5, 7, 11) : 6 === defaultContrast ? new ContrastCurve(6, 6, 7, 11) : 7 === defaultContrast ? new ContrastCurve(7, 7, 11, 21) : 9 === defaultContrast ? new ContrastCurve(9, 9, 11, 21) : 11 === defaultContrast ? new ContrastCurve(11, 11, 21, 21) : 21 === defaultContrast ? new ContrastCurve(21, 21, 21, 21) : new ContrastCurve(defaultContrast, defaultContrast, 7, 21);
|
|
1549
|
+
}
|
|
1550
|
+
class ColorSpecDelegateImpl2025 extends ColorSpecDelegateImpl2021 {
|
|
1551
|
+
surface() {
|
|
1552
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1553
|
+
name: "surface",
|
|
1554
|
+
palette: s => s.neutralPalette,
|
|
1555
|
+
tone: s => (super.surface().tone(s), "phone" === s.platform ? s.isDark ? 4 : Hct.isYellow(s.neutralPalette.hue) ? 99 : s.variant === Variant.VIBRANT ? 97 : 98 : 0),
|
|
1556
|
+
isBackground: !0
|
|
1557
|
+
});
|
|
1558
|
+
return extendSpecVersion(super.surface(), "2025", color2025);
|
|
1559
|
+
}
|
|
1560
|
+
surfaceDim() {
|
|
1561
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1562
|
+
name: "surface_dim",
|
|
1563
|
+
palette: s => s.neutralPalette,
|
|
1564
|
+
tone: s => s.isDark ? 4 : Hct.isYellow(s.neutralPalette.hue) ? 90 : s.variant === Variant.VIBRANT ? 85 : 87,
|
|
1565
|
+
isBackground: !0,
|
|
1566
|
+
chromaMultiplier: s => {
|
|
1567
|
+
if (!s.isDark) {
|
|
1568
|
+
if (s.variant === Variant.NEUTRAL) return 2.5;
|
|
1569
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1570
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 2.7 : 1.75;
|
|
1571
|
+
if (s.variant === Variant.VIBRANT) return 1.36;
|
|
1572
|
+
}
|
|
1573
|
+
return 1;
|
|
1574
|
+
}
|
|
1575
|
+
});
|
|
1576
|
+
return extendSpecVersion(super.surfaceDim(), "2025", color2025);
|
|
1577
|
+
}
|
|
1578
|
+
surfaceBright() {
|
|
1579
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1580
|
+
name: "surface_bright",
|
|
1581
|
+
palette: s => s.neutralPalette,
|
|
1582
|
+
tone: s => s.isDark ? 18 : Hct.isYellow(s.neutralPalette.hue) ? 99 : s.variant === Variant.VIBRANT ? 97 : 98,
|
|
1583
|
+
isBackground: !0,
|
|
1584
|
+
chromaMultiplier: s => {
|
|
1585
|
+
if (s.isDark) {
|
|
1586
|
+
if (s.variant === Variant.NEUTRAL) return 2.5;
|
|
1587
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1588
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 2.7 : 1.75;
|
|
1589
|
+
if (s.variant === Variant.VIBRANT) return 1.36;
|
|
1590
|
+
}
|
|
1591
|
+
return 1;
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
return extendSpecVersion(super.surfaceBright(), "2025", color2025);
|
|
1595
|
+
}
|
|
1596
|
+
surfaceContainerLowest() {
|
|
1597
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1598
|
+
name: "surface_container_lowest",
|
|
1599
|
+
palette: s => s.neutralPalette,
|
|
1600
|
+
tone: s => s.isDark ? 0 : 100,
|
|
1601
|
+
isBackground: !0
|
|
1602
|
+
});
|
|
1603
|
+
return extendSpecVersion(super.surfaceContainerLowest(), "2025", color2025);
|
|
1604
|
+
}
|
|
1605
|
+
surfaceContainerLow() {
|
|
1606
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1607
|
+
name: "surface_container_low",
|
|
1608
|
+
palette: s => s.neutralPalette,
|
|
1609
|
+
tone: s => "phone" === s.platform ? s.isDark ? 6 : Hct.isYellow(s.neutralPalette.hue) ? 98 : s.variant === Variant.VIBRANT ? 95 : 96 : 15,
|
|
1610
|
+
isBackground: !0,
|
|
1611
|
+
chromaMultiplier: s => {
|
|
1612
|
+
if ("phone" === s.platform) {
|
|
1613
|
+
if (s.variant === Variant.NEUTRAL) return 1.3;
|
|
1614
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.25;
|
|
1615
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.3 : 1.15;
|
|
1616
|
+
if (s.variant === Variant.VIBRANT) return 1.08;
|
|
1617
|
+
}
|
|
1618
|
+
return 1;
|
|
1619
|
+
}
|
|
1620
|
+
});
|
|
1621
|
+
return extendSpecVersion(super.surfaceContainerLow(), "2025", color2025);
|
|
1622
|
+
}
|
|
1623
|
+
surfaceContainer() {
|
|
1624
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1625
|
+
name: "surface_container",
|
|
1626
|
+
palette: s => s.neutralPalette,
|
|
1627
|
+
tone: s => "phone" === s.platform ? s.isDark ? 9 : Hct.isYellow(s.neutralPalette.hue) ? 96 : s.variant === Variant.VIBRANT ? 92 : 94 : 20,
|
|
1628
|
+
isBackground: !0,
|
|
1629
|
+
chromaMultiplier: s => {
|
|
1630
|
+
if ("phone" === s.platform) {
|
|
1631
|
+
if (s.variant === Variant.NEUTRAL) return 1.6;
|
|
1632
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.4;
|
|
1633
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.6 : 1.3;
|
|
1634
|
+
if (s.variant === Variant.VIBRANT) return 1.15;
|
|
1635
|
+
}
|
|
1636
|
+
return 1;
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
return extendSpecVersion(super.surfaceContainer(), "2025", color2025);
|
|
1640
|
+
}
|
|
1641
|
+
surfaceContainerHigh() {
|
|
1642
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1643
|
+
name: "surface_container_high",
|
|
1644
|
+
palette: s => s.neutralPalette,
|
|
1645
|
+
tone: s => "phone" === s.platform ? s.isDark ? 12 : Hct.isYellow(s.neutralPalette.hue) ? 94 : s.variant === Variant.VIBRANT ? 90 : 92 : 25,
|
|
1646
|
+
isBackground: !0,
|
|
1647
|
+
chromaMultiplier: s => {
|
|
1648
|
+
if ("phone" === s.platform) {
|
|
1649
|
+
if (s.variant === Variant.NEUTRAL) return 1.9;
|
|
1650
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.5;
|
|
1651
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? 1.95 : 1.45;
|
|
1652
|
+
if (s.variant === Variant.VIBRANT) return 1.22;
|
|
1653
|
+
}
|
|
1654
|
+
return 1;
|
|
1655
|
+
}
|
|
1656
|
+
});
|
|
1657
|
+
return extendSpecVersion(super.surfaceContainerHigh(), "2025", color2025);
|
|
1658
|
+
}
|
|
1659
|
+
surfaceContainerHighest() {
|
|
1660
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1661
|
+
name: "surface_container_highest",
|
|
1662
|
+
palette: s => s.neutralPalette,
|
|
1663
|
+
tone: s => s.isDark ? 15 : Hct.isYellow(s.neutralPalette.hue) ? 92 : s.variant === Variant.VIBRANT ? 88 : 90,
|
|
1664
|
+
isBackground: !0,
|
|
1665
|
+
chromaMultiplier: s => s.variant === Variant.NEUTRAL ? 2.2 : s.variant === Variant.TONAL_SPOT ? 1.7 : s.variant === Variant.EXPRESSIVE ? Hct.isYellow(s.neutralPalette.hue) ? 2.3 : 1.6 : s.variant === Variant.VIBRANT ? 1.29 : 1
|
|
1666
|
+
});
|
|
1667
|
+
return extendSpecVersion(super.surfaceContainerHighest(), "2025", color2025);
|
|
1668
|
+
}
|
|
1669
|
+
onSurface() {
|
|
1670
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1671
|
+
name: "on_surface",
|
|
1672
|
+
palette: s => s.neutralPalette,
|
|
1673
|
+
tone: s => s.variant === Variant.VIBRANT ? tMaxC(s.neutralPalette, 0, 100, 1.1) : DynamicColor.getInitialToneFromBackground(s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh())(s),
|
|
1674
|
+
chromaMultiplier: s => {
|
|
1675
|
+
if ("phone" === s.platform) {
|
|
1676
|
+
if (s.variant === Variant.NEUTRAL) return 2.2;
|
|
1677
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1678
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
|
|
1679
|
+
}
|
|
1680
|
+
return 1;
|
|
1681
|
+
},
|
|
1682
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1683
|
+
contrastCurve: s => s.isDark && "phone" === s.platform ? getCurve(11) : getCurve(9)
|
|
1684
|
+
});
|
|
1685
|
+
return extendSpecVersion(super.onSurface(), "2025", color2025);
|
|
1686
|
+
}
|
|
1687
|
+
onSurfaceVariant() {
|
|
1688
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1689
|
+
name: "on_surface_variant",
|
|
1690
|
+
palette: s => s.neutralPalette,
|
|
1691
|
+
chromaMultiplier: s => {
|
|
1692
|
+
if ("phone" === s.platform) {
|
|
1693
|
+
if (s.variant === Variant.NEUTRAL) return 2.2;
|
|
1694
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1695
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
|
|
1696
|
+
}
|
|
1697
|
+
return 1;
|
|
1698
|
+
},
|
|
1699
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1700
|
+
contrastCurve: s => "phone" === s.platform ? s.isDark ? getCurve(6) : getCurve(4.5) : getCurve(7)
|
|
1701
|
+
});
|
|
1702
|
+
return extendSpecVersion(super.onSurfaceVariant(), "2025", color2025);
|
|
1703
|
+
}
|
|
1704
|
+
outline() {
|
|
1705
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1706
|
+
name: "outline",
|
|
1707
|
+
palette: s => s.neutralPalette,
|
|
1708
|
+
chromaMultiplier: s => {
|
|
1709
|
+
if ("phone" === s.platform) {
|
|
1710
|
+
if (s.variant === Variant.NEUTRAL) return 2.2;
|
|
1711
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1712
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
|
|
1713
|
+
}
|
|
1714
|
+
return 1;
|
|
1715
|
+
},
|
|
1716
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1717
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(3) : getCurve(4.5)
|
|
1718
|
+
});
|
|
1719
|
+
return extendSpecVersion(super.outline(), "2025", color2025);
|
|
1720
|
+
}
|
|
1721
|
+
outlineVariant() {
|
|
1722
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1723
|
+
name: "outline_variant",
|
|
1724
|
+
palette: s => s.neutralPalette,
|
|
1725
|
+
chromaMultiplier: s => {
|
|
1726
|
+
if ("phone" === s.platform) {
|
|
1727
|
+
if (s.variant === Variant.NEUTRAL) return 2.2;
|
|
1728
|
+
if (s.variant === Variant.TONAL_SPOT) return 1.7;
|
|
1729
|
+
if (s.variant === Variant.EXPRESSIVE) return Hct.isYellow(s.neutralPalette.hue) ? s.isDark ? 3 : 2.3 : 1.6;
|
|
1730
|
+
}
|
|
1731
|
+
return 1;
|
|
1732
|
+
},
|
|
1733
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1734
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(1.5) : getCurve(3)
|
|
1735
|
+
});
|
|
1736
|
+
return extendSpecVersion(super.outlineVariant(), "2025", color2025);
|
|
1737
|
+
}
|
|
1738
|
+
inverseSurface() {
|
|
1739
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1740
|
+
name: "inverse_surface",
|
|
1741
|
+
palette: s => s.neutralPalette,
|
|
1742
|
+
tone: s => s.isDark ? 98 : 4,
|
|
1743
|
+
isBackground: !0
|
|
1744
|
+
});
|
|
1745
|
+
return extendSpecVersion(super.inverseSurface(), "2025", color2025);
|
|
1746
|
+
}
|
|
1747
|
+
inverseOnSurface() {
|
|
1748
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1749
|
+
name: "inverse_on_surface",
|
|
1750
|
+
palette: s => s.neutralPalette,
|
|
1751
|
+
background: s => this.inverseSurface(),
|
|
1752
|
+
contrastCurve: s => getCurve(7)
|
|
1753
|
+
});
|
|
1754
|
+
return extendSpecVersion(super.inverseOnSurface(), "2025", color2025);
|
|
1755
|
+
}
|
|
1756
|
+
primary() {
|
|
1757
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1758
|
+
name: "primary",
|
|
1759
|
+
palette: s => s.primaryPalette,
|
|
1760
|
+
tone: s => s.variant === Variant.NEUTRAL ? "phone" === s.platform ? s.isDark ? 80 : 40 : 90 : s.variant === Variant.TONAL_SPOT ? "phone" === s.platform ? s.isDark ? 80 : tMaxC(s.primaryPalette) : tMaxC(s.primaryPalette, 0, 90) : s.variant === Variant.EXPRESSIVE ? "phone" === s.platform ? tMaxC(s.primaryPalette, 0, Hct.isYellow(s.primaryPalette.hue) ? 25 : Hct.isCyan(s.primaryPalette.hue) ? 88 : 98) : tMaxC(s.primaryPalette) : "phone" === s.platform ? tMaxC(s.primaryPalette, 0, Hct.isCyan(s.primaryPalette.hue) ? 88 : 98) : tMaxC(s.primaryPalette),
|
|
1761
|
+
isBackground: !0,
|
|
1762
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1763
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
|
|
1764
|
+
toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.primaryContainer(), this.primary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
1765
|
+
});
|
|
1766
|
+
return extendSpecVersion(super.primary(), "2025", color2025);
|
|
1767
|
+
}
|
|
1768
|
+
primaryDim() {
|
|
1769
|
+
return DynamicColor.fromPalette({
|
|
1770
|
+
name: "primary_dim",
|
|
1771
|
+
palette: s => s.primaryPalette,
|
|
1772
|
+
tone: s => s.variant === Variant.NEUTRAL ? 85 : s.variant === Variant.TONAL_SPOT ? tMaxC(s.primaryPalette, 0, 90) : tMaxC(s.primaryPalette),
|
|
1773
|
+
isBackground: !0,
|
|
1774
|
+
background: s => this.surfaceContainerHigh(),
|
|
1775
|
+
contrastCurve: s => getCurve(4.5),
|
|
1776
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryDim(), this.primary(), 5, "darker", !0, "farther")
|
|
1777
|
+
});
|
|
1063
1778
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1779
|
+
onPrimary() {
|
|
1780
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1781
|
+
name: "on_primary",
|
|
1782
|
+
palette: s => s.primaryPalette,
|
|
1783
|
+
background: s => "phone" === s.platform ? this.primary() : this.primaryDim(),
|
|
1784
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1785
|
+
});
|
|
1786
|
+
return extendSpecVersion(super.onPrimary(), "2025", color2025);
|
|
1787
|
+
}
|
|
1788
|
+
primaryContainer() {
|
|
1789
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1790
|
+
name: "primary_container",
|
|
1791
|
+
palette: s => s.primaryPalette,
|
|
1792
|
+
tone: s => "watch" === s.platform ? 30 : s.variant === Variant.NEUTRAL ? s.isDark ? 30 : 90 : s.variant === Variant.TONAL_SPOT ? s.isDark ? tMinC(s.primaryPalette, 35, 93) : tMaxC(s.primaryPalette, 0, 90) : s.variant === Variant.EXPRESSIVE ? s.isDark ? tMaxC(s.primaryPalette, 30, 93) : tMaxC(s.primaryPalette, 78, Hct.isCyan(s.primaryPalette.hue) ? 88 : 90) : s.isDark ? tMinC(s.primaryPalette, 66, 93) : tMaxC(s.primaryPalette, 66, Hct.isCyan(s.primaryPalette.hue) ? 88 : 93),
|
|
1793
|
+
isBackground: !0,
|
|
1794
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
1795
|
+
toneDeltaPair: s => "phone" === s.platform ? void 0 : new ToneDeltaPair(this.primaryContainer(), this.primaryDim(), 10, "darker", !0, "farther"),
|
|
1796
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
1797
|
+
});
|
|
1798
|
+
return extendSpecVersion(super.primaryContainer(), "2025", color2025);
|
|
1799
|
+
}
|
|
1800
|
+
onPrimaryContainer() {
|
|
1801
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1802
|
+
name: "on_primary_container",
|
|
1803
|
+
palette: s => s.primaryPalette,
|
|
1804
|
+
background: s => this.primaryContainer(),
|
|
1805
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1806
|
+
});
|
|
1807
|
+
return extendSpecVersion(super.onPrimaryContainer(), "2025", color2025);
|
|
1808
|
+
}
|
|
1809
|
+
primaryFixed() {
|
|
1810
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1811
|
+
name: "primary_fixed",
|
|
1812
|
+
palette: s => s.primaryPalette,
|
|
1813
|
+
tone: s => {
|
|
1814
|
+
let tempS = Object.assign({}, s, {
|
|
1815
|
+
isDark: !1,
|
|
1816
|
+
contrastLevel: 0
|
|
1817
|
+
});
|
|
1818
|
+
return this.primaryContainer().getTone(tempS);
|
|
1819
|
+
},
|
|
1820
|
+
isBackground: !0,
|
|
1821
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
1822
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
1823
|
+
});
|
|
1824
|
+
return extendSpecVersion(super.primaryFixed(), "2025", color2025);
|
|
1825
|
+
}
|
|
1826
|
+
primaryFixedDim() {
|
|
1827
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1828
|
+
name: "primary_fixed_dim",
|
|
1829
|
+
palette: s => s.primaryPalette,
|
|
1830
|
+
tone: s => this.primaryFixed().getTone(s),
|
|
1831
|
+
isBackground: !0,
|
|
1832
|
+
toneDeltaPair: s => new ToneDeltaPair(this.primaryFixedDim(), this.primaryFixed(), 5, "darker", !0, "exact")
|
|
1833
|
+
});
|
|
1834
|
+
return extendSpecVersion(super.primaryFixedDim(), "2025", color2025);
|
|
1835
|
+
}
|
|
1836
|
+
onPrimaryFixed() {
|
|
1837
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1838
|
+
name: "on_primary_fixed",
|
|
1839
|
+
palette: s => s.primaryPalette,
|
|
1840
|
+
background: s => this.primaryFixedDim(),
|
|
1841
|
+
contrastCurve: s => getCurve(7)
|
|
1842
|
+
});
|
|
1843
|
+
return extendSpecVersion(super.onPrimaryFixed(), "2025", color2025);
|
|
1844
|
+
}
|
|
1845
|
+
onPrimaryFixedVariant() {
|
|
1846
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1847
|
+
name: "on_primary_fixed_variant",
|
|
1848
|
+
palette: s => s.primaryPalette,
|
|
1849
|
+
background: s => this.primaryFixedDim(),
|
|
1850
|
+
contrastCurve: s => getCurve(4.5)
|
|
1851
|
+
});
|
|
1852
|
+
return extendSpecVersion(super.onPrimaryFixedVariant(), "2025", color2025);
|
|
1853
|
+
}
|
|
1854
|
+
inversePrimary() {
|
|
1855
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1856
|
+
name: "inverse_primary",
|
|
1857
|
+
palette: s => s.primaryPalette,
|
|
1858
|
+
tone: s => tMaxC(s.primaryPalette),
|
|
1859
|
+
background: s => this.inverseSurface(),
|
|
1860
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1861
|
+
});
|
|
1862
|
+
return extendSpecVersion(super.inversePrimary(), "2025", color2025);
|
|
1863
|
+
}
|
|
1864
|
+
secondary() {
|
|
1865
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1866
|
+
name: "secondary",
|
|
1867
|
+
palette: s => s.secondaryPalette,
|
|
1868
|
+
tone: s => "watch" === s.platform ? s.variant === Variant.NEUTRAL ? 90 : tMaxC(s.secondaryPalette, 0, 90) : s.variant === Variant.NEUTRAL ? s.isDark ? tMinC(s.secondaryPalette, 0, 98) : tMaxC(s.secondaryPalette) : s.variant === Variant.VIBRANT ? tMaxC(s.secondaryPalette, 0, s.isDark ? 90 : 98) : s.isDark ? 80 : tMaxC(s.secondaryPalette),
|
|
1869
|
+
isBackground: !0,
|
|
1870
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1871
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
|
|
1872
|
+
toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.secondaryContainer(), this.secondary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
1873
|
+
});
|
|
1874
|
+
return extendSpecVersion(super.secondary(), "2025", color2025);
|
|
1875
|
+
}
|
|
1876
|
+
secondaryDim() {
|
|
1877
|
+
return DynamicColor.fromPalette({
|
|
1878
|
+
name: "secondary_dim",
|
|
1879
|
+
palette: s => s.secondaryPalette,
|
|
1880
|
+
tone: s => s.variant === Variant.NEUTRAL ? 85 : tMaxC(s.secondaryPalette, 0, 90),
|
|
1881
|
+
isBackground: !0,
|
|
1882
|
+
background: s => this.surfaceContainerHigh(),
|
|
1883
|
+
contrastCurve: s => getCurve(4.5),
|
|
1884
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryDim(), this.secondary(), 5, "darker", !0, "farther")
|
|
1885
|
+
});
|
|
1066
1886
|
}
|
|
1067
|
-
|
|
1068
|
-
|
|
1887
|
+
onSecondary() {
|
|
1888
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1889
|
+
name: "on_secondary",
|
|
1890
|
+
palette: s => s.secondaryPalette,
|
|
1891
|
+
background: s => "phone" === s.platform ? this.secondary() : this.secondaryDim(),
|
|
1892
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1893
|
+
});
|
|
1894
|
+
return extendSpecVersion(super.onSecondary(), "2025", color2025);
|
|
1895
|
+
}
|
|
1896
|
+
secondaryContainer() {
|
|
1897
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1898
|
+
name: "secondary_container",
|
|
1899
|
+
palette: s => s.secondaryPalette,
|
|
1900
|
+
tone: s => "watch" === s.platform ? 30 : s.variant === Variant.VIBRANT ? s.isDark ? tMinC(s.secondaryPalette, 30, 40) : tMaxC(s.secondaryPalette, 84, 90) : s.variant === Variant.EXPRESSIVE ? s.isDark ? 15 : tMaxC(s.secondaryPalette, 90, 95) : s.isDark ? 25 : 90,
|
|
1901
|
+
isBackground: !0,
|
|
1902
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
1903
|
+
toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.secondaryContainer(), this.secondaryDim(), 10, "darker", !0, "farther") : void 0,
|
|
1904
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
1905
|
+
});
|
|
1906
|
+
return extendSpecVersion(super.secondaryContainer(), "2025", color2025);
|
|
1907
|
+
}
|
|
1908
|
+
onSecondaryContainer() {
|
|
1909
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1910
|
+
name: "on_secondary_container",
|
|
1911
|
+
palette: s => s.secondaryPalette,
|
|
1912
|
+
background: s => this.secondaryContainer(),
|
|
1913
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1914
|
+
});
|
|
1915
|
+
return extendSpecVersion(super.onSecondaryContainer(), "2025", color2025);
|
|
1916
|
+
}
|
|
1917
|
+
secondaryFixed() {
|
|
1918
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1919
|
+
name: "secondary_fixed",
|
|
1920
|
+
palette: s => s.secondaryPalette,
|
|
1921
|
+
tone: s => {
|
|
1922
|
+
let tempS = Object.assign({}, s, {
|
|
1923
|
+
isDark: !1,
|
|
1924
|
+
contrastLevel: 0
|
|
1925
|
+
});
|
|
1926
|
+
return this.secondaryContainer().getTone(tempS);
|
|
1927
|
+
},
|
|
1928
|
+
isBackground: !0,
|
|
1929
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
1930
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
1931
|
+
});
|
|
1932
|
+
return extendSpecVersion(super.secondaryFixed(), "2025", color2025);
|
|
1933
|
+
}
|
|
1934
|
+
secondaryFixedDim() {
|
|
1935
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1936
|
+
name: "secondary_fixed_dim",
|
|
1937
|
+
palette: s => s.secondaryPalette,
|
|
1938
|
+
tone: s => this.secondaryFixed().getTone(s),
|
|
1939
|
+
isBackground: !0,
|
|
1940
|
+
toneDeltaPair: s => new ToneDeltaPair(this.secondaryFixedDim(), this.secondaryFixed(), 5, "darker", !0, "exact")
|
|
1941
|
+
});
|
|
1942
|
+
return extendSpecVersion(super.secondaryFixedDim(), "2025", color2025);
|
|
1943
|
+
}
|
|
1944
|
+
onSecondaryFixed() {
|
|
1945
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1946
|
+
name: "on_secondary_fixed",
|
|
1947
|
+
palette: s => s.secondaryPalette,
|
|
1948
|
+
background: s => this.secondaryFixedDim(),
|
|
1949
|
+
contrastCurve: s => getCurve(7)
|
|
1950
|
+
});
|
|
1951
|
+
return extendSpecVersion(super.onSecondaryFixed(), "2025", color2025);
|
|
1952
|
+
}
|
|
1953
|
+
onSecondaryFixedVariant() {
|
|
1954
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1955
|
+
name: "on_secondary_fixed_variant",
|
|
1956
|
+
palette: s => s.secondaryPalette,
|
|
1957
|
+
background: s => this.secondaryFixedDim(),
|
|
1958
|
+
contrastCurve: s => getCurve(4.5)
|
|
1959
|
+
});
|
|
1960
|
+
return extendSpecVersion(super.onSecondaryFixedVariant(), "2025", color2025);
|
|
1961
|
+
}
|
|
1962
|
+
tertiary() {
|
|
1963
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1964
|
+
name: "tertiary",
|
|
1965
|
+
palette: s => s.tertiaryPalette,
|
|
1966
|
+
tone: s => "watch" === s.platform ? s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette) : s.variant === Variant.EXPRESSIVE || s.variant === Variant.VIBRANT ? tMaxC(s.tertiaryPalette, 0, Hct.isCyan(s.tertiaryPalette.hue) ? 88 : s.isDark ? 98 : 100) : s.isDark ? tMaxC(s.tertiaryPalette, 0, 98) : tMaxC(s.tertiaryPalette),
|
|
1967
|
+
isBackground: !0,
|
|
1968
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
1969
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
|
|
1970
|
+
toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.tertiaryContainer(), this.tertiary(), 5, "relative_lighter", !0, "farther") : void 0
|
|
1971
|
+
});
|
|
1972
|
+
return extendSpecVersion(super.tertiary(), "2025", color2025);
|
|
1973
|
+
}
|
|
1974
|
+
tertiaryDim() {
|
|
1975
|
+
return DynamicColor.fromPalette({
|
|
1976
|
+
name: "tertiary_dim",
|
|
1977
|
+
palette: s => s.tertiaryPalette,
|
|
1978
|
+
tone: s => s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette),
|
|
1979
|
+
isBackground: !0,
|
|
1980
|
+
background: s => this.surfaceContainerHigh(),
|
|
1981
|
+
contrastCurve: s => getCurve(4.5),
|
|
1982
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryDim(), this.tertiary(), 5, "darker", !0, "farther")
|
|
1983
|
+
});
|
|
1069
1984
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1985
|
+
onTertiary() {
|
|
1986
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1987
|
+
name: "on_tertiary",
|
|
1988
|
+
palette: s => s.tertiaryPalette,
|
|
1989
|
+
background: s => "phone" === s.platform ? this.tertiary() : this.tertiaryDim(),
|
|
1990
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
1991
|
+
});
|
|
1992
|
+
return extendSpecVersion(super.onTertiary(), "2025", color2025);
|
|
1993
|
+
}
|
|
1994
|
+
tertiaryContainer() {
|
|
1995
|
+
const color2025 = DynamicColor.fromPalette({
|
|
1996
|
+
name: "tertiary_container",
|
|
1997
|
+
palette: s => s.tertiaryPalette,
|
|
1998
|
+
tone: s => "watch" === s.platform ? s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, 90) : tMaxC(s.tertiaryPalette) : s.variant === Variant.NEUTRAL ? s.isDark ? tMaxC(s.tertiaryPalette, 0, 93) : tMaxC(s.tertiaryPalette, 0, 96) : s.variant === Variant.TONAL_SPOT ? tMaxC(s.tertiaryPalette, 0, s.isDark ? 93 : 100) : s.variant === Variant.EXPRESSIVE ? tMaxC(s.tertiaryPalette, 75, Hct.isCyan(s.tertiaryPalette.hue) ? 88 : s.isDark ? 93 : 100) : s.isDark ? tMaxC(s.tertiaryPalette, 0, 93) : tMaxC(s.tertiaryPalette, 72, 100),
|
|
1999
|
+
isBackground: !0,
|
|
2000
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
2001
|
+
toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.tertiaryContainer(), this.tertiaryDim(), 10, "darker", !0, "farther") : void 0,
|
|
2002
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
2003
|
+
});
|
|
2004
|
+
return extendSpecVersion(super.tertiaryContainer(), "2025", color2025);
|
|
2005
|
+
}
|
|
2006
|
+
onTertiaryContainer() {
|
|
2007
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2008
|
+
name: "on_tertiary_container",
|
|
2009
|
+
palette: s => s.tertiaryPalette,
|
|
2010
|
+
background: s => this.tertiaryContainer(),
|
|
2011
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
2012
|
+
});
|
|
2013
|
+
return extendSpecVersion(super.onTertiaryContainer(), "2025", color2025);
|
|
2014
|
+
}
|
|
2015
|
+
tertiaryFixed() {
|
|
2016
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2017
|
+
name: "tertiary_fixed",
|
|
2018
|
+
palette: s => s.tertiaryPalette,
|
|
2019
|
+
tone: s => {
|
|
2020
|
+
let tempS = Object.assign({}, s, {
|
|
2021
|
+
isDark: !1,
|
|
2022
|
+
contrastLevel: 0
|
|
2023
|
+
});
|
|
2024
|
+
return this.tertiaryContainer().getTone(tempS);
|
|
2025
|
+
},
|
|
2026
|
+
isBackground: !0,
|
|
2027
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
2028
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
2029
|
+
});
|
|
2030
|
+
return extendSpecVersion(super.tertiaryFixed(), "2025", color2025);
|
|
2031
|
+
}
|
|
2032
|
+
tertiaryFixedDim() {
|
|
2033
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2034
|
+
name: "tertiary_fixed_dim",
|
|
2035
|
+
palette: s => s.tertiaryPalette,
|
|
2036
|
+
tone: s => this.tertiaryFixed().getTone(s),
|
|
2037
|
+
isBackground: !0,
|
|
2038
|
+
toneDeltaPair: s => new ToneDeltaPair(this.tertiaryFixedDim(), this.tertiaryFixed(), 5, "darker", !0, "exact")
|
|
2039
|
+
});
|
|
2040
|
+
return extendSpecVersion(super.tertiaryFixedDim(), "2025", color2025);
|
|
2041
|
+
}
|
|
2042
|
+
onTertiaryFixed() {
|
|
2043
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2044
|
+
name: "on_tertiary_fixed",
|
|
2045
|
+
palette: s => s.tertiaryPalette,
|
|
2046
|
+
background: s => this.tertiaryFixedDim(),
|
|
2047
|
+
contrastCurve: s => getCurve(7)
|
|
2048
|
+
});
|
|
2049
|
+
return extendSpecVersion(super.onTertiaryFixed(), "2025", color2025);
|
|
2050
|
+
}
|
|
2051
|
+
onTertiaryFixedVariant() {
|
|
2052
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2053
|
+
name: "on_tertiary_fixed_variant",
|
|
2054
|
+
palette: s => s.tertiaryPalette,
|
|
2055
|
+
background: s => this.tertiaryFixedDim(),
|
|
2056
|
+
contrastCurve: s => getCurve(4.5)
|
|
2057
|
+
});
|
|
2058
|
+
return extendSpecVersion(super.onTertiaryFixedVariant(), "2025", color2025);
|
|
2059
|
+
}
|
|
2060
|
+
error() {
|
|
2061
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2062
|
+
name: "error",
|
|
2063
|
+
palette: s => s.errorPalette,
|
|
2064
|
+
tone: s => "phone" === s.platform ? s.isDark ? tMinC(s.errorPalette, 0, 98) : tMaxC(s.errorPalette) : tMinC(s.errorPalette),
|
|
2065
|
+
isBackground: !0,
|
|
2066
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : this.surfaceContainerHigh(),
|
|
2067
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7),
|
|
2068
|
+
toneDeltaPair: s => "phone" === s.platform ? new ToneDeltaPair(this.errorContainer(), this.error(), 5, "relative_lighter", !0, "farther") : void 0
|
|
2069
|
+
});
|
|
2070
|
+
return extendSpecVersion(super.error(), "2025", color2025);
|
|
2071
|
+
}
|
|
2072
|
+
errorDim() {
|
|
2073
|
+
return DynamicColor.fromPalette({
|
|
2074
|
+
name: "error_dim",
|
|
2075
|
+
palette: s => s.errorPalette,
|
|
2076
|
+
tone: s => tMinC(s.errorPalette),
|
|
2077
|
+
isBackground: !0,
|
|
2078
|
+
background: s => this.surfaceContainerHigh(),
|
|
2079
|
+
contrastCurve: s => getCurve(4.5),
|
|
2080
|
+
toneDeltaPair: s => new ToneDeltaPair(this.errorDim(), this.error(), 5, "darker", !0, "farther")
|
|
2081
|
+
});
|
|
1083
2082
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
2083
|
+
onError() {
|
|
2084
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2085
|
+
name: "on_error",
|
|
2086
|
+
palette: s => s.errorPalette,
|
|
2087
|
+
background: s => "phone" === s.platform ? this.error() : this.errorDim(),
|
|
2088
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(6) : getCurve(7)
|
|
2089
|
+
});
|
|
2090
|
+
return extendSpecVersion(super.onError(), "2025", color2025);
|
|
2091
|
+
}
|
|
2092
|
+
errorContainer() {
|
|
2093
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2094
|
+
name: "error_container",
|
|
2095
|
+
palette: s => s.errorPalette,
|
|
2096
|
+
tone: s => "watch" === s.platform ? 30 : s.isDark ? tMinC(s.errorPalette, 30, 93) : tMaxC(s.errorPalette, 0, 90),
|
|
2097
|
+
isBackground: !0,
|
|
2098
|
+
background: s => "phone" === s.platform ? this.highestSurface(s) : void 0,
|
|
2099
|
+
toneDeltaPair: s => "watch" === s.platform ? new ToneDeltaPair(this.errorContainer(), this.errorDim(), 10, "darker", !0, "farther") : void 0,
|
|
2100
|
+
contrastCurve: s => "phone" === s.platform && s.contrastLevel > 0 ? getCurve(1.5) : void 0
|
|
2101
|
+
});
|
|
2102
|
+
return extendSpecVersion(super.errorContainer(), "2025", color2025);
|
|
2103
|
+
}
|
|
2104
|
+
onErrorContainer() {
|
|
2105
|
+
const color2025 = DynamicColor.fromPalette({
|
|
2106
|
+
name: "on_error_container",
|
|
2107
|
+
palette: s => s.errorPalette,
|
|
2108
|
+
background: s => this.errorContainer(),
|
|
2109
|
+
contrastCurve: s => "phone" === s.platform ? getCurve(4.5) : getCurve(7)
|
|
2110
|
+
});
|
|
2111
|
+
return extendSpecVersion(super.onErrorContainer(), "2025", color2025);
|
|
1087
2112
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
2113
|
+
surfaceVariant() {
|
|
2114
|
+
const color2025 = Object.assign(this.surfaceContainerHighest().clone(), {
|
|
2115
|
+
name: "surface_variant"
|
|
2116
|
+
});
|
|
2117
|
+
return extendSpecVersion(super.surfaceVariant(), "2025", color2025);
|
|
2118
|
+
}
|
|
2119
|
+
surfaceTint() {
|
|
2120
|
+
const color2025 = Object.assign(this.primary().clone(), {
|
|
2121
|
+
name: "surface_tint"
|
|
2122
|
+
});
|
|
2123
|
+
return extendSpecVersion(super.surfaceTint(), "2025", color2025);
|
|
2124
|
+
}
|
|
2125
|
+
background() {
|
|
2126
|
+
const color2025 = Object.assign(this.surface().clone(), {
|
|
2127
|
+
name: "background"
|
|
2128
|
+
});
|
|
2129
|
+
return extendSpecVersion(super.background(), "2025", color2025);
|
|
2130
|
+
}
|
|
2131
|
+
onBackground() {
|
|
2132
|
+
const color2025 = Object.assign(this.onSurface().clone(), {
|
|
2133
|
+
name: "on_background",
|
|
2134
|
+
tone: s => "watch" === s.platform ? 100 : this.onSurface().getTone(s)
|
|
2135
|
+
});
|
|
2136
|
+
return extendSpecVersion(super.onBackground(), "2025", color2025);
|
|
1090
2137
|
}
|
|
1091
2138
|
}
|
|
1092
|
-
class
|
|
1093
|
-
|
|
1094
|
-
|
|
2139
|
+
class MaterialDynamicColors {
|
|
2140
|
+
constructor() {
|
|
2141
|
+
this.allColors = [this.background(), this.onBackground(), this.surface(), this.surfaceDim(), this.surfaceBright(), this.surfaceContainerLowest(), this.surfaceContainerLow(), this.surfaceContainer(), this.surfaceContainerHigh(), this.surfaceContainerHighest(), this.onSurface(), this.onSurfaceVariant(), this.outline(), this.outlineVariant(), this.inverseSurface(), this.inverseOnSurface(), this.primary(), this.primaryDim(), this.onPrimary(), this.primaryContainer(), this.onPrimaryContainer(), this.primaryFixed(), this.primaryFixedDim(), this.onPrimaryFixed(), this.onPrimaryFixedVariant(), this.inversePrimary(), this.secondary(), this.secondaryDim(), this.onSecondary(), this.secondaryContainer(), this.onSecondaryContainer(), this.secondaryFixed(), this.secondaryFixedDim(), this.onSecondaryFixed(), this.onSecondaryFixedVariant(), this.tertiary(), this.tertiaryDim(), this.onTertiary(), this.tertiaryContainer(), this.onTertiaryContainer(), this.tertiaryFixed(), this.tertiaryFixedDim(), this.onTertiaryFixed(), this.onTertiaryFixedVariant(), this.error(), this.errorDim(), this.onError(), this.errorContainer(), this.onErrorContainer()].filter(c => void 0 !== c);
|
|
1095
2142
|
}
|
|
1096
|
-
|
|
1097
|
-
return
|
|
2143
|
+
highestSurface(s) {
|
|
2144
|
+
return MaterialDynamicColors.colorSpec.highestSurface(s);
|
|
1098
2145
|
}
|
|
1099
|
-
|
|
1100
|
-
return
|
|
2146
|
+
primaryPaletteKeyColor() {
|
|
2147
|
+
return MaterialDynamicColors.colorSpec.primaryPaletteKeyColor();
|
|
1101
2148
|
}
|
|
1102
|
-
|
|
1103
|
-
return
|
|
2149
|
+
secondaryPaletteKeyColor() {
|
|
2150
|
+
return MaterialDynamicColors.colorSpec.secondaryPaletteKeyColor();
|
|
1104
2151
|
}
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
return
|
|
2152
|
+
tertiaryPaletteKeyColor() {
|
|
2153
|
+
return MaterialDynamicColors.colorSpec.tertiaryPaletteKeyColor();
|
|
2154
|
+
}
|
|
2155
|
+
neutralPaletteKeyColor() {
|
|
2156
|
+
return MaterialDynamicColors.colorSpec.neutralPaletteKeyColor();
|
|
2157
|
+
}
|
|
2158
|
+
neutralVariantPaletteKeyColor() {
|
|
2159
|
+
return MaterialDynamicColors.colorSpec.neutralVariantPaletteKeyColor();
|
|
2160
|
+
}
|
|
2161
|
+
errorPaletteKeyColor() {
|
|
2162
|
+
return MaterialDynamicColors.colorSpec.errorPaletteKeyColor();
|
|
2163
|
+
}
|
|
2164
|
+
background() {
|
|
2165
|
+
return MaterialDynamicColors.colorSpec.background();
|
|
2166
|
+
}
|
|
2167
|
+
onBackground() {
|
|
2168
|
+
return MaterialDynamicColors.colorSpec.onBackground();
|
|
2169
|
+
}
|
|
2170
|
+
surface() {
|
|
2171
|
+
return MaterialDynamicColors.colorSpec.surface();
|
|
2172
|
+
}
|
|
2173
|
+
surfaceDim() {
|
|
2174
|
+
return MaterialDynamicColors.colorSpec.surfaceDim();
|
|
2175
|
+
}
|
|
2176
|
+
surfaceBright() {
|
|
2177
|
+
return MaterialDynamicColors.colorSpec.surfaceBright();
|
|
2178
|
+
}
|
|
2179
|
+
surfaceContainerLowest() {
|
|
2180
|
+
return MaterialDynamicColors.colorSpec.surfaceContainerLowest();
|
|
2181
|
+
}
|
|
2182
|
+
surfaceContainerLow() {
|
|
2183
|
+
return MaterialDynamicColors.colorSpec.surfaceContainerLow();
|
|
2184
|
+
}
|
|
2185
|
+
surfaceContainer() {
|
|
2186
|
+
return MaterialDynamicColors.colorSpec.surfaceContainer();
|
|
2187
|
+
}
|
|
2188
|
+
surfaceContainerHigh() {
|
|
2189
|
+
return MaterialDynamicColors.colorSpec.surfaceContainerHigh();
|
|
2190
|
+
}
|
|
2191
|
+
surfaceContainerHighest() {
|
|
2192
|
+
return MaterialDynamicColors.colorSpec.surfaceContainerHighest();
|
|
2193
|
+
}
|
|
2194
|
+
onSurface() {
|
|
2195
|
+
return MaterialDynamicColors.colorSpec.onSurface();
|
|
2196
|
+
}
|
|
2197
|
+
surfaceVariant() {
|
|
2198
|
+
return MaterialDynamicColors.colorSpec.surfaceVariant();
|
|
2199
|
+
}
|
|
2200
|
+
onSurfaceVariant() {
|
|
2201
|
+
return MaterialDynamicColors.colorSpec.onSurfaceVariant();
|
|
2202
|
+
}
|
|
2203
|
+
outline() {
|
|
2204
|
+
return MaterialDynamicColors.colorSpec.outline();
|
|
2205
|
+
}
|
|
2206
|
+
outlineVariant() {
|
|
2207
|
+
return MaterialDynamicColors.colorSpec.outlineVariant();
|
|
2208
|
+
}
|
|
2209
|
+
inverseSurface() {
|
|
2210
|
+
return MaterialDynamicColors.colorSpec.inverseSurface();
|
|
2211
|
+
}
|
|
2212
|
+
inverseOnSurface() {
|
|
2213
|
+
return MaterialDynamicColors.colorSpec.inverseOnSurface();
|
|
2214
|
+
}
|
|
2215
|
+
shadow() {
|
|
2216
|
+
return MaterialDynamicColors.colorSpec.shadow();
|
|
2217
|
+
}
|
|
2218
|
+
scrim() {
|
|
2219
|
+
return MaterialDynamicColors.colorSpec.scrim();
|
|
2220
|
+
}
|
|
2221
|
+
surfaceTint() {
|
|
2222
|
+
return MaterialDynamicColors.colorSpec.surfaceTint();
|
|
2223
|
+
}
|
|
2224
|
+
primary() {
|
|
2225
|
+
return MaterialDynamicColors.colorSpec.primary();
|
|
2226
|
+
}
|
|
2227
|
+
primaryDim() {
|
|
2228
|
+
return MaterialDynamicColors.colorSpec.primaryDim();
|
|
2229
|
+
}
|
|
2230
|
+
onPrimary() {
|
|
2231
|
+
return MaterialDynamicColors.colorSpec.onPrimary();
|
|
2232
|
+
}
|
|
2233
|
+
primaryContainer() {
|
|
2234
|
+
return MaterialDynamicColors.colorSpec.primaryContainer();
|
|
2235
|
+
}
|
|
2236
|
+
onPrimaryContainer() {
|
|
2237
|
+
return MaterialDynamicColors.colorSpec.onPrimaryContainer();
|
|
2238
|
+
}
|
|
2239
|
+
inversePrimary() {
|
|
2240
|
+
return MaterialDynamicColors.colorSpec.inversePrimary();
|
|
2241
|
+
}
|
|
2242
|
+
primaryFixed() {
|
|
2243
|
+
return MaterialDynamicColors.colorSpec.primaryFixed();
|
|
2244
|
+
}
|
|
2245
|
+
primaryFixedDim() {
|
|
2246
|
+
return MaterialDynamicColors.colorSpec.primaryFixedDim();
|
|
2247
|
+
}
|
|
2248
|
+
onPrimaryFixed() {
|
|
2249
|
+
return MaterialDynamicColors.colorSpec.onPrimaryFixed();
|
|
2250
|
+
}
|
|
2251
|
+
onPrimaryFixedVariant() {
|
|
2252
|
+
return MaterialDynamicColors.colorSpec.onPrimaryFixedVariant();
|
|
2253
|
+
}
|
|
2254
|
+
secondary() {
|
|
2255
|
+
return MaterialDynamicColors.colorSpec.secondary();
|
|
2256
|
+
}
|
|
2257
|
+
secondaryDim() {
|
|
2258
|
+
return MaterialDynamicColors.colorSpec.secondaryDim();
|
|
2259
|
+
}
|
|
2260
|
+
onSecondary() {
|
|
2261
|
+
return MaterialDynamicColors.colorSpec.onSecondary();
|
|
2262
|
+
}
|
|
2263
|
+
secondaryContainer() {
|
|
2264
|
+
return MaterialDynamicColors.colorSpec.secondaryContainer();
|
|
2265
|
+
}
|
|
2266
|
+
onSecondaryContainer() {
|
|
2267
|
+
return MaterialDynamicColors.colorSpec.onSecondaryContainer();
|
|
2268
|
+
}
|
|
2269
|
+
secondaryFixed() {
|
|
2270
|
+
return MaterialDynamicColors.colorSpec.secondaryFixed();
|
|
2271
|
+
}
|
|
2272
|
+
secondaryFixedDim() {
|
|
2273
|
+
return MaterialDynamicColors.colorSpec.secondaryFixedDim();
|
|
2274
|
+
}
|
|
2275
|
+
onSecondaryFixed() {
|
|
2276
|
+
return MaterialDynamicColors.colorSpec.onSecondaryFixed();
|
|
2277
|
+
}
|
|
2278
|
+
onSecondaryFixedVariant() {
|
|
2279
|
+
return MaterialDynamicColors.colorSpec.onSecondaryFixedVariant();
|
|
2280
|
+
}
|
|
2281
|
+
tertiary() {
|
|
2282
|
+
return MaterialDynamicColors.colorSpec.tertiary();
|
|
2283
|
+
}
|
|
2284
|
+
tertiaryDim() {
|
|
2285
|
+
return MaterialDynamicColors.colorSpec.tertiaryDim();
|
|
2286
|
+
}
|
|
2287
|
+
onTertiary() {
|
|
2288
|
+
return MaterialDynamicColors.colorSpec.onTertiary();
|
|
2289
|
+
}
|
|
2290
|
+
tertiaryContainer() {
|
|
2291
|
+
return MaterialDynamicColors.colorSpec.tertiaryContainer();
|
|
2292
|
+
}
|
|
2293
|
+
onTertiaryContainer() {
|
|
2294
|
+
return MaterialDynamicColors.colorSpec.onTertiaryContainer();
|
|
2295
|
+
}
|
|
2296
|
+
tertiaryFixed() {
|
|
2297
|
+
return MaterialDynamicColors.colorSpec.tertiaryFixed();
|
|
1128
2298
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
2299
|
+
tertiaryFixedDim() {
|
|
2300
|
+
return MaterialDynamicColors.colorSpec.tertiaryFixedDim();
|
|
2301
|
+
}
|
|
2302
|
+
onTertiaryFixed() {
|
|
2303
|
+
return MaterialDynamicColors.colorSpec.onTertiaryFixed();
|
|
2304
|
+
}
|
|
2305
|
+
onTertiaryFixedVariant() {
|
|
2306
|
+
return MaterialDynamicColors.colorSpec.onTertiaryFixedVariant();
|
|
2307
|
+
}
|
|
2308
|
+
error() {
|
|
2309
|
+
return MaterialDynamicColors.colorSpec.error();
|
|
2310
|
+
}
|
|
2311
|
+
errorDim() {
|
|
2312
|
+
return MaterialDynamicColors.colorSpec.errorDim();
|
|
2313
|
+
}
|
|
2314
|
+
onError() {
|
|
2315
|
+
return MaterialDynamicColors.colorSpec.onError();
|
|
2316
|
+
}
|
|
2317
|
+
errorContainer() {
|
|
2318
|
+
return MaterialDynamicColors.colorSpec.errorContainer();
|
|
2319
|
+
}
|
|
2320
|
+
onErrorContainer() {
|
|
2321
|
+
return MaterialDynamicColors.colorSpec.onErrorContainer();
|
|
2322
|
+
}
|
|
2323
|
+
static highestSurface(s) {
|
|
2324
|
+
return MaterialDynamicColors.colorSpec.highestSurface(s);
|
|
1134
2325
|
}
|
|
1135
2326
|
}
|
|
1136
|
-
|
|
2327
|
+
MaterialDynamicColors.contentAccentToneDelta = 15, MaterialDynamicColors.colorSpec = new ColorSpecDelegateImpl2025(), MaterialDynamicColors.primaryPaletteKeyColor = MaterialDynamicColors.colorSpec.primaryPaletteKeyColor(), MaterialDynamicColors.secondaryPaletteKeyColor = MaterialDynamicColors.colorSpec.secondaryPaletteKeyColor(), MaterialDynamicColors.tertiaryPaletteKeyColor = MaterialDynamicColors.colorSpec.tertiaryPaletteKeyColor(), MaterialDynamicColors.neutralPaletteKeyColor = MaterialDynamicColors.colorSpec.neutralPaletteKeyColor(), MaterialDynamicColors.neutralVariantPaletteKeyColor = MaterialDynamicColors.colorSpec.neutralVariantPaletteKeyColor(), MaterialDynamicColors.background = MaterialDynamicColors.colorSpec.background(), MaterialDynamicColors.onBackground = MaterialDynamicColors.colorSpec.onBackground(), MaterialDynamicColors.surface = MaterialDynamicColors.colorSpec.surface(), MaterialDynamicColors.surfaceDim = MaterialDynamicColors.colorSpec.surfaceDim(), MaterialDynamicColors.surfaceBright = MaterialDynamicColors.colorSpec.surfaceBright(), MaterialDynamicColors.surfaceContainerLowest = MaterialDynamicColors.colorSpec.surfaceContainerLowest(), MaterialDynamicColors.surfaceContainerLow = MaterialDynamicColors.colorSpec.surfaceContainerLow(), MaterialDynamicColors.surfaceContainer = MaterialDynamicColors.colorSpec.surfaceContainer(), MaterialDynamicColors.surfaceContainerHigh = MaterialDynamicColors.colorSpec.surfaceContainerHigh(), MaterialDynamicColors.surfaceContainerHighest = MaterialDynamicColors.colorSpec.surfaceContainerHighest(), MaterialDynamicColors.onSurface = MaterialDynamicColors.colorSpec.onSurface(), MaterialDynamicColors.surfaceVariant = MaterialDynamicColors.colorSpec.surfaceVariant(), MaterialDynamicColors.onSurfaceVariant = MaterialDynamicColors.colorSpec.onSurfaceVariant(), MaterialDynamicColors.inverseSurface = MaterialDynamicColors.colorSpec.inverseSurface(), MaterialDynamicColors.inverseOnSurface = MaterialDynamicColors.colorSpec.inverseOnSurface(), MaterialDynamicColors.outline = MaterialDynamicColors.colorSpec.outline(), MaterialDynamicColors.outlineVariant = MaterialDynamicColors.colorSpec.outlineVariant(), MaterialDynamicColors.shadow = MaterialDynamicColors.colorSpec.shadow(), MaterialDynamicColors.scrim = MaterialDynamicColors.colorSpec.scrim(), MaterialDynamicColors.surfaceTint = MaterialDynamicColors.colorSpec.surfaceTint(), MaterialDynamicColors.primary = MaterialDynamicColors.colorSpec.primary(), MaterialDynamicColors.onPrimary = MaterialDynamicColors.colorSpec.onPrimary(), MaterialDynamicColors.primaryContainer = MaterialDynamicColors.colorSpec.primaryContainer(), MaterialDynamicColors.onPrimaryContainer = MaterialDynamicColors.colorSpec.onPrimaryContainer(), MaterialDynamicColors.inversePrimary = MaterialDynamicColors.colorSpec.inversePrimary(), MaterialDynamicColors.secondary = MaterialDynamicColors.colorSpec.secondary(), MaterialDynamicColors.onSecondary = MaterialDynamicColors.colorSpec.onSecondary(), MaterialDynamicColors.secondaryContainer = MaterialDynamicColors.colorSpec.secondaryContainer(), MaterialDynamicColors.onSecondaryContainer = MaterialDynamicColors.colorSpec.onSecondaryContainer(), MaterialDynamicColors.tertiary = MaterialDynamicColors.colorSpec.tertiary(), MaterialDynamicColors.onTertiary = MaterialDynamicColors.colorSpec.onTertiary(), MaterialDynamicColors.tertiaryContainer = MaterialDynamicColors.colorSpec.tertiaryContainer(), MaterialDynamicColors.onTertiaryContainer = MaterialDynamicColors.colorSpec.onTertiaryContainer(), MaterialDynamicColors.error = MaterialDynamicColors.colorSpec.error(), MaterialDynamicColors.onError = MaterialDynamicColors.colorSpec.onError(), MaterialDynamicColors.errorContainer = MaterialDynamicColors.colorSpec.errorContainer(), MaterialDynamicColors.onErrorContainer = MaterialDynamicColors.colorSpec.onErrorContainer(), MaterialDynamicColors.primaryFixed = MaterialDynamicColors.colorSpec.primaryFixed(), MaterialDynamicColors.primaryFixedDim = MaterialDynamicColors.colorSpec.primaryFixedDim(), MaterialDynamicColors.onPrimaryFixed = MaterialDynamicColors.colorSpec.onPrimaryFixed(), MaterialDynamicColors.onPrimaryFixedVariant = MaterialDynamicColors.colorSpec.onPrimaryFixedVariant(), MaterialDynamicColors.secondaryFixed = MaterialDynamicColors.colorSpec.secondaryFixed(), MaterialDynamicColors.secondaryFixedDim = MaterialDynamicColors.colorSpec.secondaryFixedDim(), MaterialDynamicColors.onSecondaryFixed = MaterialDynamicColors.colorSpec.onSecondaryFixed(), MaterialDynamicColors.onSecondaryFixedVariant = MaterialDynamicColors.colorSpec.onSecondaryFixedVariant(), MaterialDynamicColors.tertiaryFixed = MaterialDynamicColors.colorSpec.tertiaryFixed(), MaterialDynamicColors.tertiaryFixedDim = MaterialDynamicColors.colorSpec.tertiaryFixedDim(), MaterialDynamicColors.onTertiaryFixed = MaterialDynamicColors.colorSpec.onTertiaryFixed(), MaterialDynamicColors.onTertiaryFixedVariant = MaterialDynamicColors.colorSpec.onTertiaryFixedVariant();
|
|
2328
|
+
class DynamicScheme {
|
|
2329
|
+
static maybeFallbackSpecVersion(specVersion, variant) {
|
|
2330
|
+
switch (variant) {
|
|
2331
|
+
case Variant.EXPRESSIVE:
|
|
2332
|
+
case Variant.VIBRANT:
|
|
2333
|
+
case Variant.TONAL_SPOT:
|
|
2334
|
+
case Variant.NEUTRAL:
|
|
2335
|
+
return specVersion;
|
|
2336
|
+
default:
|
|
2337
|
+
return "2021";
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
constructor(args) {
|
|
2341
|
+
this.sourceColorArgb = args.sourceColorHct.toInt(), this.variant = args.variant, this.contrastLevel = args.contrastLevel, this.isDark = args.isDark, this.platform = args.platform ?? "phone", this.specVersion = DynamicScheme.maybeFallbackSpecVersion(args.specVersion ?? "2021", this.variant), this.sourceColorHct = args.sourceColorHct, this.primaryPalette = args.primaryPalette ?? getSpec(this.specVersion).getPrimaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.secondaryPalette = args.secondaryPalette ?? getSpec(this.specVersion).getSecondaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.tertiaryPalette = args.tertiaryPalette ?? getSpec(this.specVersion).getTertiaryPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.neutralPalette = args.neutralPalette ?? getSpec(this.specVersion).getNeutralPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.neutralVariantPalette = args.neutralVariantPalette ?? getSpec(this.specVersion).getNeutralVariantPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel), this.errorPalette = args.errorPalette ?? getSpec(this.specVersion).getErrorPalette(this.variant, args.sourceColorHct, this.isDark, this.platform, this.contrastLevel) ?? TonalPalette.fromHueAndChroma(25, 84), this.colors = new MaterialDynamicColors();
|
|
2342
|
+
}
|
|
2343
|
+
toString() {
|
|
2344
|
+
return `Scheme: variant=${Variant[this.variant]}, mode=${this.isDark ? "dark" : "light"}, platform=${this.platform}, contrastLevel=${this.contrastLevel.toFixed(1)}, seed=${this.sourceColorHct.toString()}, specVersion=${this.specVersion}`;
|
|
2345
|
+
}
|
|
2346
|
+
static getPiecewiseHue(sourceColorHct, hueBreakpoints, hues) {
|
|
2347
|
+
const size = Math.min(hueBreakpoints.length - 1, hues.length),
|
|
2348
|
+
sourceHue = sourceColorHct.hue;
|
|
2349
|
+
for (let i = 0; i < size; i++) if (sourceHue >= hueBreakpoints[i] && sourceHue < hueBreakpoints[i + 1]) return sanitizeDegreesDouble(hues[i]);
|
|
2350
|
+
return sourceHue;
|
|
2351
|
+
}
|
|
2352
|
+
static getRotatedHue(sourceColorHct, hueBreakpoints, rotations) {
|
|
2353
|
+
let rotation = DynamicScheme.getPiecewiseHue(sourceColorHct, hueBreakpoints, rotations);
|
|
2354
|
+
return Math.min(hueBreakpoints.length - 1, rotations.length) <= 0 && (rotation = 0), sanitizeDegreesDouble(sourceColorHct.hue + rotation);
|
|
2355
|
+
}
|
|
2356
|
+
getArgb(dynamicColor) {
|
|
2357
|
+
return dynamicColor.getArgb(this);
|
|
2358
|
+
}
|
|
2359
|
+
getHct(dynamicColor) {
|
|
2360
|
+
return dynamicColor.getHct(this);
|
|
2361
|
+
}
|
|
2362
|
+
get primaryPaletteKeyColor() {
|
|
2363
|
+
return this.getArgb(this.colors.primaryPaletteKeyColor());
|
|
2364
|
+
}
|
|
2365
|
+
get secondaryPaletteKeyColor() {
|
|
2366
|
+
return this.getArgb(this.colors.secondaryPaletteKeyColor());
|
|
2367
|
+
}
|
|
2368
|
+
get tertiaryPaletteKeyColor() {
|
|
2369
|
+
return this.getArgb(this.colors.tertiaryPaletteKeyColor());
|
|
2370
|
+
}
|
|
2371
|
+
get neutralPaletteKeyColor() {
|
|
2372
|
+
return this.getArgb(this.colors.neutralPaletteKeyColor());
|
|
2373
|
+
}
|
|
2374
|
+
get neutralVariantPaletteKeyColor() {
|
|
2375
|
+
return this.getArgb(this.colors.neutralVariantPaletteKeyColor());
|
|
2376
|
+
}
|
|
2377
|
+
get errorPaletteKeyColor() {
|
|
2378
|
+
return this.getArgb(this.colors.errorPaletteKeyColor());
|
|
2379
|
+
}
|
|
2380
|
+
get background() {
|
|
2381
|
+
return this.getArgb(this.colors.background());
|
|
2382
|
+
}
|
|
2383
|
+
get onBackground() {
|
|
2384
|
+
return this.getArgb(this.colors.onBackground());
|
|
2385
|
+
}
|
|
2386
|
+
get surface() {
|
|
2387
|
+
return this.getArgb(this.colors.surface());
|
|
2388
|
+
}
|
|
2389
|
+
get surfaceDim() {
|
|
2390
|
+
return this.getArgb(this.colors.surfaceDim());
|
|
2391
|
+
}
|
|
2392
|
+
get surfaceBright() {
|
|
2393
|
+
return this.getArgb(this.colors.surfaceBright());
|
|
2394
|
+
}
|
|
2395
|
+
get surfaceContainerLowest() {
|
|
2396
|
+
return this.getArgb(this.colors.surfaceContainerLowest());
|
|
2397
|
+
}
|
|
2398
|
+
get surfaceContainerLow() {
|
|
2399
|
+
return this.getArgb(this.colors.surfaceContainerLow());
|
|
2400
|
+
}
|
|
2401
|
+
get surfaceContainer() {
|
|
2402
|
+
return this.getArgb(this.colors.surfaceContainer());
|
|
2403
|
+
}
|
|
2404
|
+
get surfaceContainerHigh() {
|
|
2405
|
+
return this.getArgb(this.colors.surfaceContainerHigh());
|
|
2406
|
+
}
|
|
2407
|
+
get surfaceContainerHighest() {
|
|
2408
|
+
return this.getArgb(this.colors.surfaceContainerHighest());
|
|
2409
|
+
}
|
|
2410
|
+
get onSurface() {
|
|
2411
|
+
return this.getArgb(this.colors.onSurface());
|
|
2412
|
+
}
|
|
2413
|
+
get surfaceVariant() {
|
|
2414
|
+
return this.getArgb(this.colors.surfaceVariant());
|
|
2415
|
+
}
|
|
2416
|
+
get onSurfaceVariant() {
|
|
2417
|
+
return this.getArgb(this.colors.onSurfaceVariant());
|
|
2418
|
+
}
|
|
2419
|
+
get inverseSurface() {
|
|
2420
|
+
return this.getArgb(this.colors.inverseSurface());
|
|
2421
|
+
}
|
|
2422
|
+
get inverseOnSurface() {
|
|
2423
|
+
return this.getArgb(this.colors.inverseOnSurface());
|
|
2424
|
+
}
|
|
2425
|
+
get outline() {
|
|
2426
|
+
return this.getArgb(this.colors.outline());
|
|
2427
|
+
}
|
|
2428
|
+
get outlineVariant() {
|
|
2429
|
+
return this.getArgb(this.colors.outlineVariant());
|
|
2430
|
+
}
|
|
2431
|
+
get shadow() {
|
|
2432
|
+
return this.getArgb(this.colors.shadow());
|
|
2433
|
+
}
|
|
2434
|
+
get scrim() {
|
|
2435
|
+
return this.getArgb(this.colors.scrim());
|
|
2436
|
+
}
|
|
2437
|
+
get surfaceTint() {
|
|
2438
|
+
return this.getArgb(this.colors.surfaceTint());
|
|
2439
|
+
}
|
|
1137
2440
|
get primary() {
|
|
1138
|
-
return this.
|
|
2441
|
+
return this.getArgb(this.colors.primary());
|
|
2442
|
+
}
|
|
2443
|
+
get primaryDim() {
|
|
2444
|
+
const primaryDim = this.colors.primaryDim();
|
|
2445
|
+
if (void 0 === primaryDim) throw new Error("`primaryDim` color is undefined prior to 2025 spec.");
|
|
2446
|
+
return this.getArgb(primaryDim);
|
|
1139
2447
|
}
|
|
1140
2448
|
get onPrimary() {
|
|
1141
|
-
return this.
|
|
2449
|
+
return this.getArgb(this.colors.onPrimary());
|
|
1142
2450
|
}
|
|
1143
2451
|
get primaryContainer() {
|
|
1144
|
-
return this.
|
|
2452
|
+
return this.getArgb(this.colors.primaryContainer());
|
|
1145
2453
|
}
|
|
1146
2454
|
get onPrimaryContainer() {
|
|
1147
|
-
return this.
|
|
2455
|
+
return this.getArgb(this.colors.onPrimaryContainer());
|
|
2456
|
+
}
|
|
2457
|
+
get primaryFixed() {
|
|
2458
|
+
return this.getArgb(this.colors.primaryFixed());
|
|
2459
|
+
}
|
|
2460
|
+
get primaryFixedDim() {
|
|
2461
|
+
return this.getArgb(this.colors.primaryFixedDim());
|
|
2462
|
+
}
|
|
2463
|
+
get onPrimaryFixed() {
|
|
2464
|
+
return this.getArgb(this.colors.onPrimaryFixed());
|
|
2465
|
+
}
|
|
2466
|
+
get onPrimaryFixedVariant() {
|
|
2467
|
+
return this.getArgb(this.colors.onPrimaryFixedVariant());
|
|
2468
|
+
}
|
|
2469
|
+
get inversePrimary() {
|
|
2470
|
+
return this.getArgb(this.colors.inversePrimary());
|
|
1148
2471
|
}
|
|
1149
2472
|
get secondary() {
|
|
1150
|
-
return this.
|
|
2473
|
+
return this.getArgb(this.colors.secondary());
|
|
2474
|
+
}
|
|
2475
|
+
get secondaryDim() {
|
|
2476
|
+
const secondaryDim = this.colors.secondaryDim();
|
|
2477
|
+
if (void 0 === secondaryDim) throw new Error("`secondaryDim` color is undefined prior to 2025 spec.");
|
|
2478
|
+
return this.getArgb(secondaryDim);
|
|
1151
2479
|
}
|
|
1152
2480
|
get onSecondary() {
|
|
1153
|
-
return this.
|
|
2481
|
+
return this.getArgb(this.colors.onSecondary());
|
|
1154
2482
|
}
|
|
1155
2483
|
get secondaryContainer() {
|
|
1156
|
-
return this.
|
|
2484
|
+
return this.getArgb(this.colors.secondaryContainer());
|
|
1157
2485
|
}
|
|
1158
2486
|
get onSecondaryContainer() {
|
|
1159
|
-
return this.
|
|
2487
|
+
return this.getArgb(this.colors.onSecondaryContainer());
|
|
2488
|
+
}
|
|
2489
|
+
get secondaryFixed() {
|
|
2490
|
+
return this.getArgb(this.colors.secondaryFixed());
|
|
2491
|
+
}
|
|
2492
|
+
get secondaryFixedDim() {
|
|
2493
|
+
return this.getArgb(this.colors.secondaryFixedDim());
|
|
2494
|
+
}
|
|
2495
|
+
get onSecondaryFixed() {
|
|
2496
|
+
return this.getArgb(this.colors.onSecondaryFixed());
|
|
2497
|
+
}
|
|
2498
|
+
get onSecondaryFixedVariant() {
|
|
2499
|
+
return this.getArgb(this.colors.onSecondaryFixedVariant());
|
|
1160
2500
|
}
|
|
1161
2501
|
get tertiary() {
|
|
1162
|
-
return this.
|
|
2502
|
+
return this.getArgb(this.colors.tertiary());
|
|
2503
|
+
}
|
|
2504
|
+
get tertiaryDim() {
|
|
2505
|
+
const tertiaryDim = this.colors.tertiaryDim();
|
|
2506
|
+
if (void 0 === tertiaryDim) throw new Error("`tertiaryDim` color is undefined prior to 2025 spec.");
|
|
2507
|
+
return this.getArgb(tertiaryDim);
|
|
1163
2508
|
}
|
|
1164
2509
|
get onTertiary() {
|
|
1165
|
-
return this.
|
|
2510
|
+
return this.getArgb(this.colors.onTertiary());
|
|
1166
2511
|
}
|
|
1167
2512
|
get tertiaryContainer() {
|
|
1168
|
-
return this.
|
|
2513
|
+
return this.getArgb(this.colors.tertiaryContainer());
|
|
1169
2514
|
}
|
|
1170
2515
|
get onTertiaryContainer() {
|
|
1171
|
-
return this.
|
|
2516
|
+
return this.getArgb(this.colors.onTertiaryContainer());
|
|
2517
|
+
}
|
|
2518
|
+
get tertiaryFixed() {
|
|
2519
|
+
return this.getArgb(this.colors.tertiaryFixed());
|
|
2520
|
+
}
|
|
2521
|
+
get tertiaryFixedDim() {
|
|
2522
|
+
return this.getArgb(this.colors.tertiaryFixedDim());
|
|
2523
|
+
}
|
|
2524
|
+
get onTertiaryFixed() {
|
|
2525
|
+
return this.getArgb(this.colors.onTertiaryFixed());
|
|
2526
|
+
}
|
|
2527
|
+
get onTertiaryFixedVariant() {
|
|
2528
|
+
return this.getArgb(this.colors.onTertiaryFixedVariant());
|
|
1172
2529
|
}
|
|
1173
2530
|
get error() {
|
|
1174
|
-
return this.
|
|
2531
|
+
return this.getArgb(this.colors.error());
|
|
2532
|
+
}
|
|
2533
|
+
get errorDim() {
|
|
2534
|
+
const errorDim = this.colors.errorDim();
|
|
2535
|
+
if (void 0 === errorDim) throw new Error("`errorDim` color is undefined prior to 2025 spec.");
|
|
2536
|
+
return this.getArgb(errorDim);
|
|
1175
2537
|
}
|
|
1176
2538
|
get onError() {
|
|
1177
|
-
return this.
|
|
2539
|
+
return this.getArgb(this.colors.onError());
|
|
1178
2540
|
}
|
|
1179
2541
|
get errorContainer() {
|
|
1180
|
-
return this.
|
|
2542
|
+
return this.getArgb(this.colors.errorContainer());
|
|
1181
2543
|
}
|
|
1182
2544
|
get onErrorContainer() {
|
|
1183
|
-
return this.
|
|
2545
|
+
return this.getArgb(this.colors.onErrorContainer());
|
|
1184
2546
|
}
|
|
1185
|
-
|
|
1186
|
-
|
|
2547
|
+
}
|
|
2548
|
+
DynamicScheme.DEFAULT_SPEC_VERSION = "2021", DynamicScheme.DEFAULT_PLATFORM = "phone";
|
|
2549
|
+
class DynamicSchemePalettesDelegateImpl2021 {
|
|
2550
|
+
getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2551
|
+
switch (variant) {
|
|
2552
|
+
case Variant.CONTENT:
|
|
2553
|
+
case Variant.FIDELITY:
|
|
2554
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma);
|
|
2555
|
+
case Variant.FRUIT_SALAD:
|
|
2556
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue - 50), 48);
|
|
2557
|
+
case Variant.MONOCHROME:
|
|
2558
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2559
|
+
case Variant.NEUTRAL:
|
|
2560
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 12);
|
|
2561
|
+
case Variant.RAINBOW:
|
|
2562
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 48);
|
|
2563
|
+
case Variant.TONAL_SPOT:
|
|
2564
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36);
|
|
2565
|
+
case Variant.EXPRESSIVE:
|
|
2566
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 240), 40);
|
|
2567
|
+
case Variant.VIBRANT:
|
|
2568
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 200);
|
|
2569
|
+
default:
|
|
2570
|
+
throw new Error(`Unsupported variant: ${variant}`);
|
|
2571
|
+
}
|
|
1187
2572
|
}
|
|
1188
|
-
|
|
1189
|
-
|
|
2573
|
+
getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2574
|
+
switch (variant) {
|
|
2575
|
+
case Variant.CONTENT:
|
|
2576
|
+
case Variant.FIDELITY:
|
|
2577
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, Math.max(sourceColorHct.chroma - 32, .5 * sourceColorHct.chroma));
|
|
2578
|
+
case Variant.FRUIT_SALAD:
|
|
2579
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue - 50), 36);
|
|
2580
|
+
case Variant.MONOCHROME:
|
|
2581
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2582
|
+
case Variant.NEUTRAL:
|
|
2583
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8);
|
|
2584
|
+
case Variant.RAINBOW:
|
|
2585
|
+
case Variant.TONAL_SPOT:
|
|
2586
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
|
|
2587
|
+
case Variant.EXPRESSIVE:
|
|
2588
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 21, 51, 121, 151, 191, 271, 321, 360], [45, 95, 45, 20, 45, 90, 45, 45, 45]), 24);
|
|
2589
|
+
case Variant.VIBRANT:
|
|
2590
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 41, 61, 101, 131, 181, 251, 301, 360], [18, 15, 10, 12, 15, 18, 15, 12, 12]), 24);
|
|
2591
|
+
default:
|
|
2592
|
+
throw new Error(`Unsupported variant: ${variant}`);
|
|
2593
|
+
}
|
|
1190
2594
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
2595
|
+
getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2596
|
+
switch (variant) {
|
|
2597
|
+
case Variant.CONTENT:
|
|
2598
|
+
return TonalPalette.fromHct(DislikeAnalyzer.fixIfDisliked(new TemperatureCache(sourceColorHct).analogous(3, 6)[2]));
|
|
2599
|
+
case Variant.FIDELITY:
|
|
2600
|
+
return TonalPalette.fromHct(DislikeAnalyzer.fixIfDisliked(new TemperatureCache(sourceColorHct).complement));
|
|
2601
|
+
case Variant.FRUIT_SALAD:
|
|
2602
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 36);
|
|
2603
|
+
case Variant.MONOCHROME:
|
|
2604
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2605
|
+
case Variant.NEUTRAL:
|
|
2606
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
|
|
2607
|
+
case Variant.RAINBOW:
|
|
2608
|
+
case Variant.TONAL_SPOT:
|
|
2609
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 60), 24);
|
|
2610
|
+
case Variant.EXPRESSIVE:
|
|
2611
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 21, 51, 121, 151, 191, 271, 321, 360], [120, 120, 20, 45, 20, 15, 20, 120, 120]), 32);
|
|
2612
|
+
case Variant.VIBRANT:
|
|
2613
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 41, 61, 101, 131, 181, 251, 301, 360], [35, 30, 20, 25, 30, 35, 30, 25, 25]), 32);
|
|
2614
|
+
default:
|
|
2615
|
+
throw new Error(`Unsupported variant: ${variant}`);
|
|
2616
|
+
}
|
|
1193
2617
|
}
|
|
1194
|
-
|
|
1195
|
-
|
|
2618
|
+
getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2619
|
+
switch (variant) {
|
|
2620
|
+
case Variant.CONTENT:
|
|
2621
|
+
case Variant.FIDELITY:
|
|
2622
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8);
|
|
2623
|
+
case Variant.FRUIT_SALAD:
|
|
2624
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 10);
|
|
2625
|
+
case Variant.MONOCHROME:
|
|
2626
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2627
|
+
case Variant.NEUTRAL:
|
|
2628
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2);
|
|
2629
|
+
case Variant.RAINBOW:
|
|
2630
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2631
|
+
case Variant.TONAL_SPOT:
|
|
2632
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 6);
|
|
2633
|
+
case Variant.EXPRESSIVE:
|
|
2634
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 15), 8);
|
|
2635
|
+
case Variant.VIBRANT:
|
|
2636
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 10);
|
|
2637
|
+
default:
|
|
2638
|
+
throw new Error(`Unsupported variant: ${variant}`);
|
|
2639
|
+
}
|
|
1196
2640
|
}
|
|
1197
|
-
|
|
1198
|
-
|
|
2641
|
+
getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2642
|
+
switch (variant) {
|
|
2643
|
+
case Variant.CONTENT:
|
|
2644
|
+
case Variant.FIDELITY:
|
|
2645
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, sourceColorHct.chroma / 8 + 4);
|
|
2646
|
+
case Variant.FRUIT_SALAD:
|
|
2647
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
|
|
2648
|
+
case Variant.MONOCHROME:
|
|
2649
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2650
|
+
case Variant.NEUTRAL:
|
|
2651
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2);
|
|
2652
|
+
case Variant.RAINBOW:
|
|
2653
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 0);
|
|
2654
|
+
case Variant.TONAL_SPOT:
|
|
2655
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 8);
|
|
2656
|
+
case Variant.EXPRESSIVE:
|
|
2657
|
+
return TonalPalette.fromHueAndChroma(sanitizeDegreesDouble(sourceColorHct.hue + 15), 12);
|
|
2658
|
+
case Variant.VIBRANT:
|
|
2659
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 12);
|
|
2660
|
+
default:
|
|
2661
|
+
throw new Error(`Unsupported variant: ${variant}`);
|
|
2662
|
+
}
|
|
1199
2663
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
2664
|
+
getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {}
|
|
2665
|
+
}
|
|
2666
|
+
class DynamicSchemePalettesDelegateImpl2025 extends DynamicSchemePalettesDelegateImpl2021 {
|
|
2667
|
+
getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2668
|
+
switch (variant) {
|
|
2669
|
+
case Variant.NEUTRAL:
|
|
2670
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? Hct.isBlue(sourceColorHct.hue) ? 12 : 8 : Hct.isBlue(sourceColorHct.hue) ? 16 : 12);
|
|
2671
|
+
case Variant.TONAL_SPOT:
|
|
2672
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform && isDark ? 26 : 32);
|
|
2673
|
+
case Variant.EXPRESSIVE:
|
|
2674
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? isDark ? 36 : 48 : 40);
|
|
2675
|
+
case Variant.VIBRANT:
|
|
2676
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 74 : 56);
|
|
2677
|
+
default:
|
|
2678
|
+
return super.getPrimaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2679
|
+
}
|
|
1202
2680
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
2681
|
+
getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2682
|
+
switch (variant) {
|
|
2683
|
+
case Variant.NEUTRAL:
|
|
2684
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? Hct.isBlue(sourceColorHct.hue) ? 6 : 4 : Hct.isBlue(sourceColorHct.hue) ? 10 : 6);
|
|
2685
|
+
case Variant.TONAL_SPOT:
|
|
2686
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 16);
|
|
2687
|
+
case Variant.EXPRESSIVE:
|
|
2688
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 105, 140, 204, 253, 278, 300, 333, 360], [-160, 155, -100, 96, -96, -156, -165, -160]), "phone" === platform && isDark ? 16 : 24);
|
|
2689
|
+
case Variant.VIBRANT:
|
|
2690
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]), "phone" === platform ? 56 : 36);
|
|
2691
|
+
default:
|
|
2692
|
+
return super.getSecondaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2693
|
+
}
|
|
1205
2694
|
}
|
|
1206
|
-
|
|
1207
|
-
|
|
2695
|
+
getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2696
|
+
switch (variant) {
|
|
2697
|
+
case Variant.NEUTRAL:
|
|
2698
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 161, 204, 278, 333, 360], [-32, 26, 10, -39, 24, -15, -32]), "phone" === platform ? 20 : 36);
|
|
2699
|
+
case Variant.TONAL_SPOT:
|
|
2700
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 20, 71, 161, 333, 360], [-40, 48, -32, 40, -32]), "phone" === platform ? 28 : 32);
|
|
2701
|
+
case Variant.EXPRESSIVE:
|
|
2702
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 105, 140, 204, 253, 278, 300, 333, 360], [-165, 160, -105, 101, -101, -160, -170, -165]), 48);
|
|
2703
|
+
case Variant.VIBRANT:
|
|
2704
|
+
return TonalPalette.fromHueAndChroma(DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 71, 105, 140, 161, 253, 333, 360], [-72, 35, 24, -24, 62, 50, 62, -72]), 56);
|
|
2705
|
+
default:
|
|
2706
|
+
return super.getTertiaryPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2707
|
+
}
|
|
1208
2708
|
}
|
|
1209
|
-
|
|
1210
|
-
return
|
|
2709
|
+
static getExpressiveNeutralHue(sourceColorHct) {
|
|
2710
|
+
return DynamicScheme.getRotatedHue(sourceColorHct, [0, 71, 124, 253, 278, 300, 360], [10, 0, 10, 0, 10, 0]);
|
|
2711
|
+
}
|
|
2712
|
+
static getExpressiveNeutralChroma(sourceColorHct, isDark, platform) {
|
|
2713
|
+
const neutralHue = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct);
|
|
2714
|
+
return "phone" === platform ? isDark ? Hct.isYellow(neutralHue) ? 6 : 14 : 18 : 12;
|
|
2715
|
+
}
|
|
2716
|
+
static getVibrantNeutralHue(sourceColorHct) {
|
|
2717
|
+
return DynamicScheme.getRotatedHue(sourceColorHct, [0, 38, 105, 140, 333, 360], [-14, 10, -14, 10, -14]);
|
|
2718
|
+
}
|
|
2719
|
+
static getVibrantNeutralChroma(sourceColorHct, platform) {
|
|
2720
|
+
const neutralHue = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct);
|
|
2721
|
+
return "phone" === platform || Hct.isBlue(neutralHue) ? 28 : 20;
|
|
2722
|
+
}
|
|
2723
|
+
getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2724
|
+
switch (variant) {
|
|
2725
|
+
case Variant.NEUTRAL:
|
|
2726
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 1.4 : 6);
|
|
2727
|
+
case Variant.TONAL_SPOT:
|
|
2728
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, "phone" === platform ? 5 : 10);
|
|
2729
|
+
case Variant.EXPRESSIVE:
|
|
2730
|
+
return TonalPalette.fromHueAndChroma(DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct), DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralChroma(sourceColorHct, isDark, platform));
|
|
2731
|
+
case Variant.VIBRANT:
|
|
2732
|
+
return TonalPalette.fromHueAndChroma(DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct), DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralChroma(sourceColorHct, platform));
|
|
2733
|
+
default:
|
|
2734
|
+
return super.getNeutralPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2735
|
+
}
|
|
1211
2736
|
}
|
|
1212
|
-
|
|
1213
|
-
|
|
2737
|
+
getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2738
|
+
switch (variant) {
|
|
2739
|
+
case Variant.NEUTRAL:
|
|
2740
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 2.2 * ("phone" === platform ? 1.4 : 6));
|
|
2741
|
+
case Variant.TONAL_SPOT:
|
|
2742
|
+
return TonalPalette.fromHueAndChroma(sourceColorHct.hue, 1.7 * ("phone" === platform ? 5 : 10));
|
|
2743
|
+
case Variant.EXPRESSIVE:
|
|
2744
|
+
const expressiveNeutralHue = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralHue(sourceColorHct),
|
|
2745
|
+
expressiveNeutralChroma = DynamicSchemePalettesDelegateImpl2025.getExpressiveNeutralChroma(sourceColorHct, isDark, platform);
|
|
2746
|
+
return TonalPalette.fromHueAndChroma(expressiveNeutralHue, expressiveNeutralChroma * (expressiveNeutralHue >= 105 && expressiveNeutralHue < 125 ? 1.6 : 2.3));
|
|
2747
|
+
case Variant.VIBRANT:
|
|
2748
|
+
const vibrantNeutralHue = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralHue(sourceColorHct),
|
|
2749
|
+
vibrantNeutralChroma = DynamicSchemePalettesDelegateImpl2025.getVibrantNeutralChroma(sourceColorHct, platform);
|
|
2750
|
+
return TonalPalette.fromHueAndChroma(vibrantNeutralHue, 1.29 * vibrantNeutralChroma);
|
|
2751
|
+
default:
|
|
2752
|
+
return super.getNeutralVariantPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2753
|
+
}
|
|
1214
2754
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
2755
|
+
getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel) {
|
|
2756
|
+
const errorHue = DynamicScheme.getPiecewiseHue(sourceColorHct, [0, 3, 13, 23, 33, 43, 153, 273, 360], [12, 22, 32, 12, 22, 32, 22, 12]);
|
|
2757
|
+
switch (variant) {
|
|
2758
|
+
case Variant.NEUTRAL:
|
|
2759
|
+
return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 50 : 40);
|
|
2760
|
+
case Variant.TONAL_SPOT:
|
|
2761
|
+
return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 60 : 48);
|
|
2762
|
+
case Variant.EXPRESSIVE:
|
|
2763
|
+
return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 64 : 48);
|
|
2764
|
+
case Variant.VIBRANT:
|
|
2765
|
+
return TonalPalette.fromHueAndChroma(errorHue, "phone" === platform ? 80 : 60);
|
|
2766
|
+
default:
|
|
2767
|
+
return super.getErrorPalette(variant, sourceColorHct, isDark, platform, contrastLevel);
|
|
2768
|
+
}
|
|
1217
2769
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
2770
|
+
}
|
|
2771
|
+
const spec2021 = new DynamicSchemePalettesDelegateImpl2021(),
|
|
2772
|
+
spec2025 = new DynamicSchemePalettesDelegateImpl2025();
|
|
2773
|
+
function getSpec(specVersion) {
|
|
2774
|
+
return "2025" === specVersion ? spec2025 : spec2021;
|
|
2775
|
+
}
|
|
2776
|
+
class SchemeMonochrome extends DynamicScheme {
|
|
2777
|
+
constructor(sourceColorHct, isDark, contrastLevel, specVersion, platform) {
|
|
2778
|
+
if (specVersion === void 0) {
|
|
2779
|
+
specVersion = DynamicScheme.DEFAULT_SPEC_VERSION;
|
|
2780
|
+
}
|
|
2781
|
+
if (platform === void 0) {
|
|
2782
|
+
platform = DynamicScheme.DEFAULT_PLATFORM;
|
|
2783
|
+
}
|
|
2784
|
+
super({
|
|
2785
|
+
sourceColorHct: sourceColorHct,
|
|
2786
|
+
variant: Variant.MONOCHROME,
|
|
2787
|
+
contrastLevel: contrastLevel,
|
|
2788
|
+
isDark: isDark,
|
|
2789
|
+
platform: platform,
|
|
2790
|
+
specVersion: specVersion
|
|
2791
|
+
});
|
|
1220
2792
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
surface: core.n1.tone(99),
|
|
1257
|
-
onSurface: core.n1.tone(10),
|
|
1258
|
-
surfaceVariant: core.n2.tone(90),
|
|
1259
|
-
onSurfaceVariant: core.n2.tone(30),
|
|
1260
|
-
outline: core.n2.tone(50),
|
|
1261
|
-
outlineVariant: core.n2.tone(80),
|
|
1262
|
-
shadow: core.n1.tone(0),
|
|
1263
|
-
scrim: core.n1.tone(0),
|
|
1264
|
-
inverseSurface: core.n1.tone(20),
|
|
1265
|
-
inverseOnSurface: core.n1.tone(95),
|
|
1266
|
-
inversePrimary: core.a1.tone(80)
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
static darkFromCorePalette(core) {
|
|
1270
|
-
return new Scheme({
|
|
1271
|
-
primary: core.a1.tone(80),
|
|
1272
|
-
onPrimary: core.a1.tone(20),
|
|
1273
|
-
primaryContainer: core.a1.tone(30),
|
|
1274
|
-
onPrimaryContainer: core.a1.tone(90),
|
|
1275
|
-
secondary: core.a2.tone(80),
|
|
1276
|
-
onSecondary: core.a2.tone(20),
|
|
1277
|
-
secondaryContainer: core.a2.tone(30),
|
|
1278
|
-
onSecondaryContainer: core.a2.tone(90),
|
|
1279
|
-
tertiary: core.a3.tone(80),
|
|
1280
|
-
onTertiary: core.a3.tone(20),
|
|
1281
|
-
tertiaryContainer: core.a3.tone(30),
|
|
1282
|
-
onTertiaryContainer: core.a3.tone(90),
|
|
1283
|
-
error: core.error.tone(80),
|
|
1284
|
-
onError: core.error.tone(20),
|
|
1285
|
-
errorContainer: core.error.tone(30),
|
|
1286
|
-
onErrorContainer: core.error.tone(80),
|
|
1287
|
-
background: core.n1.tone(10),
|
|
1288
|
-
onBackground: core.n1.tone(90),
|
|
1289
|
-
surface: core.n1.tone(10),
|
|
1290
|
-
onSurface: core.n1.tone(90),
|
|
1291
|
-
surfaceVariant: core.n2.tone(30),
|
|
1292
|
-
onSurfaceVariant: core.n2.tone(80),
|
|
1293
|
-
outline: core.n2.tone(60),
|
|
1294
|
-
outlineVariant: core.n2.tone(30),
|
|
1295
|
-
shadow: core.n1.tone(0),
|
|
1296
|
-
scrim: core.n1.tone(0),
|
|
1297
|
-
inverseSurface: core.n1.tone(90),
|
|
1298
|
-
inverseOnSurface: core.n1.tone(20),
|
|
1299
|
-
inversePrimary: core.a1.tone(40)
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
constructor(props) {
|
|
1303
|
-
this.props = props;
|
|
1304
|
-
}
|
|
1305
|
-
toJSON() {
|
|
1306
|
-
return {
|
|
1307
|
-
...this.props
|
|
1308
|
-
};
|
|
2793
|
+
}
|
|
2794
|
+
class SchemeTonalSpot extends DynamicScheme {
|
|
2795
|
+
constructor(sourceColorHct, isDark, contrastLevel, specVersion, platform) {
|
|
2796
|
+
if (specVersion === void 0) {
|
|
2797
|
+
specVersion = DynamicScheme.DEFAULT_SPEC_VERSION;
|
|
2798
|
+
}
|
|
2799
|
+
if (platform === void 0) {
|
|
2800
|
+
platform = DynamicScheme.DEFAULT_PLATFORM;
|
|
2801
|
+
}
|
|
2802
|
+
super({
|
|
2803
|
+
sourceColorHct: sourceColorHct,
|
|
2804
|
+
variant: Variant.TONAL_SPOT,
|
|
2805
|
+
contrastLevel: contrastLevel,
|
|
2806
|
+
isDark: isDark,
|
|
2807
|
+
platform: platform,
|
|
2808
|
+
specVersion: specVersion
|
|
2809
|
+
});
|
|
2810
|
+
}
|
|
2811
|
+
}
|
|
2812
|
+
class SchemeVibrant extends DynamicScheme {
|
|
2813
|
+
constructor(sourceColorHct, isDark, contrastLevel, specVersion, platform) {
|
|
2814
|
+
if (specVersion === void 0) {
|
|
2815
|
+
specVersion = DynamicScheme.DEFAULT_SPEC_VERSION;
|
|
2816
|
+
}
|
|
2817
|
+
if (platform === void 0) {
|
|
2818
|
+
platform = DynamicScheme.DEFAULT_PLATFORM;
|
|
2819
|
+
}
|
|
2820
|
+
super({
|
|
2821
|
+
sourceColorHct: sourceColorHct,
|
|
2822
|
+
variant: Variant.VIBRANT,
|
|
2823
|
+
contrastLevel: contrastLevel,
|
|
2824
|
+
isDark: isDark,
|
|
2825
|
+
platform: platform,
|
|
2826
|
+
specVersion: specVersion
|
|
2827
|
+
});
|
|
1309
2828
|
}
|
|
1310
2829
|
}
|
|
1311
2830
|
function hexFromArgb(argb) {
|
|
@@ -1329,49 +2848,4 @@ function argbFromHex(hex) {
|
|
|
1329
2848
|
function parseIntHex(value) {
|
|
1330
2849
|
return parseInt(value, 16);
|
|
1331
2850
|
}
|
|
1332
|
-
|
|
1333
|
-
if (customColors === void 0) {
|
|
1334
|
-
customColors = [];
|
|
1335
|
-
}
|
|
1336
|
-
const palette = CorePalette.of(source);
|
|
1337
|
-
return {
|
|
1338
|
-
source: source,
|
|
1339
|
-
schemes: {
|
|
1340
|
-
light: Scheme.light(source),
|
|
1341
|
-
dark: Scheme.dark(source)
|
|
1342
|
-
},
|
|
1343
|
-
palettes: {
|
|
1344
|
-
primary: palette.a1,
|
|
1345
|
-
secondary: palette.a2,
|
|
1346
|
-
tertiary: palette.a3,
|
|
1347
|
-
neutral: palette.n1,
|
|
1348
|
-
neutralVariant: palette.n2,
|
|
1349
|
-
error: palette.error
|
|
1350
|
-
},
|
|
1351
|
-
customColors: customColors.map(c => customColor(source, c))
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
function customColor(source, color) {
|
|
1355
|
-
let value = color.value;
|
|
1356
|
-
const from = value,
|
|
1357
|
-
to = source;
|
|
1358
|
-
color.blend && (value = Blend.harmonize(from, to));
|
|
1359
|
-
const tones = CorePalette.of(value).a1;
|
|
1360
|
-
return {
|
|
1361
|
-
color: color,
|
|
1362
|
-
value: value,
|
|
1363
|
-
light: {
|
|
1364
|
-
color: tones.tone(40),
|
|
1365
|
-
onColor: tones.tone(100),
|
|
1366
|
-
colorContainer: tones.tone(90),
|
|
1367
|
-
onColorContainer: tones.tone(10)
|
|
1368
|
-
},
|
|
1369
|
-
dark: {
|
|
1370
|
-
color: tones.tone(80),
|
|
1371
|
-
onColor: tones.tone(20),
|
|
1372
|
-
colorContainer: tones.tone(30),
|
|
1373
|
-
onColorContainer: tones.tone(90)
|
|
1374
|
-
}
|
|
1375
|
-
};
|
|
1376
|
-
}
|
|
1377
|
-
export { argbFromHex, hexFromArgb, themeFromSourceColor };
|
|
2851
|
+
export { Hct, SchemeMonochrome, SchemeTonalSpot, SchemeVibrant, argbFromHex, hexFromArgb };
|