@udixio/theme 1.0.0-beta.2 → 1.0.0-beta.4
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/dist/color/color-manager.service.d.ts +1 -1
- package/dist/color/color.service.d.ts +1 -0
- package/dist/color/models/default-color.model.d.ts +1 -1
- package/dist/theme.cjs.development.js +354 -13
- package/dist/theme.cjs.development.js.map +1 -1
- package/dist/theme.cjs.production.min.js +1 -1
- package/dist/theme.cjs.production.min.js.map +1 -1
- package/dist/theme.esm.js +355 -14
- package/dist/theme.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/color/color-manager.service.ts +1 -4
- package/src/color/color.service.ts +15 -9
- package/src/color/entities/color.entity.ts +1 -2
- package/src/color/models/default-color.model.ts +2 -2
- package/src/theme/services/scheme.service.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.cjs.production.min.js","sources":["../src/material-color-utilities/contrastCurve.ts","../src/material-color-utilities/toneDeltaPair.ts","../src/material-color-utilities/dynamic_color.ts","../src/color/entities/color.entity.ts","../src/theme/entities/scheme.entity.ts","../src/theme/services/scheme.service.ts","../src/color/color-manager.service.ts","../src/color/color.service.ts","../src/theme/services/variant.service.ts","../src/theme/services/theme.service.ts","../src/app.service.ts","../src/theme/theme.module.ts","../src/color/color.module.ts","../src/app.module.ts","../src/main.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lerp } from '@material/material-color-utilities';\n\n/**\n * A class containing a value that changes with the contrast level.\n *\n * Usually represents the contrast requirements for a dynamic color on its\n * background. The four values correspond to values for contrast levels -1.0,\n * 0.0, 0.5, and 1.0, respectively.\n */\nexport class ContrastCurve {\n /**\n * Creates a `ContrastCurve` object.\n *\n * @param low Value for contrast level -1.0\n * @param normal Value for contrast level 0.0\n * @param medium Value for contrast level 0.5\n * @param high Value for contrast level 1.0\n */\n constructor(\n readonly low: number,\n readonly normal: number,\n readonly medium: number,\n readonly high: number\n ) {}\n\n /**\n * Returns the value at a given contrast level.\n *\n * @param contrastLevel The contrast level. 0.0 is the default (normal); -1.0\n * is the lowest; 1.0 is the highest.\n * @return The value. For contrast ratios, a number between 1.0 and 21.0.\n */\n get(contrastLevel: number): number {\n if (contrastLevel <= -1.0) {\n return this.low;\n } else if (contrastLevel < 0.0) {\n return lerp(this.low, this.normal, (contrastLevel - -1) / 1);\n } else if (contrastLevel < 0.5) {\n return lerp(this.normal, this.medium, (contrastLevel - 0) / 0.5);\n } else if (contrastLevel < 1.0) {\n return lerp(this.medium, this.high, (contrastLevel - 0.5) / 0.5);\n } else {\n return this.high;\n }\n }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DynamicColor } from './dynamic_color';\n\n/**\n * Describes the different in tone between colors.\n */\nexport type TonePolarity = 'darker' | 'lighter' | 'nearer' | 'farther';\n\n/**\n * Documents a constraint between two DynamicColors, in which their tones must\n * have a certain distance from each other.\n *\n * Prefer a DynamicColor with a background, this is for special cases when\n * designers want tonal distance, literally contrast, between two colors that\n * don't have a background / foreground relationship or a contrast guarantee.\n */\nexport class ToneDeltaPair {\n /**\n * Documents a constraint in tone distance between two DynamicColors.\n *\n * The polarity is an adjective that describes \"A\", compared to \"B\".\n *\n * For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that\n * A's tone should be at least 15 darker than B's.\n *\n * 'nearer' and 'farther' describes closeness to the surface roles. For\n * instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A\n * should be 10 lighter than B in light mode, and 10 darker than B in dark\n * mode.\n *\n * @param roleA The first role in a pair.\n * @param roleB The second role in a pair.\n * @param delta Required difference between tones. Absolute value, negative\n * values have undefined behavior.\n * @param polarity The relative relation between tones of roleA and roleB,\n * as described above.\n * @param stayTogether Whether these two roles should stay on the same side of\n * the \"awkward zone\" (T50-59). This is necessary for certain cases where\n * one role has two backgrounds.\n */\n constructor(\n readonly roleA: DynamicColor,\n readonly roleB: DynamicColor,\n readonly delta: number,\n readonly polarity: TonePolarity,\n readonly stayTogether: boolean\n ) {}\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n clampDouble,\n Contrast,\n Hct,\n TonalPalette,\n} from '@material/material-color-utilities';\nimport { ContrastCurve } from './contrastCurve';\nimport { ToneDeltaPair } from './toneDeltaPair';\nimport { SchemeEntity } from '../theme/entities/scheme.entity';\n\n/**\n * @param name The name of the dynamic color. Defaults to empty.\n * @param palette Function that provides a TonalPalette given\n * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this\n * replaces the need to specify hue/chroma. By providing a tonal palette, when\n * contrast adjustments are made, intended chroma can be preserved.\n * @param tone Function that provides a tone given SchemeEntity.\n * @param isBackground Whether this dynamic color is a background, with\n * some other color as the foreground. Defaults to false.\n * @param background The background of the dynamic color (as a function of a\n * `SchemeEntity`), if it exists.\n * @param secondBackground A second background of the dynamic color (as a\n * function of a `SchemeEntity`), if it\n * exists.\n * @param contrastCurve A `ContrastCurve` object specifying how its contrast\n * against its background should behave in various contrast levels options.\n * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta\n * constraint between two colors. One of them must be the color being\n * constructed.\n */\ninterface FromPaletteOptions {\n name?: string;\n palette: (scheme: SchemeEntity) => TonalPalette;\n tone: (scheme: SchemeEntity) => number;\n isBackground?: boolean;\n background?: (scheme: SchemeEntity) => DynamicColor;\n secondBackground?: (scheme: SchemeEntity) => DynamicColor;\n contrastCurve?: ContrastCurve;\n toneDeltaPair?: (scheme: SchemeEntity) => ToneDeltaPair;\n}\n\n/**\n * A color that adjusts itself based on UI state provided by SchemeEntity.\n *\n * Colors without backgrounds do not change tone when contrast changes. Colors\n * with backgrounds become closer to their background as contrast lowers, and\n * further when contrast increases.\n *\n * Prefer static constructors. They require either a hexcode, a palette and\n * tone, or a hue and chroma. Optionally, they can provide a background\n * DynamicColor.\n */\nexport class DynamicColor {\n private readonly hctCache = new Map<SchemeEntity, Hct>();\n\n /**\n * The base constructor for DynamicColor.\n *\n * _Strongly_ prefer using one of the convenience constructors. This class is\n * arguably too flexible to ensure it can support any scenario. Functional\n * arguments allow overriding without risks that come with subclasses.\n *\n * For example, the default behavior of adjust tone at max contrast\n * to be at a 7.0 ratio with its background is principled and\n * matches accessibility guidance. That does not mean it's the desired\n * approach for _every_ design system, and every color pairing,\n * always, in every case.\n *\n * @param name The name of the dynamic color. Defaults to empty.\n * @param palette Function that provides a TonalPalette given\n * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this\n * replaces the need to specify hue/chroma. By providing a tonal palette, when\n * contrast adjustments are made, intended chroma can be preserved.\n * @param tone Function that provides a tone, given a SchemeEntity.\n * @param isBackground Whether this dynamic color is a background, with\n * some other color as the foreground. Defaults to false.\n * @param background The background of the dynamic color (as a function of a\n * `SchemeEntity`), if it exists.\n * @param secondBackground A second background of the dynamic color (as a\n * function of a `SchemeEntity`), if it\n * exists.\n * @param contrastCurve A `ContrastCurve` object specifying how its contrast\n * against its background should behave in various contrast levels options.\n * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta\n * constraint between two colors. One of them must be the color being\n * constructed.\n */\n constructor(\n readonly name: string,\n readonly palette: (scheme: SchemeEntity) => TonalPalette,\n readonly tone: (scheme: SchemeEntity) => number,\n readonly isBackground: boolean,\n readonly background?: (scheme: SchemeEntity) => DynamicColor,\n readonly secondBackground?: (scheme: SchemeEntity) => DynamicColor,\n readonly contrastCurve?: ContrastCurve,\n readonly toneDeltaPair?: (scheme: SchemeEntity) => ToneDeltaPair\n ) {\n if (!background && secondBackground) {\n throw new Error(\n `Color ${name} has secondBackground` +\n `defined, but background is not defined.`\n );\n }\n if (!background && contrastCurve) {\n throw new Error(\n `Color ${name} has contrastCurve` +\n `defined, but background is not defined.`\n );\n }\n if (background && !contrastCurve) {\n throw new Error(\n `Color ${name} has background` +\n `defined, but contrastCurve is not defined.`\n );\n }\n }\n\n /**\n * Create a DynamicColor defined by a TonalPalette and HCT tone.\n *\n * @param args Functions with SchemeEntity as input. Must provide a palette\n * and tone. May provide a background DynamicColor and ToneDeltaConstraint.\n */\n static fromPalette(args: FromPaletteOptions): DynamicColor {\n return new DynamicColor(\n args.name ?? '',\n args.palette,\n args.tone,\n args.isBackground ?? false,\n args.background,\n args.secondBackground,\n args.contrastCurve,\n args.toneDeltaPair\n );\n }\n\n /**\n * Given a background tone, find a foreground tone, while ensuring they reach\n * a contrast ratio that is as close to [ratio] as possible.\n *\n * @param bgTone Tone in HCT. Range is 0 to 100, undefined behavior when it\n * falls outside that range.\n * @param ratio The contrast ratio desired between bgTone and the return\n * value.\n */\n static foregroundTone(bgTone: number, ratio: number): number {\n const lighterTone = Contrast.lighterUnsafe(bgTone, ratio);\n const darkerTone = Contrast.darkerUnsafe(bgTone, ratio);\n const lighterRatio = Contrast.ratioOfTones(lighterTone, bgTone);\n const darkerRatio = Contrast.ratioOfTones(darkerTone, bgTone);\n const preferLighter = DynamicColor.tonePrefersLightForeground(bgTone);\n\n if (preferLighter) {\n // This handles an edge case where the initial contrast ratio is high\n // (ex. 13.0), and the ratio passed to the function is that high\n // ratio, and both the lighter and darker ratio fails to pass that\n // ratio.\n //\n // This was observed with Tonal Spot's On Primary Container turning\n // black momentarily between high and max contrast in light mode. PC's\n // standard tone was T90, OPC's was T10, it was light mode, and the\n // contrast value was 0.6568521221032331.\n const negligibleDifference =\n Math.abs(lighterRatio - darkerRatio) < 0.1 &&\n lighterRatio < ratio &&\n darkerRatio < ratio;\n return lighterRatio >= ratio ||\n lighterRatio >= darkerRatio ||\n negligibleDifference\n ? lighterTone\n : darkerTone;\n } else {\n return darkerRatio >= ratio || darkerRatio >= lighterRatio\n ? darkerTone\n : lighterTone;\n }\n }\n\n /**\n * Returns whether [tone] prefers a light foreground.\n *\n * People prefer white foregrounds on ~T60-70. Observed over time, and also\n * by Andrew Somers during research for APCA.\n *\n * T60 used as to create the smallest discontinuity possible when skipping\n * down to T49 in order to ensure light foregrounds.\n * Since `tertiaryContainer` in dark monochrome scheme requires a tone of\n * 60, it should not be adjusted. Therefore, 60 is excluded here.\n */\n static tonePrefersLightForeground(tone: number): boolean {\n return Math.round(tone) < 60.0;\n }\n\n /**\n * Returns whether [tone] can reach a contrast ratio of 4.5 with a lighter\n * color.\n */\n static toneAllowsLightForeground(tone: number): boolean {\n return Math.round(tone) <= 49.0;\n }\n\n /**\n * Adjust a tone such that white has 4.5 contrast, if the tone is\n * reasonably close to supporting it.\n */\n static enableLightForeground(tone: number): number {\n if (\n DynamicColor.tonePrefersLightForeground(tone) &&\n !DynamicColor.toneAllowsLightForeground(tone)\n ) {\n return 49.0;\n }\n return tone;\n }\n\n /**\n * Return a ARGB integer (i.e. a hex code).\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getArgb(scheme: SchemeEntity): number {\n return this.getHct(scheme).toInt();\n }\n\n /**\n * Return a color, expressed in the HCT color space, that this\n * DynamicColor is under the conditions in scheme.\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getHct(scheme: SchemeEntity): Hct {\n const cachedAnswer = this.hctCache.get(scheme);\n if (cachedAnswer != null) {\n return cachedAnswer;\n }\n const tone = this.getTone(scheme);\n const answer = this.palette(scheme).getHct(tone);\n if (this.hctCache.size > 4) {\n this.hctCache.clear();\n }\n this.hctCache.set(scheme, answer);\n return answer;\n }\n\n /**\n * Return a tone, T in the HCT color space, that this DynamicColor is under\n * the conditions in scheme.\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getTone(scheme: SchemeEntity): number {\n const decreasingContrast = scheme.contrastLevel < 0;\n\n // Case 1: dual foreground, pair of colors with delta constraint.\n if (this.toneDeltaPair) {\n const toneDeltaPair = this.toneDeltaPair(scheme);\n const roleA = toneDeltaPair.roleA;\n const roleB = toneDeltaPair.roleB;\n const delta = toneDeltaPair.delta;\n const polarity = toneDeltaPair.polarity;\n const stayTogether = toneDeltaPair.stayTogether;\n\n const bg = this.background!(scheme);\n const bgTone = bg.getTone(scheme);\n\n const aIsNearer =\n polarity === 'nearer' ||\n (polarity === 'lighter' && !scheme.isDark) ||\n (polarity === 'darker' && scheme.isDark);\n const nearer = aIsNearer ? roleA : roleB;\n const farther = aIsNearer ? roleB : roleA;\n const amNearer = this.name === nearer.name;\n const expansionDir = scheme.isDark ? 1 : -1;\n\n // 1st round: solve to min, each\n const nContrast = nearer.contrastCurve!.get(scheme.contrastLevel);\n const fContrast = farther.contrastCurve!.get(scheme.contrastLevel);\n\n // If a color is good enough, it is not adjusted.\n // Initial and adjusted tones for `nearer`\n const nInitialTone = nearer.tone(scheme);\n let nTone =\n Contrast.ratioOfTones(bgTone, nInitialTone) >= nContrast\n ? nInitialTone\n : DynamicColor.foregroundTone(bgTone, nContrast);\n // Initial and adjusted tones for `farther`\n const fInitialTone = farther.tone(scheme);\n let fTone =\n Contrast.ratioOfTones(bgTone, fInitialTone) >= fContrast\n ? fInitialTone\n : DynamicColor.foregroundTone(bgTone, fContrast);\n\n if (decreasingContrast) {\n // If decreasing contrast, adjust color to the \"bare minimum\"\n // that satisfies contrast.\n nTone = DynamicColor.foregroundTone(bgTone, nContrast);\n fTone = DynamicColor.foregroundTone(bgTone, fContrast);\n }\n\n if ((fTone - nTone) * expansionDir >= delta) {\n // Good! Tones satisfy the constraint; no change needed.\n } else {\n // 2nd round: expand farther to match delta.\n fTone = clampDouble(0, 100, nTone + delta * expansionDir);\n if ((fTone - nTone) * expansionDir >= delta) {\n // Good! Tones now satisfy the constraint; no change needed.\n } else {\n // 3rd round: contract nearer to match delta.\n nTone = clampDouble(0, 100, fTone - delta * expansionDir);\n }\n }\n\n // Avoids the 50-59 awkward zone.\n if (50 <= nTone && nTone < 60) {\n // If `nearer` is in the awkward zone, move it away, together with\n // `farther`.\n if (expansionDir > 0) {\n nTone = 60;\n fTone = Math.max(fTone, nTone + delta * expansionDir);\n } else {\n nTone = 49;\n fTone = Math.min(fTone, nTone + delta * expansionDir);\n }\n } else if (50 <= fTone && fTone < 60) {\n if (stayTogether) {\n // Fixes both, to avoid two colors on opposite sides of the \"awkward\n // zone\".\n if (expansionDir > 0) {\n nTone = 60;\n fTone = Math.max(fTone, nTone + delta * expansionDir);\n } else {\n nTone = 49;\n fTone = Math.min(fTone, nTone + delta * expansionDir);\n }\n } else {\n // Not required to stay together; fixes just one.\n if (expansionDir > 0) {\n fTone = 60;\n } else {\n fTone = 49;\n }\n }\n }\n\n // Returns `nTone` if this color is `nearer`, otherwise `fTone`.\n return amNearer ? nTone : fTone;\n } else {\n // Case 2: No contrast pair; just solve for itself.\n let answer = this.tone(scheme);\n\n if (this.background == null) {\n return answer; // No adjustment for colors with no background.\n }\n\n const bgTone = this.background(scheme).getTone(scheme);\n\n const desiredRatio = this.contrastCurve!.get(scheme.contrastLevel);\n\n if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio) {\n // Don't \"improve\" what's good enough.\n } else {\n // Rough improvement.\n answer = DynamicColor.foregroundTone(bgTone, desiredRatio);\n }\n\n if (decreasingContrast) {\n answer = DynamicColor.foregroundTone(bgTone, desiredRatio);\n }\n\n if (this.isBackground && 50 <= answer && answer < 60) {\n // Must adjust\n if (Contrast.ratioOfTones(49, bgTone) >= desiredRatio) {\n answer = 49;\n } else {\n answer = 60;\n }\n }\n\n if (this.secondBackground) {\n // Case 3: Adjust for dual backgrounds.\n\n const [bg1, bg2] = [this.background, this.secondBackground];\n const [bgTone1, bgTone2] = [\n bg1(scheme).getTone(scheme),\n bg2(scheme).getTone(scheme),\n ];\n const [upper, lower] = [\n Math.max(bgTone1, bgTone2),\n Math.min(bgTone1, bgTone2),\n ];\n\n if (\n Contrast.ratioOfTones(upper, answer) >= desiredRatio &&\n Contrast.ratioOfTones(lower, answer) >= desiredRatio\n ) {\n return answer;\n }\n\n // The darkest light tone that satisfies the desired ratio,\n // or -1 if such ratio cannot be reached.\n const lightOption = Contrast.lighter(upper, desiredRatio);\n\n // The lightest dark tone that satisfies the desired ratio,\n // or -1 if such ratio cannot be reached.\n const darkOption = Contrast.darker(lower, desiredRatio);\n\n // Tones suitable for the foreground.\n const availables = [];\n if (lightOption !== -1) availables.push(lightOption);\n if (darkOption !== -1) availables.push(darkOption);\n\n const prefersLight =\n DynamicColor.tonePrefersLightForeground(bgTone1) ||\n DynamicColor.tonePrefersLightForeground(bgTone2);\n if (prefersLight) {\n return lightOption < 0 ? 100 : lightOption;\n }\n if (availables.length === 1) {\n return availables[0];\n }\n return darkOption < 0 ? 0 : darkOption;\n }\n\n return answer;\n }\n }\n}\n","import { hexFromArgb, TonalPalette } from '@material/material-color-utilities';\nimport { SchemeEntity } from '../../theme/entities/scheme.entity';\nimport { DynamicColor } from '../../material-color-utilities/dynamic_color';\nimport { ContrastCurve } from '../../material-color-utilities';\nimport mergeDeep from 'merge-deep';\nimport { SchemeService } from '../../theme/services/scheme.service';\nimport { ColorManagerService } from '../color-manager.service';\n\nexport interface ColorOptions {\n palette: (scheme: SchemeEntity) => TonalPalette;\n tone: (scheme: SchemeEntity) => number;\n isBackground?: boolean;\n background?: (scheme: SchemeEntity) => DynamicColor;\n secondBackground?: (scheme: SchemeEntity) => DynamicColor;\n contrastCurve?: ContrastCurve;\n toneDeltaPair?: (scheme: SchemeEntity) => {\n roleA: DynamicColor;\n readonly roleB: DynamicColor;\n readonly delta: number;\n readonly polarity: 'darker' | 'lighter' | 'nearer' | 'farther';\n readonly stayTogether: boolean;\n };\n}\n\nexport class ColorEntity {\n private dynamicColor: DynamicColor | null = null;\n\n constructor(\n private option: ColorOptions & { name: string },\n private schemeService: SchemeService,\n private colorService: ColorManagerService\n ) {}\n\n update(args: Partial<ColorOptions & { name: string }>) {\n this.dynamicColor = null;\n this.option = mergeDeep(this.option, args);\n }\n\n getHex(): string {\n return hexFromArgb(this.getArgb());\n }\n\n getArgb() {\n return this.getDynamicColor().getArgb(this.schemeService.get());\n }\n\n getName(): string {\n return this.option.name.replace(/([A-Z])/g, '_$1').toLowerCase();\n }\n\n getDynamicColor(): DynamicColor {\n if (!this.dynamicColor) {\n this.dynamicColor = DynamicColor.fromPalette({\n ...this.option,\n name: this.getName(),\n });\n }\n return this.dynamicColor;\n }\n}\n","import { Hct, TonalPalette } from '@material/material-color-utilities';\n\nexport interface SchemeOptions {\n sourceColorArgb: number;\n contrastLevel: number;\n isDark: boolean;\n palettes: Map<string, TonalPalette>;\n}\n\nexport class SchemeEntity {\n constructor(private options: SchemeOptions) {}\n\n get contrastLevel() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return this.options.contrastLevel;\n }\n\n get isDark() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return this.options.isDark;\n }\n\n get sourceColorHct() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return Hct.fromInt(this.options.sourceColorArgb);\n }\n\n getPalette(key: string): TonalPalette {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n const palette = this.options.palettes.get(key);\n if (!palette) {\n throw new Error(`Palette ${key} not found`);\n }\n return palette;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { SchemeEntity, SchemeOptions } from '../entities/scheme.entity';\nimport {\n argbFromHex,\n Hct,\n TonalPalette,\n} from '@material/material-color-utilities';\nimport mergeDeep from 'merge-deep';\n\nexport type SchemeServiceOptions = Omit<\n SchemeOptions,\n 'palettes' | 'sourceColorArgb'\n> & {\n sourceColorHex: string;\n palettes: Record<string, (sourceColorHct: Hct) => TonalPalette>;\n};\n\n@Injectable()\nexport class SchemeService {\n private schemeEntity?: SchemeEntity;\n private options?: SchemeServiceOptions;\n\n createOrUpdate(options: Partial<SchemeServiceOptions>) {\n this.options = mergeDeep(this.options, options);\n const palettes = new Map<string, TonalPalette>();\n\n const sourceColorArgb = argbFromHex(this.options.sourceColorHex);\n const sourceColorHct: Hct = Hct.fromInt(sourceColorArgb);\n\n if (!this.options.palettes) {\n return;\n }\n for (const [key, paletteFunction] of Object.entries(\n this.options.palettes\n )) {\n const palette: TonalPalette = paletteFunction(sourceColorHct);\n palettes.set(key, palette);\n }\n this.schemeEntity = new SchemeEntity({\n ...this.options,\n palettes: palettes,\n sourceColorArgb: sourceColorArgb,\n });\n }\n\n get(): SchemeEntity {\n if (!this.schemeEntity) {\n throw new Error('Scheme is not created');\n }\n return this.schemeEntity;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { ContrastCurve, ToneDeltaPair } from '../material-color-utilities';\nimport { DynamicColor } from '../material-color-utilities/dynamic_color';\nimport { SchemeEntity } from '../theme/entities/scheme.entity';\n\nimport { ColorEntity, ColorOptions } from './entities/color.entity';\nimport { SchemeService } from '../theme/services/scheme.service';\nimport { DynamicColorKey } from './models/default-color.model';\n\nfunction capitalizeFirstLetter(string: string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport const highestSurface = (\n s: SchemeEntity,\n colorManagerService: ColorManagerService\n): DynamicColor => {\n return s.isDark\n ? colorManagerService.get('surfaceBright').getDynamicColor()\n : colorManagerService.get('surfaceDim').getDynamicColor();\n};\n\n@Injectable()\nexport class ColorManagerService {\n private colorMap = new Map<string, ColorEntity>();\n constructor(private schemeService: SchemeService) {}\n\n createOrUpdate(\n key: string,\n args: Partial<Omit<ColorOptions, 'name'>>\n ): ColorEntity {\n let colorEntity = this.colorMap.get(key);\n if (!colorEntity) {\n const { palette, tone } = args;\n if (palette && tone) {\n colorEntity = new ColorEntity(\n { ...args, palette, tone, name: key },\n this.schemeService,\n this\n );\n this.colorMap.set(key, colorEntity);\n } else {\n throw new Error(`Palette ${key} does not exist`);\n }\n } else {\n colorEntity.update({ ...args, name: key });\n this.colorMap.set(key, colorEntity);\n }\n return colorEntity;\n }\n\n public remove(key: string) {\n return this.colorMap.delete(key);\n }\n\n public get(key: string): ColorEntity {\n const colorEntity = this.colorMap.get(key);\n if (colorEntity) {\n return colorEntity;\n } else {\n throw new Error(`Color ${key} does not exist`);\n }\n }\n\n public getAll(): ReadonlyMap<string, ColorEntity> {\n return this.colorMap;\n }\n\n addFromPalette(key: string): void {\n const colorKey = key as DynamicColorKey;\n const ColorKey = capitalizeFirstLetter(key);\n const onColorKey = ('on' + ColorKey) as DynamicColorKey;\n const colorKeyContainer = (colorKey + 'Container') as DynamicColorKey;\n const onColorKeyContainer = ('on' +\n ColorKey +\n 'Container') as DynamicColorKey;\n const inverseColorKey = ('inverse' + ColorKey) as DynamicColorKey;\n const colorKeyFixed = (colorKey + 'Fixed') as DynamicColorKey;\n const colorKeyFixedDim = (colorKey + 'FixedDim') as DynamicColorKey;\n const onColorKeyFixed = ('on' + ColorKey + 'Fixed') as DynamicColorKey;\n const onColorKeyFixedVariant = ('on' +\n ColorKey +\n 'FixedVariant') as DynamicColorKey;\n\n this.createOrUpdate(colorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 80 : 40;\n },\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyContainer).getDynamicColor(),\n this.get(colorKey).getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n });\n this.createOrUpdate(onColorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 20 : 100;\n },\n background: (s) => this.get(colorKey).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(colorKeyContainer, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 30 : 90;\n },\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyContainer).getDynamicColor(),\n this.get(colorKey).getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n });\n this.createOrUpdate(onColorKeyContainer, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 90 : 10;\n },\n background: (s) => this.get(colorKeyContainer).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(inverseColorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => (s.isDark ? 40 : 80),\n background: (s) => this.get('inverseSurface').getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n });\n this.createOrUpdate(colorKeyFixed, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 90.0,\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyFixed).getDynamicColor(),\n this.get(colorKeyFixedDim).getDynamicColor(),\n 10,\n 'lighter',\n true\n ),\n });\n this.createOrUpdate(colorKeyFixedDim, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 80.0,\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyFixed).getDynamicColor(),\n this.get(colorKeyFixedDim).getDynamicColor(),\n 10,\n 'lighter',\n true\n ),\n });\n this.createOrUpdate(onColorKeyFixed, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 10.0,\n background: (s) => this.get(colorKeyFixedDim).getDynamicColor(),\n secondBackground: (s) => this.get(colorKeyFixed).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(onColorKeyFixedVariant, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 30.0,\n background: (s) => this.get(colorKeyFixedDim).getDynamicColor(),\n secondBackground: (s) => this.get(colorKeyFixed).getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n });\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { ColorManagerService } from './color-manager.service';\nimport { ColorInterface } from './color.interface';\nimport { ColorEntity, ColorOptions } from './entities/color.entity';\n\n@Injectable()\nexport class ColorService implements ColorInterface {\n constructor(private colorManagerService: ColorManagerService) {}\n\n getAllColors() {\n return this.colorManagerService.getAll();\n }\n\n // getColors() {\n // const colors: Record<string, string> = {};\n //\n // for (const [key, value] of this.colorManagerService.getAll()) {\n // colors[key] = hexFromArgb(value.getArgb(this.schemeService.get()));\n // }\n //\n // return colors;\n // }\n //\n // addBaseColors() {\n // this.colorManagerService.addFromPalette('primary');\n // this.colorManagerService.addFromPalette('secondary');\n // this.colorManagerService.addFromPalette('tertiary');\n // for (const [key, value] of Object.entries(this.defaultColorModel.colors)) {\n // this.colorManagerService.createOrUpdate(key, value as any);\n // }\n // }\n\n addColor(key: string, color: ColorOptions): ColorEntity {\n return this.colorManagerService.createOrUpdate(key, color);\n }\n\n addColors(colors: Record<string, ColorOptions>): ColorEntity[] {\n return Object.keys(colors).map((key) => this.addColor(key, colors[key]));\n }\n\n getColor(key: string): ColorEntity {\n return this.colorManagerService.get(key);\n }\n\n removeColor(key: string): boolean {\n return this.colorManagerService.remove(key);\n }\n\n updateColor(key: string, newColor: Partial<ColorOptions>): ColorEntity {\n return this.colorManagerService.createOrUpdate(key, newColor);\n }\n}\n","import { SchemeService } from './scheme.service';\nimport { VariantEntity } from '../entities/variant.entity';\nimport { Injectable } from '@nestjs/common';\nimport { TonalPalette } from '@material/material-color-utilities';\n\n@Injectable()\nexport class VariantService {\n constructor(private schemeService: SchemeService) {}\n\n set(variantEntity: VariantEntity) {\n if (!variantEntity.palettes.error) {\n variantEntity.palettes.error = () =>\n TonalPalette.fromHueAndChroma(25.0, 84.0);\n }\n this.schemeService.createOrUpdate(variantEntity);\n }\n}\n","import { DynamicColor } from '@material/material-color-utilities';\nimport { Injectable } from '@nestjs/common';\nimport { SchemeService, SchemeServiceOptions } from './scheme.service';\nimport { VariantService } from './variant.service';\nimport { VariantEntity } from '../entities/variant.entity';\n\ntype ThemeOptions = Omit<SchemeServiceOptions, 'palettes'>;\n\nconst colorPaletteKeyColor = DynamicColor.fromPalette({\n name: 'primary_palette_key_color',\n palette: (s) => s.primaryPalette,\n tone: (s) => s.primaryPalette.keyColor.tone,\n});\n\n@Injectable()\nexport class ThemeService {\n constructor(\n private schemeService: SchemeService,\n private variantService: VariantService\n ) {\n // this.addPalette({key: \"primary\", addDefaultColors: true})\n // this.addPalette({key: \"secondary\", addDefaultColors: true})\n // this.addPalette({key: \"tertiary\", addDefaultColors: true})\n // this.addPalette({key: \"error\", palette: TonalPalette.fromHueAndChroma(25.0, 84.0)})\n // this.addPalette({key: \"neutral\"})\n // this.addPalette({key: \"neutralVariant\"})\n }\n // addPalette({key, palette, addDefaultColors}: {key: string; palette: TonalPalette; addDefaultColors: boolean}) {\n // this.themeOptions.palettes.set(key, palette);\n // if (addDefaultColors){\n // this.colorService.addPalette(key)\n // }\n // }\n\n // create(args: ThemeOptions): SchemeService {\n // return new SchemeService(args, this.colorService)\n // }\n //\n // update(options: Partial<ThemeOptions>): SchemeService {\n // Object.assign(this.themeOptions, options);\n // return this.theme();\n // }\n\n create(options: ThemeOptions) {\n this.schemeService.createOrUpdate(options);\n }\n\n addVariant(variant: VariantEntity) {\n this.variantService.set(variant);\n }\n\n update(options: Partial<ThemeOptions>) {\n this.schemeService.createOrUpdate(options);\n }\n // theme(): SchemeService {\n // return new SchemeService(this.themeOptions, this.colorService)\n // }\n}\n","import { Injectable } from '@nestjs/common';\nimport { ColorService } from './color/color.service';\nimport { ThemeService } from './theme/services/theme.service';\n\n@Injectable()\nexport class AppService {\n constructor(\n public colorService: ColorService,\n public themeService: ThemeService\n ) {}\n}\n","import { Module } from '@nestjs/common';\nimport { SchemeService } from './services/scheme.service';\nimport { ThemeService } from './services/theme.service';\nimport { VariantService } from './services/variant.service';\n\n@Module({\n providers: [SchemeService, ThemeService, VariantService],\n exports: [ThemeService, SchemeService],\n})\nexport class ThemeModule {}\n","import { ColorService } from './color.service';\nimport { Module } from '@nestjs/common';\nimport { ColorManagerService } from './color-manager.service';\nimport { ThemeModule } from '../theme/theme.module';\n\n@Module({\n imports: [ThemeModule],\n providers: [ColorService, ColorManagerService],\n exports: [ColorService],\n})\nexport class ColorModule {}\n","import { Module } from '@nestjs/common';\nimport { AppService } from './app.service';\nimport { ColorModule } from './color/color.module';\nimport { ThemeModule } from './theme/theme.module';\n\n@Module({\n imports: [ColorModule, ThemeModule],\n providers: [AppService],\n})\nexport class AppModule {}\n","import { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\nimport { AppService } from './app.service';\n\nexport async function main(): Promise<[AppService, () => Promise<void>]> {\n const app = await NestFactory.create(AppModule);\n const appService = app.get(AppService);\n\n const close = () => app.close();\n return [appService, close];\n}\n"],"names":["ContrastCurve","low","normal","medium","high","this","prototype","get","contrastLevel","lerp","ToneDeltaPair","roleA","roleB","delta","polarity","stayTogether","DynamicColor","name","palette","tone","isBackground","background","secondBackground","contrastCurve","toneDeltaPair","hctCache","Map","Error","fromPalette","args","_args$name","_args$isBackground","foregroundTone","bgTone","ratio","lighterTone","Contrast","lighterUnsafe","darkerTone","darkerUnsafe","lighterRatio","ratioOfTones","darkerRatio","tonePrefersLightForeground","negligibleDifference","Math","abs","round","toneAllowsLightForeground","enableLightForeground","_proto","getArgb","scheme","getHct","toInt","cachedAnswer","getTone","answer","size","clear","set","decreasingContrast","aIsNearer","isDark","nearer","farther","amNearer","expansionDir","nContrast","fContrast","nInitialTone","nTone","fInitialTone","fTone","clampDouble","max","min","desiredRatio","_ref","bg2","_ref2","bg1","bgTone1","bgTone2","_ref3","upper","lower","lightOption","lighter","darkOption","darker","availables","push","length","ColorEntity","option","schemeService","colorService","dynamicColor","update","mergeDeep","getHex","hexFromArgb","getDynamicColor","getName","replace","toLowerCase","_extends","SchemeEntity","options","getPalette","key","palettes","Hct","fromInt","sourceColorArgb","SchemeService","schemeEntity","createOrUpdate","argbFromHex","sourceColorHex","sourceColorHct","_i","_Object$entries","Object","entries","_Object$entries$_i","paletteFunction","__decorate","Injectable","highestSurface","s","colorManagerService","ColorManagerService","colorMap","colorEntity","remove","getAll","addFromPalette","string","_this","colorKey","ColorKey","charAt","toUpperCase","slice","onColorKey","colorKeyContainer","onColorKeyContainer","inverseColorKey","colorKeyFixed","colorKeyFixedDim","onColorKeyFixed","onColorKeyFixedVariant","ColorService","getAllColors","addColor","color","addColors","colors","keys","map","getColor","removeColor","updateColor","newColor","VariantService","variantEntity","error","TonalPalette","fromHueAndChroma","ThemeService","variantService","create","addVariant","variant","AppService","themeService","ThemeModule","ColorModule","AppModule","_main","_regeneratorRuntime","mark","_callee","app","appService","wrap","_context","prev","next","NestFactory","sent","abrupt","close","stop","apply","arguments","Module","imports","providers","exports"],"mappings":"+qOA0BA,IAAaA,EAAa,WASxB,SAAAA,EACWC,EACAC,EACAC,EAC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,UAAW,CAACpF,EAAeuD,EAAcL,GACzCmC,QAAS,CAAC9B,EAAcvD,MAEb8D,ICFXsB,UAAW,CAAC9C,EAAcrB,GAC1BoE,QAAS,CAAC/C,MAECyB,GCJYD,GACvBsB,UAAW,CAACxB,MAEDI,gBCLb,WAA0B,OAAAC,EAAAe,MAAA/L,KAAAgM,UAAA"}
|
|
1
|
+
{"version":3,"file":"theme.cjs.production.min.js","sources":["../src/material-color-utilities/contrastCurve.ts","../src/material-color-utilities/toneDeltaPair.ts","../src/material-color-utilities/dynamic_color.ts","../src/color/entities/color.entity.ts","../src/theme/entities/scheme.entity.ts","../src/theme/services/scheme.service.ts","../src/color/color-manager.service.ts","../src/color/models/default-color.model.ts","../src/color/color.service.ts","../src/theme/services/variant.service.ts","../src/theme/services/theme.service.ts","../src/app.service.ts","../src/theme/theme.module.ts","../src/color/color.module.ts","../src/app.module.ts","../src/main.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { lerp } from '@material/material-color-utilities';\n\n/**\n * A class containing a value that changes with the contrast level.\n *\n * Usually represents the contrast requirements for a dynamic color on its\n * background. The four values correspond to values for contrast levels -1.0,\n * 0.0, 0.5, and 1.0, respectively.\n */\nexport class ContrastCurve {\n /**\n * Creates a `ContrastCurve` object.\n *\n * @param low Value for contrast level -1.0\n * @param normal Value for contrast level 0.0\n * @param medium Value for contrast level 0.5\n * @param high Value for contrast level 1.0\n */\n constructor(\n readonly low: number,\n readonly normal: number,\n readonly medium: number,\n readonly high: number\n ) {}\n\n /**\n * Returns the value at a given contrast level.\n *\n * @param contrastLevel The contrast level. 0.0 is the default (normal); -1.0\n * is the lowest; 1.0 is the highest.\n * @return The value. For contrast ratios, a number between 1.0 and 21.0.\n */\n get(contrastLevel: number): number {\n if (contrastLevel <= -1.0) {\n return this.low;\n } else if (contrastLevel < 0.0) {\n return lerp(this.low, this.normal, (contrastLevel - -1) / 1);\n } else if (contrastLevel < 0.5) {\n return lerp(this.normal, this.medium, (contrastLevel - 0) / 0.5);\n } else if (contrastLevel < 1.0) {\n return lerp(this.medium, this.high, (contrastLevel - 0.5) / 0.5);\n } else {\n return this.high;\n }\n }\n}\n","/**\n * @license\n * Copyright 2023 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DynamicColor } from './dynamic_color';\n\n/**\n * Describes the different in tone between colors.\n */\nexport type TonePolarity = 'darker' | 'lighter' | 'nearer' | 'farther';\n\n/**\n * Documents a constraint between two DynamicColors, in which their tones must\n * have a certain distance from each other.\n *\n * Prefer a DynamicColor with a background, this is for special cases when\n * designers want tonal distance, literally contrast, between two colors that\n * don't have a background / foreground relationship or a contrast guarantee.\n */\nexport class ToneDeltaPair {\n /**\n * Documents a constraint in tone distance between two DynamicColors.\n *\n * The polarity is an adjective that describes \"A\", compared to \"B\".\n *\n * For instance, ToneDeltaPair(A, B, 15, 'darker', stayTogether) states that\n * A's tone should be at least 15 darker than B's.\n *\n * 'nearer' and 'farther' describes closeness to the surface roles. For\n * instance, ToneDeltaPair(A, B, 10, 'nearer', stayTogether) states that A\n * should be 10 lighter than B in light mode, and 10 darker than B in dark\n * mode.\n *\n * @param roleA The first role in a pair.\n * @param roleB The second role in a pair.\n * @param delta Required difference between tones. Absolute value, negative\n * values have undefined behavior.\n * @param polarity The relative relation between tones of roleA and roleB,\n * as described above.\n * @param stayTogether Whether these two roles should stay on the same side of\n * the \"awkward zone\" (T50-59). This is necessary for certain cases where\n * one role has two backgrounds.\n */\n constructor(\n readonly roleA: DynamicColor,\n readonly roleB: DynamicColor,\n readonly delta: number,\n readonly polarity: TonePolarity,\n readonly stayTogether: boolean\n ) {}\n}\n","/**\n * @license\n * Copyright 2022 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n clampDouble,\n Contrast,\n Hct,\n TonalPalette,\n} from '@material/material-color-utilities';\nimport { ContrastCurve } from './contrastCurve';\nimport { ToneDeltaPair } from './toneDeltaPair';\nimport { SchemeEntity } from '../theme/entities/scheme.entity';\n\n/**\n * @param name The name of the dynamic color. Defaults to empty.\n * @param palette Function that provides a TonalPalette given\n * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this\n * replaces the need to specify hue/chroma. By providing a tonal palette, when\n * contrast adjustments are made, intended chroma can be preserved.\n * @param tone Function that provides a tone given SchemeEntity.\n * @param isBackground Whether this dynamic color is a background, with\n * some other color as the foreground. Defaults to false.\n * @param background The background of the dynamic color (as a function of a\n * `SchemeEntity`), if it exists.\n * @param secondBackground A second background of the dynamic color (as a\n * function of a `SchemeEntity`), if it\n * exists.\n * @param contrastCurve A `ContrastCurve` object specifying how its contrast\n * against its background should behave in various contrast levels options.\n * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta\n * constraint between two colors. One of them must be the color being\n * constructed.\n */\ninterface FromPaletteOptions {\n name?: string;\n palette: (scheme: SchemeEntity) => TonalPalette;\n tone: (scheme: SchemeEntity) => number;\n isBackground?: boolean;\n background?: (scheme: SchemeEntity) => DynamicColor;\n secondBackground?: (scheme: SchemeEntity) => DynamicColor;\n contrastCurve?: ContrastCurve;\n toneDeltaPair?: (scheme: SchemeEntity) => ToneDeltaPair;\n}\n\n/**\n * A color that adjusts itself based on UI state provided by SchemeEntity.\n *\n * Colors without backgrounds do not change tone when contrast changes. Colors\n * with backgrounds become closer to their background as contrast lowers, and\n * further when contrast increases.\n *\n * Prefer static constructors. They require either a hexcode, a palette and\n * tone, or a hue and chroma. Optionally, they can provide a background\n * DynamicColor.\n */\nexport class DynamicColor {\n private readonly hctCache = new Map<SchemeEntity, Hct>();\n\n /**\n * The base constructor for DynamicColor.\n *\n * _Strongly_ prefer using one of the convenience constructors. This class is\n * arguably too flexible to ensure it can support any scenario. Functional\n * arguments allow overriding without risks that come with subclasses.\n *\n * For example, the default behavior of adjust tone at max contrast\n * to be at a 7.0 ratio with its background is principled and\n * matches accessibility guidance. That does not mean it's the desired\n * approach for _every_ design system, and every color pairing,\n * always, in every case.\n *\n * @param name The name of the dynamic color. Defaults to empty.\n * @param palette Function that provides a TonalPalette given\n * SchemeEntity. A TonalPalette is defined by a hue and chroma, so this\n * replaces the need to specify hue/chroma. By providing a tonal palette, when\n * contrast adjustments are made, intended chroma can be preserved.\n * @param tone Function that provides a tone, given a SchemeEntity.\n * @param isBackground Whether this dynamic color is a background, with\n * some other color as the foreground. Defaults to false.\n * @param background The background of the dynamic color (as a function of a\n * `SchemeEntity`), if it exists.\n * @param secondBackground A second background of the dynamic color (as a\n * function of a `SchemeEntity`), if it\n * exists.\n * @param contrastCurve A `ContrastCurve` object specifying how its contrast\n * against its background should behave in various contrast levels options.\n * @param toneDeltaPair A `ToneDeltaPair` object specifying a tone delta\n * constraint between two colors. One of them must be the color being\n * constructed.\n */\n constructor(\n readonly name: string,\n readonly palette: (scheme: SchemeEntity) => TonalPalette,\n readonly tone: (scheme: SchemeEntity) => number,\n readonly isBackground: boolean,\n readonly background?: (scheme: SchemeEntity) => DynamicColor,\n readonly secondBackground?: (scheme: SchemeEntity) => DynamicColor,\n readonly contrastCurve?: ContrastCurve,\n readonly toneDeltaPair?: (scheme: SchemeEntity) => ToneDeltaPair\n ) {\n if (!background && secondBackground) {\n throw new Error(\n `Color ${name} has secondBackground` +\n `defined, but background is not defined.`\n );\n }\n if (!background && contrastCurve) {\n throw new Error(\n `Color ${name} has contrastCurve` +\n `defined, but background is not defined.`\n );\n }\n if (background && !contrastCurve) {\n throw new Error(\n `Color ${name} has background` +\n `defined, but contrastCurve is not defined.`\n );\n }\n }\n\n /**\n * Create a DynamicColor defined by a TonalPalette and HCT tone.\n *\n * @param args Functions with SchemeEntity as input. Must provide a palette\n * and tone. May provide a background DynamicColor and ToneDeltaConstraint.\n */\n static fromPalette(args: FromPaletteOptions): DynamicColor {\n return new DynamicColor(\n args.name ?? '',\n args.palette,\n args.tone,\n args.isBackground ?? false,\n args.background,\n args.secondBackground,\n args.contrastCurve,\n args.toneDeltaPair\n );\n }\n\n /**\n * Given a background tone, find a foreground tone, while ensuring they reach\n * a contrast ratio that is as close to [ratio] as possible.\n *\n * @param bgTone Tone in HCT. Range is 0 to 100, undefined behavior when it\n * falls outside that range.\n * @param ratio The contrast ratio desired between bgTone and the return\n * value.\n */\n static foregroundTone(bgTone: number, ratio: number): number {\n const lighterTone = Contrast.lighterUnsafe(bgTone, ratio);\n const darkerTone = Contrast.darkerUnsafe(bgTone, ratio);\n const lighterRatio = Contrast.ratioOfTones(lighterTone, bgTone);\n const darkerRatio = Contrast.ratioOfTones(darkerTone, bgTone);\n const preferLighter = DynamicColor.tonePrefersLightForeground(bgTone);\n\n if (preferLighter) {\n // This handles an edge case where the initial contrast ratio is high\n // (ex. 13.0), and the ratio passed to the function is that high\n // ratio, and both the lighter and darker ratio fails to pass that\n // ratio.\n //\n // This was observed with Tonal Spot's On Primary Container turning\n // black momentarily between high and max contrast in light mode. PC's\n // standard tone was T90, OPC's was T10, it was light mode, and the\n // contrast value was 0.6568521221032331.\n const negligibleDifference =\n Math.abs(lighterRatio - darkerRatio) < 0.1 &&\n lighterRatio < ratio &&\n darkerRatio < ratio;\n return lighterRatio >= ratio ||\n lighterRatio >= darkerRatio ||\n negligibleDifference\n ? lighterTone\n : darkerTone;\n } else {\n return darkerRatio >= ratio || darkerRatio >= lighterRatio\n ? darkerTone\n : lighterTone;\n }\n }\n\n /**\n * Returns whether [tone] prefers a light foreground.\n *\n * People prefer white foregrounds on ~T60-70. Observed over time, and also\n * by Andrew Somers during research for APCA.\n *\n * T60 used as to create the smallest discontinuity possible when skipping\n * down to T49 in order to ensure light foregrounds.\n * Since `tertiaryContainer` in dark monochrome scheme requires a tone of\n * 60, it should not be adjusted. Therefore, 60 is excluded here.\n */\n static tonePrefersLightForeground(tone: number): boolean {\n return Math.round(tone) < 60.0;\n }\n\n /**\n * Returns whether [tone] can reach a contrast ratio of 4.5 with a lighter\n * color.\n */\n static toneAllowsLightForeground(tone: number): boolean {\n return Math.round(tone) <= 49.0;\n }\n\n /**\n * Adjust a tone such that white has 4.5 contrast, if the tone is\n * reasonably close to supporting it.\n */\n static enableLightForeground(tone: number): number {\n if (\n DynamicColor.tonePrefersLightForeground(tone) &&\n !DynamicColor.toneAllowsLightForeground(tone)\n ) {\n return 49.0;\n }\n return tone;\n }\n\n /**\n * Return a ARGB integer (i.e. a hex code).\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getArgb(scheme: SchemeEntity): number {\n return this.getHct(scheme).toInt();\n }\n\n /**\n * Return a color, expressed in the HCT color space, that this\n * DynamicColor is under the conditions in scheme.\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getHct(scheme: SchemeEntity): Hct {\n const cachedAnswer = this.hctCache.get(scheme);\n if (cachedAnswer != null) {\n return cachedAnswer;\n }\n const tone = this.getTone(scheme);\n const answer = this.palette(scheme).getHct(tone);\n if (this.hctCache.size > 4) {\n this.hctCache.clear();\n }\n this.hctCache.set(scheme, answer);\n return answer;\n }\n\n /**\n * Return a tone, T in the HCT color space, that this DynamicColor is under\n * the conditions in scheme.\n *\n * @param scheme Defines the conditions of the user interface, for example,\n * whether or not it is dark mode or light mode, and what the desired\n * contrast level is.\n */\n getTone(scheme: SchemeEntity): number {\n const decreasingContrast = scheme.contrastLevel < 0;\n\n // Case 1: dual foreground, pair of colors with delta constraint.\n if (this.toneDeltaPair) {\n const toneDeltaPair = this.toneDeltaPair(scheme);\n const roleA = toneDeltaPair.roleA;\n const roleB = toneDeltaPair.roleB;\n const delta = toneDeltaPair.delta;\n const polarity = toneDeltaPair.polarity;\n const stayTogether = toneDeltaPair.stayTogether;\n\n const bg = this.background!(scheme);\n const bgTone = bg.getTone(scheme);\n\n const aIsNearer =\n polarity === 'nearer' ||\n (polarity === 'lighter' && !scheme.isDark) ||\n (polarity === 'darker' && scheme.isDark);\n const nearer = aIsNearer ? roleA : roleB;\n const farther = aIsNearer ? roleB : roleA;\n const amNearer = this.name === nearer.name;\n const expansionDir = scheme.isDark ? 1 : -1;\n\n // 1st round: solve to min, each\n const nContrast = nearer.contrastCurve!.get(scheme.contrastLevel);\n const fContrast = farther.contrastCurve!.get(scheme.contrastLevel);\n\n // If a color is good enough, it is not adjusted.\n // Initial and adjusted tones for `nearer`\n const nInitialTone = nearer.tone(scheme);\n let nTone =\n Contrast.ratioOfTones(bgTone, nInitialTone) >= nContrast\n ? nInitialTone\n : DynamicColor.foregroundTone(bgTone, nContrast);\n // Initial and adjusted tones for `farther`\n const fInitialTone = farther.tone(scheme);\n let fTone =\n Contrast.ratioOfTones(bgTone, fInitialTone) >= fContrast\n ? fInitialTone\n : DynamicColor.foregroundTone(bgTone, fContrast);\n\n if (decreasingContrast) {\n // If decreasing contrast, adjust color to the \"bare minimum\"\n // that satisfies contrast.\n nTone = DynamicColor.foregroundTone(bgTone, nContrast);\n fTone = DynamicColor.foregroundTone(bgTone, fContrast);\n }\n\n if ((fTone - nTone) * expansionDir >= delta) {\n // Good! Tones satisfy the constraint; no change needed.\n } else {\n // 2nd round: expand farther to match delta.\n fTone = clampDouble(0, 100, nTone + delta * expansionDir);\n if ((fTone - nTone) * expansionDir >= delta) {\n // Good! Tones now satisfy the constraint; no change needed.\n } else {\n // 3rd round: contract nearer to match delta.\n nTone = clampDouble(0, 100, fTone - delta * expansionDir);\n }\n }\n\n // Avoids the 50-59 awkward zone.\n if (50 <= nTone && nTone < 60) {\n // If `nearer` is in the awkward zone, move it away, together with\n // `farther`.\n if (expansionDir > 0) {\n nTone = 60;\n fTone = Math.max(fTone, nTone + delta * expansionDir);\n } else {\n nTone = 49;\n fTone = Math.min(fTone, nTone + delta * expansionDir);\n }\n } else if (50 <= fTone && fTone < 60) {\n if (stayTogether) {\n // Fixes both, to avoid two colors on opposite sides of the \"awkward\n // zone\".\n if (expansionDir > 0) {\n nTone = 60;\n fTone = Math.max(fTone, nTone + delta * expansionDir);\n } else {\n nTone = 49;\n fTone = Math.min(fTone, nTone + delta * expansionDir);\n }\n } else {\n // Not required to stay together; fixes just one.\n if (expansionDir > 0) {\n fTone = 60;\n } else {\n fTone = 49;\n }\n }\n }\n\n // Returns `nTone` if this color is `nearer`, otherwise `fTone`.\n return amNearer ? nTone : fTone;\n } else {\n // Case 2: No contrast pair; just solve for itself.\n let answer = this.tone(scheme);\n\n if (this.background == null) {\n return answer; // No adjustment for colors with no background.\n }\n\n const bgTone = this.background(scheme).getTone(scheme);\n\n const desiredRatio = this.contrastCurve!.get(scheme.contrastLevel);\n\n if (Contrast.ratioOfTones(bgTone, answer) >= desiredRatio) {\n // Don't \"improve\" what's good enough.\n } else {\n // Rough improvement.\n answer = DynamicColor.foregroundTone(bgTone, desiredRatio);\n }\n\n if (decreasingContrast) {\n answer = DynamicColor.foregroundTone(bgTone, desiredRatio);\n }\n\n if (this.isBackground && 50 <= answer && answer < 60) {\n // Must adjust\n if (Contrast.ratioOfTones(49, bgTone) >= desiredRatio) {\n answer = 49;\n } else {\n answer = 60;\n }\n }\n\n if (this.secondBackground) {\n // Case 3: Adjust for dual backgrounds.\n\n const [bg1, bg2] = [this.background, this.secondBackground];\n const [bgTone1, bgTone2] = [\n bg1(scheme).getTone(scheme),\n bg2(scheme).getTone(scheme),\n ];\n const [upper, lower] = [\n Math.max(bgTone1, bgTone2),\n Math.min(bgTone1, bgTone2),\n ];\n\n if (\n Contrast.ratioOfTones(upper, answer) >= desiredRatio &&\n Contrast.ratioOfTones(lower, answer) >= desiredRatio\n ) {\n return answer;\n }\n\n // The darkest light tone that satisfies the desired ratio,\n // or -1 if such ratio cannot be reached.\n const lightOption = Contrast.lighter(upper, desiredRatio);\n\n // The lightest dark tone that satisfies the desired ratio,\n // or -1 if such ratio cannot be reached.\n const darkOption = Contrast.darker(lower, desiredRatio);\n\n // Tones suitable for the foreground.\n const availables = [];\n if (lightOption !== -1) availables.push(lightOption);\n if (darkOption !== -1) availables.push(darkOption);\n\n const prefersLight =\n DynamicColor.tonePrefersLightForeground(bgTone1) ||\n DynamicColor.tonePrefersLightForeground(bgTone2);\n if (prefersLight) {\n return lightOption < 0 ? 100 : lightOption;\n }\n if (availables.length === 1) {\n return availables[0];\n }\n return darkOption < 0 ? 0 : darkOption;\n }\n\n return answer;\n }\n }\n}\n","import { hexFromArgb, TonalPalette } from '@material/material-color-utilities';\nimport { SchemeEntity } from '../../theme/entities/scheme.entity';\nimport { DynamicColor } from '../../material-color-utilities/dynamic_color';\nimport { ContrastCurve } from '../../material-color-utilities';\nimport { SchemeService } from '../../theme/services/scheme.service';\nimport { ColorManagerService } from '../color-manager.service';\n\nexport interface ColorOptions {\n palette: (scheme: SchemeEntity) => TonalPalette;\n tone: (scheme: SchemeEntity) => number;\n isBackground?: boolean;\n background?: (scheme: SchemeEntity) => DynamicColor;\n secondBackground?: (scheme: SchemeEntity) => DynamicColor;\n contrastCurve?: ContrastCurve;\n toneDeltaPair?: (scheme: SchemeEntity) => {\n roleA: DynamicColor;\n readonly roleB: DynamicColor;\n readonly delta: number;\n readonly polarity: 'darker' | 'lighter' | 'nearer' | 'farther';\n readonly stayTogether: boolean;\n };\n}\n\nexport class ColorEntity {\n private dynamicColor: DynamicColor | null = null;\n\n constructor(\n private option: ColorOptions & { name: string },\n private schemeService: SchemeService,\n private colorService: ColorManagerService\n ) {}\n\n update(args: Partial<ColorOptions & { name: string }>) {\n this.dynamicColor = null;\n this.option = { ...this.option, ...args };\n }\n\n getHex(): string {\n return hexFromArgb(this.getArgb());\n }\n\n getArgb() {\n return this.getDynamicColor().getArgb(this.schemeService.get());\n }\n\n getName(): string {\n return this.option.name.replace(/([A-Z])/g, '_$1').toLowerCase();\n }\n\n getDynamicColor(): DynamicColor {\n if (!this.dynamicColor) {\n this.dynamicColor = DynamicColor.fromPalette({\n ...this.option,\n name: this.getName(),\n });\n }\n return this.dynamicColor;\n }\n}\n","import { Hct, TonalPalette } from '@material/material-color-utilities';\n\nexport interface SchemeOptions {\n sourceColorArgb: number;\n contrastLevel: number;\n isDark: boolean;\n palettes: Map<string, TonalPalette>;\n}\n\nexport class SchemeEntity {\n constructor(private options: SchemeOptions) {}\n\n get contrastLevel() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return this.options.contrastLevel;\n }\n\n get isDark() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return this.options.isDark;\n }\n\n get sourceColorHct() {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n return Hct.fromInt(this.options.sourceColorArgb);\n }\n\n getPalette(key: string): TonalPalette {\n if (!this.options) {\n throw new Error('Scheme options is not set');\n }\n const palette = this.options.palettes.get(key);\n if (!palette) {\n throw new Error(`Palette ${key} not found`);\n }\n return palette;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { SchemeEntity, SchemeOptions } from '../entities/scheme.entity';\nimport {\n argbFromHex,\n Hct,\n TonalPalette,\n} from '@material/material-color-utilities';\nimport mergeDeep from 'merge-deep';\n\nexport type SchemeServiceOptions = Omit<\n SchemeOptions,\n 'palettes' | 'sourceColorArgb'\n> & {\n sourceColorHex: string;\n palettes: Record<string, (sourceColorHct: Hct) => TonalPalette>;\n};\n\n@Injectable()\nexport class SchemeService {\n private schemeEntity?: SchemeEntity;\n private options?: SchemeServiceOptions;\n\n createOrUpdate(options: Partial<SchemeServiceOptions>) {\n this.options = mergeDeep(options, this.options);\n const palettes = new Map<string, TonalPalette>();\n\n const sourceColorArgb = argbFromHex(this.options.sourceColorHex);\n const sourceColorHct: Hct = Hct.fromInt(sourceColorArgb);\n\n if (!this.options.palettes) {\n return;\n }\n for (const [key, paletteFunction] of Object.entries(\n this.options.palettes\n )) {\n const palette: TonalPalette = paletteFunction(sourceColorHct);\n palettes.set(key, palette);\n }\n this.schemeEntity = new SchemeEntity({\n ...this.options,\n palettes: palettes,\n sourceColorArgb: sourceColorArgb,\n });\n }\n\n get(): SchemeEntity {\n if (!this.schemeEntity) {\n throw new Error('Scheme is not created');\n }\n return this.schemeEntity;\n }\n}\n","import { Injectable } from '@nestjs/common';\nimport { ContrastCurve, ToneDeltaPair } from '../material-color-utilities';\nimport { DynamicColor } from '../material-color-utilities/dynamic_color';\nimport { SchemeEntity } from '../theme/entities/scheme.entity';\n\nimport { ColorEntity, ColorOptions } from './entities/color.entity';\nimport { SchemeService } from '../theme/services/scheme.service';\nimport { DynamicColorKey } from './models/default-color.model';\n\nfunction capitalizeFirstLetter(string: string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\n\nexport const highestSurface = (\n s: SchemeEntity,\n colorManagerService: ColorManagerService\n): DynamicColor => {\n return s.isDark\n ? colorManagerService.get('surfaceBright').getDynamicColor()\n : colorManagerService.get('surfaceDim').getDynamicColor();\n};\n\n@Injectable()\nexport class ColorManagerService {\n private colorMap = new Map<string, ColorEntity>();\n constructor(private schemeService: SchemeService) {}\n\n createOrUpdate(key: string, args: Partial<ColorOptions>): ColorEntity {\n let colorEntity = this.colorMap.get(key);\n if (!colorEntity) {\n const { palette, tone } = args;\n if (palette && tone) {\n colorEntity = new ColorEntity(\n { ...args, palette, tone, name: key },\n this.schemeService,\n this\n );\n this.colorMap.set(key, colorEntity);\n } else {\n throw new Error(`Palette ${key} does not exist`);\n }\n } else {\n colorEntity.update({ ...args, name: key });\n this.colorMap.set(key, colorEntity);\n }\n return colorEntity;\n }\n\n public remove(key: string) {\n return this.colorMap.delete(key);\n }\n\n public get(key: string): ColorEntity {\n const colorEntity = this.colorMap.get(key);\n if (colorEntity) {\n return colorEntity;\n } else {\n throw new Error(`Color ${key} does not exist`);\n }\n }\n\n public getAll(): ReadonlyMap<string, ColorEntity> {\n return this.colorMap;\n }\n\n addFromPalette(key: string): void {\n const colorKey = key as DynamicColorKey;\n const ColorKey = capitalizeFirstLetter(key);\n const onColorKey = ('on' + ColorKey) as DynamicColorKey;\n const colorKeyContainer = (colorKey + 'Container') as DynamicColorKey;\n const onColorKeyContainer = ('on' +\n ColorKey +\n 'Container') as DynamicColorKey;\n const inverseColorKey = ('inverse' + ColorKey) as DynamicColorKey;\n const colorKeyFixed = (colorKey + 'Fixed') as DynamicColorKey;\n const colorKeyFixedDim = (colorKey + 'FixedDim') as DynamicColorKey;\n const onColorKeyFixed = ('on' + ColorKey + 'Fixed') as DynamicColorKey;\n const onColorKeyFixedVariant = ('on' +\n ColorKey +\n 'FixedVariant') as DynamicColorKey;\n\n this.createOrUpdate(colorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 80 : 40;\n },\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyContainer).getDynamicColor(),\n this.get(colorKey).getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n });\n this.createOrUpdate(onColorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 20 : 100;\n },\n background: (s) => this.get(colorKey).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(colorKeyContainer, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 30 : 90;\n },\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyContainer).getDynamicColor(),\n this.get(colorKey).getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n });\n this.createOrUpdate(onColorKeyContainer, {\n palette: (s) => s.getPalette(key),\n tone: (s) => {\n return s.isDark ? 90 : 10;\n },\n background: (s) => this.get(colorKeyContainer).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(inverseColorKey, {\n palette: (s) => s.getPalette(key),\n tone: (s) => (s.isDark ? 40 : 80),\n background: (s) => this.get('inverseSurface').getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n });\n this.createOrUpdate(colorKeyFixed, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 90.0,\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyFixed).getDynamicColor(),\n this.get(colorKeyFixedDim).getDynamicColor(),\n 10,\n 'lighter',\n true\n ),\n });\n this.createOrUpdate(colorKeyFixedDim, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 80.0,\n isBackground: true,\n background: (s) => highestSurface(s, this),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n this.get(colorKeyFixed).getDynamicColor(),\n this.get(colorKeyFixedDim).getDynamicColor(),\n 10,\n 'lighter',\n true\n ),\n });\n this.createOrUpdate(onColorKeyFixed, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 10.0,\n background: (s) => this.get(colorKeyFixedDim).getDynamicColor(),\n secondBackground: (s) => this.get(colorKeyFixed).getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n });\n this.createOrUpdate(onColorKeyFixedVariant, {\n palette: (s) => s.getPalette(key),\n tone: (s) => 30.0,\n background: (s) => this.get(colorKeyFixedDim).getDynamicColor(),\n secondBackground: (s) => this.get(colorKeyFixed).getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n });\n }\n}\n","import { DislikeAnalyzer, Hct } from '@material/material-color-utilities';\nimport { ContrastCurve, ToneDeltaPair } from '../../material-color-utilities';\nimport { DynamicColor } from '../../material-color-utilities/dynamic_color';\nimport { ColorOptions } from '../entities/color.entity';\nimport { ColorManagerService, highestSurface } from '../color-manager.service';\n\nexport type DynamicColorKey =\n | 'background'\n | 'onBackground'\n | 'surface'\n | 'surfaceDim'\n | 'surfaceBright'\n | 'surfaceContainerLowest'\n | 'surfaceContainerLow'\n | 'surfaceContainer'\n | 'surfaceContainerHigh'\n | 'surfaceContainerHighest'\n | 'onSurface'\n | 'surfaceVariant'\n | 'onSurfaceVariant'\n | 'inverseSurface'\n | 'inverseOnSurface'\n | 'outline'\n | 'outlineVariant'\n | 'shadow'\n | 'scrim'\n | 'surfaceTint'\n | 'primary'\n | 'onPrimary'\n | 'primaryContainer'\n | 'onPrimaryContainer'\n | 'inversePrimary'\n | 'secondary'\n | 'onSecondary'\n | 'secondaryContainer'\n | 'onSecondaryContainer'\n | 'tertiary'\n | 'onTertiary'\n | 'tertiaryContainer'\n | 'onTertiaryContainer'\n | 'error'\n | 'onError'\n | 'errorContainer'\n | 'onErrorContainer'\n | 'primaryFixed'\n | 'primaryFixedDim'\n | 'onPrimaryFixed'\n | 'onPrimaryFixedVariant'\n | 'secondaryFixed'\n | 'secondaryFixedDim'\n | 'onSecondaryFixed'\n | 'onSecondaryFixedVariant'\n | 'tertiaryFixed'\n | 'tertiaryFixedDim'\n | 'onTertiaryFixed'\n | 'onTertiaryFixedVariant';\n\nfunction findDesiredChromaByTone(\n hue: number,\n chroma: number,\n tone: number,\n byDecreasingTone: boolean\n): number {\n let answer = tone;\n\n let closestToChroma = Hct.from(hue, chroma, tone);\n if (closestToChroma.chroma < chroma) {\n let chromaPeak = closestToChroma.chroma;\n while (closestToChroma.chroma < chroma) {\n answer += byDecreasingTone ? -1.0 : 1.0;\n const potentialSolution = Hct.from(hue, chroma, answer);\n if (chromaPeak > potentialSolution.chroma) {\n break;\n }\n if (Math.abs(potentialSolution.chroma - chroma) < 0.4) {\n break;\n }\n\n const potentialDelta = Math.abs(potentialSolution.chroma - chroma);\n const currentDelta = Math.abs(closestToChroma.chroma - chroma);\n if (potentialDelta < currentDelta) {\n closestToChroma = potentialSolution;\n }\n chromaPeak = Math.max(chromaPeak, potentialSolution.chroma);\n }\n }\n\n return answer;\n}\n\nexport const defaultColors = (\n colorManagerService: ColorManagerService\n): Partial<Record<DynamicColorKey, Partial<ColorOptions>>> => ({\n background: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 6 : 98),\n isBackground: true,\n },\n onBackground: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 90 : 10),\n background: (s) => colorManagerService.get('background').getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 3, 4.5, 7),\n },\n surface: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 6 : 98),\n isBackground: true,\n },\n surfaceDim: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 6 : 87),\n isBackground: true,\n },\n surfaceBright: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 24 : 98),\n isBackground: true,\n },\n surfaceContainerLowest: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 4 : 100),\n isBackground: true,\n },\n surfaceContainerLow: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 10 : 96),\n isBackground: true,\n },\n surfaceContainer: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 12 : 94),\n isBackground: true,\n },\n surfaceContainerHigh: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 17 : 92),\n isBackground: true,\n },\n surfaceContainerHighest: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 22 : 90),\n isBackground: true,\n },\n onSurface: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 90 : 10),\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n },\n surfaceVariant: {\n palette: (s) => s.getPalette('neutralVariant'),\n tone: (s) => (s.isDark ? 30 : 90),\n isBackground: true,\n },\n onSurfaceVariant: {\n palette: (s) => s.getPalette('neutralVariant'),\n tone: (s) => (s.isDark ? 80 : 30),\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n },\n inverseSurface: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 90 : 20),\n },\n inverseOnSurface: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 20 : 95),\n background: (s) =>\n colorManagerService.get('inverseSurface').getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n },\n outline: {\n palette: (s) => s.getPalette('neutralVariant'),\n tone: (s) => (s.isDark ? 60 : 50),\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(1.5, 3, 4.5, 7),\n },\n outlineVariant: {\n palette: (s) => s.getPalette('neutralVariant'),\n tone: (s) => (s.isDark ? 30 : 80),\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n },\n shadow: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => 0,\n },\n scrim: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => 0,\n },\n surfaceTint: {\n palette: (s) => s.getPalette('neutral'),\n tone: (s) => (s.isDark ? 80 : 40),\n isBackground: true,\n },\n secondaryContainer: {\n tone: (s) => {\n const initialTone = s.isDark ? 30 : 90;\n return findDesiredChromaByTone(\n s.getPalette('secondary').hue,\n s.getPalette('secondary').chroma,\n initialTone,\n !s.isDark\n );\n },\n },\n onSecondaryContainer: {\n tone: (s) => {\n return DynamicColor.foregroundTone(\n colorManagerService.get('secondaryContainer').getDynamicColor().tone(s),\n 4.5\n );\n },\n },\n tertiaryContainer: {\n palette: (s) => s.getPalette('tertiary'),\n tone: (s) => {\n const proposedHct = s\n .getPalette('tertiary')\n .getHct(s.sourceColorHct.tone);\n return DislikeAnalyzer.fixIfDisliked(proposedHct).tone;\n },\n },\n onTertiaryContainer: {\n palette: (s) => s.getPalette('tertiary'),\n tone: (s) => {\n return DynamicColor.foregroundTone(\n colorManagerService.get('tertiaryContainer').getDynamicColor().tone(s),\n 4.5\n );\n },\n },\n error: {\n palette: (s) => s.getPalette('error'),\n tone: (s) => (s.isDark ? 80 : 40),\n isBackground: true,\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n colorManagerService.get('errorContainer').getDynamicColor(),\n colorManagerService.get('error').getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n },\n onError: {\n palette: (s) => s.getPalette('error'),\n tone: (s) => (s.isDark ? 20 : 100),\n background: (s) => colorManagerService.get('error').getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n },\n errorContainer: {\n palette: (s) => s.getPalette('error'),\n tone: (s) => (s.isDark ? 30 : 90),\n isBackground: true,\n background: (s) => highestSurface(s, colorManagerService),\n contrastCurve: new ContrastCurve(1, 1, 3, 7),\n toneDeltaPair: (s) =>\n new ToneDeltaPair(\n colorManagerService.get('errorContainer').getDynamicColor(),\n colorManagerService.get('error').getDynamicColor(),\n 15,\n 'nearer',\n false\n ),\n },\n onErrorContainer: {\n palette: (s) => s.getPalette('error'),\n tone: (s) => (s.isDark ? 90 : 10),\n background: (s) =>\n colorManagerService.get('errorContainer').getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n },\n\n onTertiaryFixed: {\n palette: (s) => s.getPalette('tertiary'),\n tone: (s) => 10.0,\n background: (s) =>\n colorManagerService.get('tertiaryFixedDim').getDynamicColor(),\n secondBackground: (s) =>\n colorManagerService.get('tertiaryFixed').getDynamicColor(),\n contrastCurve: new ContrastCurve(4.5, 7, 11, 21),\n },\n onTertiaryFixedVariant: {\n palette: (s) => s.getPalette('tertiary'),\n tone: (s) => 30.0,\n background: (s) =>\n colorManagerService.get('tertiaryFixedDim').getDynamicColor(),\n secondBackground: (s) =>\n colorManagerService.get('tertiaryFixed').getDynamicColor(),\n contrastCurve: new ContrastCurve(3, 4.5, 7, 11),\n },\n});\n","import { Injectable } from '@nestjs/common';\nimport { ColorManagerService } from './color-manager.service';\nimport { ColorInterface } from './color.interface';\nimport { ColorEntity, ColorOptions } from './entities/color.entity';\nimport { defaultColors, DynamicColorKey } from './models/default-color.model';\n\n@Injectable()\nexport class ColorService implements ColorInterface {\n constructor(private colorManagerService: ColorManagerService) {}\n\n getAllColors() {\n return this.colorManagerService.getAll();\n }\n\n // getColors() {\n // const colors: Record<string, string> = {};\n //\n // for (const [key, value] of this.colorManagerService.getAll()) {\n // colors[key] = hexFromArgb(value.getArgb(this.schemeService.get()));\n // }\n //\n // return colors;\n // }\n\n addBaseColors() {\n this.colorManagerService.addFromPalette('primary');\n this.colorManagerService.addFromPalette('secondary');\n this.colorManagerService.addFromPalette('tertiary');\n\n const colors = defaultColors(this.colorManagerService);\n Object.keys(colors).map((key) => {\n const color: Partial<ColorOptions> | undefined =\n colors[key as DynamicColorKey];\n if (!color) return;\n return this.colorManagerService.createOrUpdate(key, color);\n });\n }\n\n addColor(key: string, color: ColorOptions): ColorEntity {\n return this.colorManagerService.createOrUpdate(key, color);\n }\n\n addColors(colors: Record<string, ColorOptions>): ColorEntity[] {\n return Object.keys(colors).map((key) => this.addColor(key, colors[key]));\n }\n\n getColor(key: string): ColorEntity {\n return this.colorManagerService.get(key);\n }\n\n removeColor(key: string): boolean {\n return this.colorManagerService.remove(key);\n }\n\n updateColor(key: string, newColor: Partial<ColorOptions>): ColorEntity {\n return this.colorManagerService.createOrUpdate(key, newColor);\n }\n}\n","import { SchemeService } from './scheme.service';\nimport { VariantEntity } from '../entities/variant.entity';\nimport { Injectable } from '@nestjs/common';\nimport { TonalPalette } from '@material/material-color-utilities';\n\n@Injectable()\nexport class VariantService {\n constructor(private schemeService: SchemeService) {}\n\n set(variantEntity: VariantEntity) {\n if (!variantEntity.palettes.error) {\n variantEntity.palettes.error = () =>\n TonalPalette.fromHueAndChroma(25.0, 84.0);\n }\n this.schemeService.createOrUpdate(variantEntity);\n }\n}\n","import { DynamicColor } from '@material/material-color-utilities';\nimport { Injectable } from '@nestjs/common';\nimport { SchemeService, SchemeServiceOptions } from './scheme.service';\nimport { VariantService } from './variant.service';\nimport { VariantEntity } from '../entities/variant.entity';\n\ntype ThemeOptions = Omit<SchemeServiceOptions, 'palettes'>;\n\nconst colorPaletteKeyColor = DynamicColor.fromPalette({\n name: 'primary_palette_key_color',\n palette: (s) => s.primaryPalette,\n tone: (s) => s.primaryPalette.keyColor.tone,\n});\n\n@Injectable()\nexport class ThemeService {\n constructor(\n private schemeService: SchemeService,\n private variantService: VariantService\n ) {\n // this.addPalette({key: \"primary\", addDefaultColors: true})\n // this.addPalette({key: \"secondary\", addDefaultColors: true})\n // this.addPalette({key: \"tertiary\", addDefaultColors: true})\n // this.addPalette({key: \"error\", palette: TonalPalette.fromHueAndChroma(25.0, 84.0)})\n // this.addPalette({key: \"neutral\"})\n // this.addPalette({key: \"neutralVariant\"})\n }\n // addPalette({key, palette, addDefaultColors}: {key: string; palette: TonalPalette; addDefaultColors: boolean}) {\n // this.themeOptions.palettes.set(key, palette);\n // if (addDefaultColors){\n // this.colorService.addPalette(key)\n // }\n // }\n\n // create(args: ThemeOptions): SchemeService {\n // return new SchemeService(args, this.colorService)\n // }\n //\n // update(options: Partial<ThemeOptions>): SchemeService {\n // Object.assign(this.themeOptions, options);\n // return this.theme();\n // }\n\n create(options: ThemeOptions) {\n this.schemeService.createOrUpdate(options);\n }\n\n addVariant(variant: VariantEntity) {\n this.variantService.set(variant);\n }\n\n update(options: Partial<ThemeOptions>) {\n this.schemeService.createOrUpdate(options);\n }\n // theme(): SchemeService {\n // return new SchemeService(this.themeOptions, this.colorService)\n // }\n}\n","import { Injectable } from '@nestjs/common';\nimport { ColorService } from './color/color.service';\nimport { ThemeService } from './theme/services/theme.service';\n\n@Injectable()\nexport class AppService {\n constructor(\n public colorService: ColorService,\n public themeService: ThemeService\n ) {}\n}\n","import { Module } from '@nestjs/common';\nimport { SchemeService } from './services/scheme.service';\nimport { ThemeService } from './services/theme.service';\nimport { VariantService } from './services/variant.service';\n\n@Module({\n providers: [SchemeService, ThemeService, VariantService],\n exports: [ThemeService, SchemeService],\n})\nexport class ThemeModule {}\n","import { ColorService } from './color.service';\nimport { Module } from '@nestjs/common';\nimport { ColorManagerService } from './color-manager.service';\nimport { ThemeModule } from '../theme/theme.module';\n\n@Module({\n imports: [ThemeModule],\n providers: [ColorService, ColorManagerService],\n exports: [ColorService],\n})\nexport class ColorModule {}\n","import { Module } from '@nestjs/common';\nimport { AppService } from './app.service';\nimport { ColorModule } from './color/color.module';\nimport { ThemeModule } from './theme/theme.module';\n\n@Module({\n imports: [ColorModule, ThemeModule],\n providers: [AppService],\n})\nexport class AppModule {}\n","import { NestFactory } from '@nestjs/core';\nimport { AppModule } from './app.module';\nimport { AppService } from './app.service';\n\nexport async function main(): Promise<[AppService, () => Promise<void>]> {\n const app = await NestFactory.create(AppModule);\n const appService = app.get(AppService);\n\n const close = () => app.close();\n return [appService, close];\n}\n"],"names":["ContrastCurve","low","normal","medium","high","this","prototype","get","contrastLevel","lerp","ToneDeltaPair","roleA","roleB","delta","polarity","stayTogether","DynamicColor","name","palette","tone","isBackground","background","secondBackground","contrastCurve","toneDeltaPair","hctCache","Map","Error","fromPalette","args","_args$name","_args$isBackground","foregroundTone","bgTone","ratio","lighterTone","Contrast","lighterUnsafe","darkerTone","darkerUnsafe","lighterRatio","ratioOfTones","darkerRatio","tonePrefersLightForeground","negligibleDifference","Math","abs","round","toneAllowsLightForeground","enableLightForeground","_proto","getArgb","scheme","getHct","toInt","cachedAnswer","getTone","answer","size","clear","set","decreasingContrast","aIsNearer","isDark","nearer","farther","amNearer","expansionDir","nContrast","fContrast","nInitialTone","nTone","fInitialTone","fTone","clampDouble","max","min","desiredRatio","_ref","bg2","_ref2","bg1","bgTone1","bgTone2","_ref3","upper","lower","lightOption","lighter","darkOption","darker","availables","push","length","ColorEntity","option","schemeService","colorService","dynamicColor","update","_extends","getHex","hexFromArgb","getDynamicColor","getName","replace","toLowerCase","SchemeEntity","options","getPalette","key","palettes","Hct","fromInt","sourceColorArgb","SchemeService","schemeEntity","createOrUpdate","mergeDeep","argbFromHex","sourceColorHex","sourceColorHct","_i","_Object$entries","Object","entries","_Object$entries$_i","paletteFunction","__decorate","Injectable","highestSurface","s","colorManagerService","ColorManagerService","colorMap","colorEntity","remove","getAll","addFromPalette","string","_this","colorKey","ColorKey","charAt","toUpperCase","slice","onColorKey","colorKeyContainer","onColorKeyContainer","inverseColorKey","colorKeyFixed","colorKeyFixedDim","onColorKeyFixed","onColorKeyFixedVariant","ColorService","getAllColors","addBaseColors","colors","onBackground","surface","surfaceDim","surfaceBright","surfaceContainerLowest","surfaceContainerLow","surfaceContainer","surfaceContainerHigh","surfaceContainerHighest","onSurface","surfaceVariant","onSurfaceVariant","inverseSurface","inverseOnSurface","outline","outlineVariant","shadow","scrim","surfaceTint","secondaryContainer","initialTone","hue","chroma","byDecreasingTone","closestToChroma","from","chromaPeak","potentialSolution","findDesiredChromaByTone","onSecondaryContainer","tertiaryContainer","proposedHct","DislikeAnalyzer","fixIfDisliked","onTertiaryContainer","error","onError","errorContainer","onErrorContainer","onTertiaryFixed","onTertiaryFixedVariant","keys","map","color","addColor","addColors","_this2","getColor","removeColor","updateColor","newColor","VariantService","variantEntity","TonalPalette","fromHueAndChroma","ThemeService","variantService","create","addVariant","variant","AppService","themeService","ThemeModule","ColorModule","AppModule","_main","_regeneratorRuntime","mark","_callee","app","appService","wrap","_context","prev","next","NestFactory","sent","abrupt","close","stop","apply","arguments","Module","imports","providers","exports"],"mappings":"+qOA0BA,IAAaA,EAAa,WASxB,SAAAA,EACWC,EACAC,EACAC,EACAC,GAAYC,KAHZJ,SAAA,EAAAI,KACAH,YAAA,EAAAG,KACAF,YAAA,EAAAE,KACAD,UAAA,EAHAC,KAAGJ,IAAHA,EACAI,KAAMH,OAANA,EACAG,KAAMF,OAANA,EACAE,KAAID,KAAJA,CACR,CAqBF,OAnBDJ,EAAAM,UAOAC,IAAA,SAAIC,GACF,OAAIA,IAAkB,EACbH,KAAKJ,IACHO,EAAgB,EAClBC,EAAIA,KAACJ,KAAKJ,IAAKI,KAAKH,QAASM,IAAiB,GAAK,GACjDA,EAAgB,GAClBC,EAAIA,KAACJ,KAAKH,OAAQG,KAAKF,QAASK,EAAgB,GAAK,IACnDA,EAAgB,EAClBC,EAAIA,KAACJ,KAAKF,OAAQE,KAAKD,MAAOI,EAAgB,IAAO,IAErDH,KAAKD,MAEfJ,CAAA,CAnCuB,GCMbU,EAwBX,SACWC,EACAC,EACAC,EACAC,EACAC,GAAqBV,KAJrBM,WAAA,EAAAN,KACAO,WAAA,EAAAP,KACAQ,WAAA,EAAAR,KACAS,cAAA,EAAAT,KACAU,kBAAA,EAJAV,KAAKM,MAALA,EACAN,KAAKO,MAALA,EACAP,KAAKQ,MAALA,EACAR,KAAQS,SAARA,EACAT,KAAYU,aAAZA,CACR,ECOQC,EAAY,WAmCvB,SAAAA,EACWC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,GAET,GAFgEnB,KAPvDY,UAAA,E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