@wordpress/theme 0.2.0 → 0.2.1-next.16d95556a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/bin/generate-primitive-tokens/index.ts +1 -1
- package/build/color-ramps/index.js +5 -5
- package/build/color-ramps/index.js.map +2 -2
- package/build/color-ramps/lib/default-ramps.js +154 -154
- package/build/color-ramps/lib/default-ramps.js.map +2 -2
- package/build/color-ramps/lib/index.js +16 -9
- package/build/color-ramps/lib/index.js.map +2 -2
- package/build/color-ramps/lib/types.js.map +1 -1
- package/build/use-theme-provider-styles.js +1 -4
- package/build/use-theme-provider-styles.js.map +2 -2
- package/build-module/color-ramps/index.js +5 -5
- package/build-module/color-ramps/index.js.map +2 -2
- package/build-module/color-ramps/lib/default-ramps.js +154 -154
- package/build-module/color-ramps/lib/default-ramps.js.map +2 -2
- package/build-module/color-ramps/lib/index.js +16 -9
- package/build-module/color-ramps/lib/index.js.map +2 -2
- package/build-module/use-theme-provider-styles.js +1 -4
- package/build-module/use-theme-provider-styles.js.map +2 -2
- package/build-types/color-ramps/lib/index.d.ts.map +1 -1
- package/build-types/color-ramps/lib/types.d.ts +2 -4
- package/build-types/color-ramps/lib/types.d.ts.map +1 -1
- package/build-types/color-ramps/stories/index.story.d.ts.map +1 -1
- package/build-types/color-ramps/stories/ramp-table.d.ts +2 -4
- package/build-types/color-ramps/stories/ramp-table.d.ts.map +1 -1
- package/build-types/use-theme-provider-styles.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/color-ramps/index.ts +5 -5
- package/src/color-ramps/lib/default-ramps.ts +154 -154
- package/src/color-ramps/lib/index.ts +26 -22
- package/src/color-ramps/lib/types.ts +2 -7
- package/src/color-ramps/stories/index.story.tsx +4 -1
- package/src/color-ramps/stories/ramp-table.tsx +15 -26
- package/src/color-ramps/test/__snapshots__/index.test.ts.snap +11717 -41231
- package/src/color-ramps/test/index.test.ts +2 -2
- package/src/use-theme-provider-styles.ts +1 -4
- package/tsconfig.bin.tsbuildinfo +1 -1
- package/tsconfig.src.tsbuildinfo +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tclone,\n\tget,\n\tOKLCH,\n\tparse,\n\tset,\n\ttype ColorTypes,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tclampToGamut,\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: ColorTypes;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAQO;AAKP,mCAAO;AACP,yBAA4C;AAC5C,yCAA6C;AAC7C,mBAOO;AASP,uBAAiC;AAgBjC,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAUI;AACH,QAAM,cAAc,CAAC;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport {\n\tclone,\n\tget,\n\tOKLCH,\n\tparse,\n\tset,\n\ttype ColorTypes,\n\ttype PlainColorObject,\n} from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './register-color-spaces';\nimport { getContrast, getColorString } from './color-utils';\nimport { findColorMeetingRequirements } from './find-color-with-constraints';\nimport {\n\tclampToGamut,\n\tsortByDependency,\n\tcomputeBetterFgColorDirection,\n\tadjustContrastTarget,\n\tstepsForStep,\n\tsolveWithBisect,\n} from './utils';\n\nimport type {\n\tFollowDirection,\n\tRamp,\n\tRampDirection,\n\tRampConfig,\n\tRampResult,\n} from './types';\nimport { CONTRAST_EPSILON } from './constants';\n\n/**\n * Calculate a complete color ramp based on the provided configuration.\n *\n * @param params - The calculation parameters\n * @param params.seed - The base color to build the ramp from\n * @param params.sortedSteps - Steps sorted in dependency order\n * @param params.config - Ramp configuration defining contrast requirements\n * @param params.mainDir - Primary direction for the ramp (lighter/darker)\n * @param params.oppDir - Opposite direction from mainDir\n * @param params.pinLightness - Optional lightness override for a given step\n * @param params.pinLightness.stepName\n * @param params.pinLightness.value\n * @return Object containing ramp results and satisfaction status\n */\nfunction calculateRamp( {\n\tseed,\n\tsortedSteps,\n\tconfig,\n\tmainDir,\n\toppDir,\n\tpinLightness,\n}: {\n\tseed: ColorTypes;\n\tsortedSteps: ( keyof Ramp )[];\n\tconfig: RampConfig;\n\tmainDir: RampDirection;\n\toppDir: RampDirection;\n\tpinLightness?: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} ) {\n\tconst rampResults = {} as Record< keyof Ramp, string >;\n\tlet warnings: string[] | undefined;\n\tlet maxDeficit = -Infinity;\n\tlet maxDeficitDirection: RampDirection = 'lighter';\n\tlet maxDeficitStep;\n\n\t// Keep track of the calculated colors, as they are going to be useful\n\t// when other colors reference them.\n\tconst calculatedColors = new Map< keyof Ramp | 'seed', ColorTypes >();\n\tcalculatedColors.set( 'seed', seed );\n\n\tfor ( const stepName of sortedSteps ) {\n\t\tconst {\n\t\t\tcontrast,\n\t\t\tlightness: stepLightnessConstraint,\n\t\t\ttaperChromaOptions,\n\t\t\tsameAsIfPossible,\n\t\t} = config[ stepName ];\n\n\t\tconst referenceColor = calculatedColors.get( contrast.reference );\n\t\tif ( ! referenceColor ) {\n\t\t\tthrow new Error(\n\t\t\t\t`Reference color for step ${ stepName } not found: ${ contrast.reference }`\n\t\t\t);\n\t\t}\n\n\t\t// Check if we can reuse color from the `sameAsIfPossible` config option\n\t\tif ( sameAsIfPossible ) {\n\t\t\tconst candidateColor = calculatedColors.get( sameAsIfPossible );\n\t\t\tif ( ! candidateColor ) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Same-as color for step ${ stepName } not found: ${ sameAsIfPossible }`\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst candidateContrast = getContrast(\n\t\t\t\treferenceColor,\n\t\t\t\tcandidateColor\n\t\t\t);\n\t\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\t\t\t// If the candidate meets the contrast requirement, use it\n\t\t\tif ( candidateContrast >= adjustedTarget ) {\n\t\t\t\t// Store the reused color\n\t\t\t\tcalculatedColors.set( stepName, candidateColor );\n\t\t\t\trampResults[ stepName ] = getColorString( candidateColor );\n\n\t\t\t\tcontinue; // Skip to next step\n\t\t\t}\n\t\t}\n\n\t\tfunction computeDirection(\n\t\t\tcolor: ColorTypes,\n\t\t\tfollowDirection: FollowDirection\n\t\t): RampDirection {\n\t\t\tif ( followDirection === 'main' ) {\n\t\t\t\treturn mainDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'opposite' ) {\n\t\t\t\treturn oppDir;\n\t\t\t}\n\n\t\t\tif ( followDirection === 'best' ) {\n\t\t\t\treturn computeBetterFgColorDirection(\n\t\t\t\t\tcolor,\n\t\t\t\t\tcontrast.preferLighter\n\t\t\t\t).better;\n\t\t\t}\n\n\t\t\treturn followDirection;\n\t\t}\n\n\t\tconst computedDir = computeDirection(\n\t\t\treferenceColor,\n\t\t\tcontrast.followDirection\n\t\t);\n\n\t\tconst adjustedTarget = adjustContrastTarget( contrast.target );\n\n\t\t// Define the lightness constraint, if needed.\n\t\tlet lightnessConstraint;\n\t\tif ( pinLightness?.stepName === stepName ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: pinLightness.value,\n\t\t\t\ttype: 'force',\n\t\t\t} as const;\n\t\t} else if ( stepLightnessConstraint ) {\n\t\t\tlightnessConstraint = {\n\t\t\t\tvalue: stepLightnessConstraint( computedDir ),\n\t\t\t\ttype: 'onlyIfSucceeds',\n\t\t\t} as const;\n\t\t}\n\n\t\t// Calculate the color meeting the requirements\n\t\tconst searchResults = findColorMeetingRequirements(\n\t\t\treferenceColor,\n\t\t\tseed,\n\t\t\tadjustedTarget,\n\t\t\tcomputedDir,\n\t\t\t{\n\t\t\t\tlightnessConstraint,\n\t\t\t\ttaperChromaOptions,\n\t\t\t}\n\t\t);\n\n\t\t// When the target contrast is not met, take note of it and use\n\t\t// that information to guide the ramp calculation bisection.\n\t\tif (\n\t\t\t! contrast.ignoreWhenAdjustingSeed &&\n\t\t\tsearchResults.deficit &&\n\t\t\tsearchResults.deficit > maxDeficit\n\t\t) {\n\t\t\tmaxDeficit = searchResults.deficit;\n\t\t\tmaxDeficitDirection = computedDir;\n\t\t\tmaxDeficitStep = stepName;\n\t\t}\n\n\t\t// Store calculated color for future dependencies\n\t\tcalculatedColors.set( stepName, searchResults.color );\n\n\t\t// Add to results\n\t\trampResults[ stepName ] = getColorString( searchResults.color );\n\n\t\tif ( ! searchResults.reached && ! contrast.ignoreWhenAdjustingSeed ) {\n\t\t\twarnings ??= [];\n\t\t\twarnings.push( stepName );\n\t\t}\n\t}\n\n\treturn {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t};\n}\n\nexport function buildRamp(\n\tseedArg: string,\n\tconfig: RampConfig,\n\t{\n\t\tmainDirection,\n\t\tpinLightness,\n\t\trescaleToFitContrastTargets = true,\n\t}: {\n\t\tmainDirection?: RampDirection;\n\t\tpinLightness?: {\n\t\t\tstepName: keyof Ramp;\n\t\t\tvalue: number;\n\t\t};\n\t\trescaleToFitContrastTargets?: boolean;\n\t} = {}\n): RampResult {\n\tlet seed: PlainColorObject;\n\ttry {\n\t\tseed = clampToGamut( parse( seedArg ) );\n\t} catch ( error ) {\n\t\tthrow new Error(\n\t\t\t`Invalid seed color \"${ seedArg }\": ${\n\t\t\t\terror instanceof Error ? error.message : 'Unknown error'\n\t\t\t}`\n\t\t);\n\t}\n\n\tlet mainDir: RampDirection = 'lighter';\n\tlet oppDir: RampDirection = 'darker';\n\n\tif ( mainDirection ) {\n\t\tmainDir = mainDirection;\n\t\toppDir = mainDirection === 'darker' ? 'lighter' : 'darker';\n\t} else {\n\t\tconst { better, worse } = computeBetterFgColorDirection( seed );\n\t\tmainDir = better;\n\t\toppDir = worse;\n\t}\n\n\t// Get the correct calculation order based on dependencies\n\tconst sortedSteps = sortByDependency( config );\n\n\t// Calculate the ramp with the initial seed.\n\tconst {\n\t\trampResults,\n\t\twarnings,\n\t\tmaxDeficit,\n\t\tmaxDeficitDirection,\n\t\tmaxDeficitStep,\n\t} = calculateRamp( {\n\t\tseed,\n\t\tsortedSteps,\n\t\tconfig,\n\t\tmainDir,\n\t\toppDir,\n\t\tpinLightness,\n\t} );\n\n\tlet bestRamp = rampResults;\n\n\tif ( maxDeficit > CONTRAST_EPSILON && rescaleToFitContrastTargets ) {\n\t\tconst iterSteps = stepsForStep( maxDeficitStep!, config );\n\n\t\tfunction getSeedForL( l: number ): ColorTypes {\n\t\t\treturn clampToGamut( set( clone( seed ), [ OKLCH, 'l' ], l ) );\n\t\t}\n\n\t\tfunction getDeficitForSeed( s: ColorTypes ): number {\n\t\t\tconst iterationResults = calculateRamp( {\n\t\t\t\tseed: s,\n\t\t\t\tsortedSteps: iterSteps,\n\t\t\t\tconfig,\n\t\t\t\tmainDir,\n\t\t\t\toppDir,\n\t\t\t\tpinLightness,\n\t\t\t} );\n\n\t\t\t// If the constraints start failing in the opposite direction to the original\n\t\t\t// iteration's direction, that means we've moved too far away from the target.\n\t\t\t// Don't use the `maxDeficit` value because it's not related to our search,\n\t\t\t// and might even be positive, which would confuse the bisection algorithm.\n\t\t\treturn iterationResults.maxDeficitDirection === maxDeficitDirection\n\t\t\t\t? iterationResults.maxDeficit\n\t\t\t\t: -maxDeficit;\n\t\t}\n\n\t\t// For a scale with the \"lighter\" direction, the contrast can be improved\n\t\t// by darkening the seed. For \"darker\" direction, by lightening the seed.\n\t\tconst lowerSeedL = maxDeficitDirection === 'lighter' ? 0 : 1;\n\t\tconst lowerDeficit = -maxDeficit;\n\t\tconst upperSeedL = get( seed, [ OKLCH, 'l' ] );\n\t\tconst upperDeficit = maxDeficit;\n\n\t\tconst bestSeed = solveWithBisect(\n\t\t\tgetSeedForL,\n\t\t\tgetDeficitForSeed,\n\t\t\tlowerSeedL,\n\t\t\tlowerDeficit,\n\t\t\tupperSeedL,\n\t\t\tupperDeficit\n\t\t);\n\n\t\t// Calculate the final ramp with adjusted seed.\n\t\tbestRamp = calculateRamp( {\n\t\t\tseed: bestSeed,\n\t\t\tsortedSteps,\n\t\t\tconfig,\n\t\t\tmainDir,\n\t\t\toppDir,\n\t\t\tpinLightness,\n\t\t} ).rampResults;\n\t}\n\n\t// Swap surface1 and surface3 for darker ramps to maintain visual elevation hierarchy.\n\t// This ensures surface1 appears \"behind\" surface2, and surface3 appears \"in front\",\n\t// regardless of the ramp's main direction.\n\tif ( mainDir === 'darker' ) {\n\t\tconst tmpSurface1 = bestRamp.surface1;\n\t\tbestRamp.surface1 = bestRamp.surface3;\n\t\tbestRamp.surface3 = tmpSurface1;\n\t}\n\n\treturn {\n\t\tramp: bestRamp,\n\t\twarnings,\n\t\tdirection: mainDir,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,gBAQO;AAKP,mCAAO;AACP,yBAA4C;AAC5C,yCAA6C;AAC7C,mBAOO;AASP,uBAAiC;AAgBjC,SAAS,cAAe;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAUI;AACH,QAAM,cAAc,CAAC;AACrB,MAAI;AACJ,MAAI,aAAa;AACjB,MAAI,sBAAqC;AACzC,MAAI;AAIJ,QAAM,mBAAmB,oBAAI,IAAuC;AACpE,mBAAiB,IAAK,QAAQ,IAAK;AAEnC,aAAY,YAAY,aAAc;AAuCrC,QAAS,mBAAT,SACC,OACA,iBACgB;AAChB,UAAK,oBAAoB,QAAS;AACjC,eAAO;AAAA,MACR;AAEA,UAAK,oBAAoB,YAAa;AACrC,eAAO;AAAA,MACR;AAEA,UAAK,oBAAoB,QAAS;AACjC,mBAAO;AAAA,UACN;AAAA,UACA,SAAS;AAAA,QACV,EAAE;AAAA,MACH;AAEA,aAAO;AAAA,IACR;AA1DA,UAAM;AAAA,MACL;AAAA,MACA,WAAW;AAAA,MACX;AAAA,MACA;AAAA,IACD,IAAI,OAAQ,QAAS;AAErB,UAAM,iBAAiB,iBAAiB,IAAK,SAAS,SAAU;AAChE,QAAK,CAAE,gBAAiB;AACvB,YAAM,IAAI;AAAA,QACT,4BAA6B,QAAS,eAAgB,SAAS,SAAU;AAAA,MAC1E;AAAA,IACD;AAGA,QAAK,kBAAmB;AACvB,YAAM,iBAAiB,iBAAiB,IAAK,gBAAiB;AAC9D,UAAK,CAAE,gBAAiB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AAAA,MAChB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAGA,eAAW,cAAe;AAAA,MACzB,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD,CAAE,EAAE;AAAA,EACL;AAKA,MAAK,YAAY,UAAW;AAC3B,UAAM,cAAc,SAAS;AAC7B,aAAS,WAAW,SAAS;AAC7B,aAAS,WAAW;AAAA,EACrB;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,IACN;AAAA,IACA,WAAW;AAAA,EACZ;AACD;",
|
|
6
6
|
"names": ["adjustedTarget"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/color-ramps/lib/types.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { TaperChromaOptions } from './taper-chroma';\n\nexport type Ramp = {\n\t// Backgrounds for surfaces (nuanced, slight variations compared to bg)\n\tsurface1: string;\n\tsurface2: string;\n\tsurface3: string;\n\tsurface4: string;\n\tsurface5: string;\n\tsurface6: string;\n\t// Strokes\n\tstroke1: string;\n\tstroke2: string;\n\tstroke3: string;\n\tstroke4: string;\n\t// Stronger backgrounds for primary UI elements\n\tbgFill1: string;\n\tbgFill2: string;\n\tbgFillInverted1: string;\n\tbgFillInverted2: string;\n\tbgFillDark: string;\n\t// Foreground (text, icon) colors\n\tfgSurface1: string;\n\tfgSurface2: string;\n\tfgSurface3: string;\n\tfgSurface4: string;\n\t// Foreground (text, icon) colors on top of bgFill\n\tfgFill: string;\n\tfgFillInverted: string;\n\tfgFillDark: string;\n};\n\nexport type RampDirection = 'lighter' | 'darker';\nexport type FollowDirection = 'main' | 'opposite' | 'best' | RampDirection;\nexport type ContrastRequirement = {\n\t/** The reference color against which to calculate the contrast */\n\treference: keyof Ramp | 'seed';\n\t/**\n\t * Which direction should the algorithm search a matching color in:\n\t * - main: follow the same direction as the ramp's main direction\n\t * - opposite: follow the opposite direction of the ramp\n\t * - best: pick the direction that has the most contrast headroom\n\t * - hardcoded ramp direction (useful for generating colors that always\n\t * light/dark regardless of the ramp direction)\n\t */\n\tfollowDirection: FollowDirection;\n\t/**\n\t * Prefer \"lighter\" direction when searching for a contrasting color.\n\t * Especially useful for foreground color to counter the poor results that the\n\t * WCAG algo gives when contrasting white text over mid-lightness backgrounds.\n\t */\n\tpreferLighter?: boolean;\n\t/**\n\t * The contrast target to meet.\n\t */\n\ttarget: number;\n\t/**\n\t * When true, the algorithm won't count a failure in meeting the contrast\n\t * target as a reason to recalculate the ramp.\n\t */\n\tignoreWhenAdjustingSeed?: boolean;\n};\n\nexport type RampStepConfig = {\n\tcontrast: ContrastRequirement;\n\tlightness?: ( direction: RampDirection ) => number;\n\ttaperChromaOptions?: TaperChromaOptions;\n\t/**\n\t * If specified, try to reuse the color from this step if it meets\n\t * the contrast requirements. This reduces the number of unique colors\n\t * in the ramp and improves consistency.\n\t */\n\tsameAsIfPossible?: keyof Ramp;\n};\n\nexport type RampConfig = Record< keyof Ramp, RampStepConfig >;\n\nexport type RampResult = {\n\tramp: Record
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { TaperChromaOptions } from './taper-chroma';\n\nexport type Ramp = {\n\t// Backgrounds for surfaces (nuanced, slight variations compared to bg)\n\tsurface1: string;\n\tsurface2: string;\n\tsurface3: string;\n\tsurface4: string;\n\tsurface5: string;\n\tsurface6: string;\n\t// Strokes\n\tstroke1: string;\n\tstroke2: string;\n\tstroke3: string;\n\tstroke4: string;\n\t// Stronger backgrounds for primary UI elements\n\tbgFill1: string;\n\tbgFill2: string;\n\tbgFillInverted1: string;\n\tbgFillInverted2: string;\n\tbgFillDark: string;\n\t// Foreground (text, icon) colors\n\tfgSurface1: string;\n\tfgSurface2: string;\n\tfgSurface3: string;\n\tfgSurface4: string;\n\t// Foreground (text, icon) colors on top of bgFill\n\tfgFill: string;\n\tfgFillInverted: string;\n\tfgFillDark: string;\n};\n\nexport type RampDirection = 'lighter' | 'darker';\nexport type FollowDirection = 'main' | 'opposite' | 'best' | RampDirection;\nexport type ContrastRequirement = {\n\t/** The reference color against which to calculate the contrast */\n\treference: keyof Ramp | 'seed';\n\t/**\n\t * Which direction should the algorithm search a matching color in:\n\t * - main: follow the same direction as the ramp's main direction\n\t * - opposite: follow the opposite direction of the ramp\n\t * - best: pick the direction that has the most contrast headroom\n\t * - hardcoded ramp direction (useful for generating colors that always\n\t * light/dark regardless of the ramp direction)\n\t */\n\tfollowDirection: FollowDirection;\n\t/**\n\t * Prefer \"lighter\" direction when searching for a contrasting color.\n\t * Especially useful for foreground color to counter the poor results that the\n\t * WCAG algo gives when contrasting white text over mid-lightness backgrounds.\n\t */\n\tpreferLighter?: boolean;\n\t/**\n\t * The contrast target to meet.\n\t */\n\ttarget: number;\n\t/**\n\t * When true, the algorithm won't count a failure in meeting the contrast\n\t * target as a reason to recalculate the ramp.\n\t */\n\tignoreWhenAdjustingSeed?: boolean;\n};\n\nexport type RampStepConfig = {\n\tcontrast: ContrastRequirement;\n\tlightness?: ( direction: RampDirection ) => number;\n\ttaperChromaOptions?: TaperChromaOptions;\n\t/**\n\t * If specified, try to reuse the color from this step if it meets\n\t * the contrast requirements. This reduces the number of unique colors\n\t * in the ramp and improves consistency.\n\t */\n\tsameAsIfPossible?: keyof Ramp;\n};\n\nexport type RampConfig = Record< keyof Ramp, RampStepConfig >;\n\nexport type RampResult = {\n\tramp: Record< keyof Ramp, string >;\n\twarnings?: string[];\n\tdirection: RampDirection;\n};\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -162,10 +162,7 @@ function colorTokensCSS(computedColorRamps) {
|
|
|
162
162
|
const key = `${rampName}-${tokenName}`;
|
|
163
163
|
const aliasedBy = import_color_tokens.default[key] ?? [];
|
|
164
164
|
for (const aliasedId of aliasedBy) {
|
|
165
|
-
entries.push([
|
|
166
|
-
`--wpds-color-${aliasedId}`,
|
|
167
|
-
tokenValue.color
|
|
168
|
-
]);
|
|
165
|
+
entries.push([`--wpds-color-${aliasedId}`, tokenValue]);
|
|
169
166
|
}
|
|
170
167
|
}
|
|
171
168
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/use-theme-provider-styles.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tparse,\n\tto,\n\tget,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport colorTokens from './prebuilt/ts/color-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );\nconst getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: ColorTypes ) {\n\tconst rgb = to( color, sRGB );\n\treturn [ get( rgb, 'srgb.r' ), get( rgb, 'srgb.g' ), get( rgb, 'srgb.b' ) ]\n\t\t.map( ( n ) => Math.round( n * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = to( parse( accent ), HSL );\n\n\tconst coords = parsedAccent.coords;\n\tconst darker10 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 5 ) ), // l (reduced by 5%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\tconst darker20 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 10 ) ), // l (reduced by 10%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tserialize( to( parsedAccent, sRGB ), { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tserialize( darker10, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tserialize( darker20, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction colorTokensCSS(\n\tcomputedColorRamps: Map< string, RampResult >\n): Entry[] {\n\tconst entries: Entry[] = [];\n\n\tfor ( const [ rampName, { ramp } ] of computedColorRamps ) {\n\t\tfor ( const [ tokenName, tokenValue ] of Object.entries( ramp ) ) {\n\t\t\tconst key = `${ rampName }-${ tokenName }`;\n\t\t\tconst aliasedBy = colorTokens[ key ] ?? [];\n\t\t\tfor ( const aliasedId of aliasedBy ) {\n\t\t\t\tentries.push( [
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,gBAQO;AACP,oBAAoB;AAKpB,qBAAoC;AAKpC,mCAAO;AACP,qBAA6B;AAC7B,0BAAwB;AACxB,yBAKO;AAKP,IAAM,sBAAkB,cAAAA,SAAS,gCAAa,EAAE,SAAS,GAAG,CAAE;AAC9D,IAAM,0BAAsB,cAAAA,SAAS,oCAAiB,EAAE,SAAS,GAAG,CAAE;AAEtE,IAAM,iCAA0C;AAAA,EAC/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O;AAAA,MACP,QAAQ;AAAA,QACP,OAAQ,CAAE;AAAA;AAAA,QACV,OAAQ,CAAE;AAAA;AAAA,QACV,KAAK,IAAK,GAAG,KAAK,IAAK,KAAK,OAAQ,CAAE,IAAI,EAAG,CAAE;AAAA;AAAA,MAChD;AAAA,IACD;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN;AAAA,MACC;AAAA,UACA,yBAAW,cAAI,cAAc,cAAK,GAAG,EAAE,QAAQ,MAAM,CAAE;AAAA,IACxD;AAAA,IACA,CAAE,+BAA+B,gBAAiB,YAAa,CAAE;AAAA,IACjE;AAAA,MACC;AAAA,UACA,qBAAW,UAAU,EAAE,QAAQ,MAAM,CAAE;AAAA,IACxC;AAAA,IACA;AAAA,MACC;AAAA,MACA,gBAAiB,QAAS;AAAA,IAC3B;AAAA,IACA;AAAA,MACC;AAAA,UACA,qBAAW,UAAU,EAAE,QAAQ,MAAM,CAAE;AAAA,IACxC;AAAA,IACA;AAAA,MACC;AAAA,MACA,gBAAiB,QAAS;AAAA,IAC3B;AAAA,EACD;AACD;AAEA,SAAS,eACR,oBACU;AACV,QAAM,UAAmB,CAAC;AAE1B,aAAY,CAAE,UAAU,EAAE,KAAK,CAAE,KAAK,oBAAqB;AAC1D,eAAY,CAAE,WAAW,UAAW,KAAK,OAAO,QAAS,IAAK,GAAI;AACjE,YAAM,MAAM,GAAI,QAAS,IAAK,SAAU;AACxC,YAAM,YAAY,oBAAAC,QAAa,GAAI,KAAK,CAAC;AACzC,iBAAY,aAAa,WAAY;AACpC,gBAAQ,KAAM
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\nimport {\n\tparse,\n\tto,\n\tget,\n\tserialize,\n\tsRGB,\n\tHSL,\n\ttype ColorTypes,\n} from 'colorjs.io/fn';\nimport memoize from 'memize';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo, useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport './color-ramps/lib/register-color-spaces';\nimport { ThemeContext } from './context';\nimport colorTokens from './prebuilt/ts/color-tokens';\nimport {\n\tbuildBgRamp,\n\tbuildAccentRamp,\n\tDEFAULT_SEED_COLORS,\n\ttype RampResult,\n} from './color-ramps';\nimport type { ThemeProviderProps } from './types';\n\ntype Entry = [ string, string ];\n\nconst getCachedBgRamp = memoize( buildBgRamp, { maxSize: 10 } );\nconst getCachedAccentRamp = memoize( buildAccentRamp, { maxSize: 10 } );\n\nconst legacyWpComponentsOverridesCSS: Entry[] = [\n\t[ '--wp-components-color-accent', 'var(--wp-admin-theme-color)' ],\n\t[\n\t\t'--wp-components-color-accent-darker-10',\n\t\t'var(--wp-admin-theme-color-darker-10)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-darker-20',\n\t\t'var(--wp-admin-theme-color-darker-20)',\n\t],\n\t[\n\t\t'--wp-components-color-accent-inverted',\n\t\t'var(--wpds-color-fg-interactive-brand-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-background',\n\t\t'var(--wpds-color-bg-surface-neutral-strong)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-foreground-inverted',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-100',\n\t\t'var(--wpds-color-bg-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-200',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-300',\n\t\t'var(--wpds-color-stroke-surface-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-400',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-600',\n\t\t'var(--wpds-color-stroke-interactive-neutral)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-700',\n\t\t'var(--wpds-color-fg-content-neutral-weak)',\n\t],\n\t[\n\t\t'--wp-components-color-gray-800',\n\t\t'var(--wpds-color-fg-content-neutral)',\n\t],\n];\n\nfunction customRgbFormat( color: ColorTypes ) {\n\tconst rgb = to( color, sRGB );\n\treturn [ get( rgb, 'srgb.r' ), get( rgb, 'srgb.g' ), get( rgb, 'srgb.b' ) ]\n\t\t.map( ( n ) => Math.round( n * 255 ) )\n\t\t.join( ', ' );\n}\n\nfunction legacyWpAdminThemeOverridesCSS( accent: string ): Entry[] {\n\tconst parsedAccent = to( parse( accent ), HSL );\n\n\tconst coords = parsedAccent.coords;\n\tconst darker10 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 5 ) ), // l (reduced by 5%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\tconst darker20 = to(\n\t\t{\n\t\t\tspace: HSL,\n\t\t\tcoords: [\n\t\t\t\tcoords[ 0 ], // h\n\t\t\t\tcoords[ 1 ], // s\n\t\t\t\tMath.max( 0, Math.min( 100, coords[ 2 ] - 10 ) ), // l (reduced by 10%)\n\t\t\t],\n\t\t},\n\t\tsRGB\n\t);\n\n\treturn [\n\t\t[\n\t\t\t'--wp-admin-theme-color',\n\t\t\tserialize( to( parsedAccent, sRGB ), { format: 'hex' } ),\n\t\t],\n\t\t[ '--wp-admin-theme-color--rgb', customRgbFormat( parsedAccent ) ],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10',\n\t\t\tserialize( darker10, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-10--rgb',\n\t\t\tcustomRgbFormat( darker10 ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20',\n\t\t\tserialize( darker20, { format: 'hex' } ),\n\t\t],\n\t\t[\n\t\t\t'--wp-admin-theme-color-darker-20--rgb',\n\t\t\tcustomRgbFormat( darker20 ),\n\t\t],\n\t];\n}\n\nfunction colorTokensCSS(\n\tcomputedColorRamps: Map< string, RampResult >\n): Entry[] {\n\tconst entries: Entry[] = [];\n\n\tfor ( const [ rampName, { ramp } ] of computedColorRamps ) {\n\t\tfor ( const [ tokenName, tokenValue ] of Object.entries( ramp ) ) {\n\t\t\tconst key = `${ rampName }-${ tokenName }`;\n\t\t\tconst aliasedBy = colorTokens[ key ] ?? [];\n\t\t\tfor ( const aliasedId of aliasedBy ) {\n\t\t\t\tentries.push( [ `--wpds-color-${ aliasedId }`, tokenValue ] );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn entries;\n}\n\nfunction generateStyles( {\n\tprimary,\n\tcomputedColorRamps,\n}: {\n\tprimary: string;\n\tcomputedColorRamps: Map< string, RampResult >;\n} ): CSSProperties {\n\treturn Object.fromEntries(\n\t\t[\n\t\t\t// Semantic color tokens\n\t\t\tcolorTokensCSS( computedColorRamps ),\n\t\t\t// Legacy overrides\n\t\t\tlegacyWpAdminThemeOverridesCSS( primary ),\n\t\t\tlegacyWpComponentsOverridesCSS,\n\t\t].flat()\n\t);\n}\n\nexport function useThemeProviderStyles( {\n\tcolor = {},\n}: {\n\tcolor?: ThemeProviderProps[ 'color' ];\n} = {} ) {\n\tconst { resolvedSettings: inheritedSettings } = useContext( ThemeContext );\n\n\t// Compute settings:\n\t// - used provided prop value;\n\t// - otherwise, use inherited value from parent instance;\n\t// - otherwise, use fallback value (where applicable).\n\tconst primary =\n\t\tcolor.primary ??\n\t\tinheritedSettings.color?.primary ??\n\t\tDEFAULT_SEED_COLORS.primary;\n\tconst bg =\n\t\tcolor.bg ?? inheritedSettings.color?.bg ?? DEFAULT_SEED_COLORS.bg;\n\n\tconst resolvedSettings = useMemo(\n\t\t() => ( {\n\t\t\tcolor: {\n\t\t\t\tprimary,\n\t\t\t\tbg,\n\t\t\t},\n\t\t} ),\n\t\t[ primary, bg ]\n\t);\n\n\tconst themeProviderStyles = useMemo( () => {\n\t\t// Determine which seeds are needed for generating ramps.\n\t\tconst seeds = {\n\t\t\t...DEFAULT_SEED_COLORS,\n\t\t\tbg,\n\t\t\tprimary,\n\t\t};\n\n\t\t// Generate ramps.\n\t\tconst computedColorRamps = new Map< string, RampResult >();\n\t\tconst bgRamp = getCachedBgRamp( seeds.bg );\n\t\tObject.entries( seeds ).forEach( ( [ rampName, seed ] ) => {\n\t\t\tif ( rampName === 'bg' ) {\n\t\t\t\tcomputedColorRamps.set( rampName, bgRamp );\n\t\t\t} else {\n\t\t\t\tcomputedColorRamps.set(\n\t\t\t\t\trampName,\n\t\t\t\t\tgetCachedAccentRamp( seed, bgRamp )\n\t\t\t\t);\n\t\t\t}\n\t\t} );\n\n\t\treturn generateStyles( {\n\t\t\tprimary: seeds.primary,\n\t\t\tcomputedColorRamps,\n\t\t} );\n\t}, [ primary, bg ] );\n\n\treturn {\n\t\tresolvedSettings,\n\t\tthemeProviderStyles,\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,gBAQO;AACP,oBAAoB;AAKpB,qBAAoC;AAKpC,mCAAO;AACP,qBAA6B;AAC7B,0BAAwB;AACxB,yBAKO;AAKP,IAAM,sBAAkB,cAAAA,SAAS,gCAAa,EAAE,SAAS,GAAG,CAAE;AAC9D,IAAM,0BAAsB,cAAAA,SAAS,oCAAiB,EAAE,SAAS,GAAG,CAAE;AAEtE,IAAM,iCAA0C;AAAA,EAC/C,CAAE,gCAAgC,6BAA8B;AAAA,EAChE;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,IACC;AAAA,IACA;AAAA,EACD;AAAA,EACA;AAAA,I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xB,OAAQ;AAAA,MACP,OAAO;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,SAAS,EAAG;AAAA,EACf;AAEA,QAAM,0BAAsB,wBAAS,MAAM;AAE1C,UAAM,QAAQ;AAAA,MACb,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IACD;AAGA,UAAM,qBAAqB,oBAAI,IAA0B;AACzD,UAAM,SAAS,gBAAiB,MAAM,EAAG;AACzC,WAAO,QAAS,KAAM,EAAE,QAAS,CAAE,CAAE,UAAU,IAAK,MAAO;AAC1D,UAAK,aAAa,MAAO;AACxB,2BAAmB,IAAK,UAAU,MAAO;AAAA,MAC1C,OAAO;AACN,2BAAmB;AAAA,UAClB;AAAA,UACA,oBAAqB,MAAM,MAAO;AAAA,QACnC;AAAA,MACD;AAAA,IACD,CAAE;AAEF,WAAO,eAAgB;AAAA,MACtB,SAAS,MAAM;AAAA,MACf;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,SAAS,EAAG,CAAE;AAEnB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,EACD;AACD;",
|
|
6
6
|
"names": ["memoize", "colorTokens"]
|
|
7
7
|
}
|
|
@@ -20,7 +20,7 @@ function getBgRampInfo(ramp) {
|
|
|
20
20
|
pinLightness: {
|
|
21
21
|
stepName: STEP_TO_PIN,
|
|
22
22
|
value: clampAccentScaleReferenceLightness(
|
|
23
|
-
get(parse(ramp.ramp[STEP_TO_PIN]
|
|
23
|
+
get(parse(ramp.ramp[STEP_TO_PIN]), [OKLCH, "l"]),
|
|
24
24
|
ramp.direction
|
|
25
25
|
)
|
|
26
26
|
}
|
|
@@ -42,8 +42,8 @@ function checkAccessibleCombinations({
|
|
|
42
42
|
CONTRAST_COMBINATIONS.forEach(({ bgs, fgs, target }) => {
|
|
43
43
|
for (const bg of bgs) {
|
|
44
44
|
for (const fg of fgs) {
|
|
45
|
-
const bgColor = parse(ramp.ramp[bg]
|
|
46
|
-
const fgColor = parse(ramp.ramp[fg]
|
|
45
|
+
const bgColor = parse(ramp.ramp[bg]);
|
|
46
|
+
const fgColor = parse(ramp.ramp[fg]);
|
|
47
47
|
if (getContrast(bgColor, fgColor) < target) {
|
|
48
48
|
unmetTargets.push({
|
|
49
49
|
bgName: bg,
|
|
@@ -61,8 +61,8 @@ function checkAccessibleCombinations({
|
|
|
61
61
|
CONTRAST_COMBINATIONS.forEach(({ bgs, fgs, target }) => {
|
|
62
62
|
for (const bg of bgs) {
|
|
63
63
|
for (const fg of fgs) {
|
|
64
|
-
const bgColor = parse(bgRamp.ramp[bg]
|
|
65
|
-
const fgColor = parse(ramp.ramp[fg]
|
|
64
|
+
const bgColor = parse(bgRamp.ramp[bg]);
|
|
65
|
+
const fgColor = parse(ramp.ramp[fg]);
|
|
66
66
|
if (getContrast(bgColor, fgColor) < target) {
|
|
67
67
|
unmetTargets.push({
|
|
68
68
|
bgName: bg,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/color-ramps/index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, parse, serialize } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './lib/register-color-spaces';\nimport { buildRamp } from './lib/index';\nimport { clampAccentScaleReferenceLightness } from './lib/utils';\nimport { BG_RAMP_CONFIG, ACCENT_RAMP_CONFIG } from './lib/ramp-configs';\nimport type {\n\tRampResult as InternalRampResult,\n\tRampDirection,\n\tRamp,\n} from './lib/types';\nimport { getContrast } from './lib/color-utils';\nimport { CONTRAST_COMBINATIONS } from './lib/constants';\nexport { DEFAULT_SEED_COLORS } from './lib/constants';\n\n/**\n * Creates a background ramp.\n * @param seed The seed color for the background ramp.\n */\nexport function buildBgRamp( seed: string ) {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\treturn buildRamp( seed, BG_RAMP_CONFIG );\n}\n\nconst STEP_TO_PIN = 'surface2';\nfunction getBgRampInfo( ramp: InternalRampResult ): {\n\tmainDirection: RampDirection;\n\tpinLightness: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} {\n\treturn {\n\t\tmainDirection: ramp.direction,\n\t\tpinLightness: {\n\t\t\tstepName: STEP_TO_PIN,\n\t\t\tvalue: clampAccentScaleReferenceLightness(\n\t\t\t\tget( parse( ramp.ramp[ STEP_TO_PIN ]
|
|
5
|
-
"mappings": ";AAGA,SAAS,KAAK,OAAO,OAAO,iBAAiB;AAK7C,OAAO;AACP,SAAS,iBAAiB;AAC1B,SAAS,0CAA0C;AACnD,SAAS,gBAAgB,0BAA0B;AAMnD,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AAM7B,SAAS,YAAa,MAAe;AAC3C,MAAK,OAAO,SAAS,YAAY,KAAK,KAAK,MAAM,IAAK;AACrD,UAAM,IAAI,MAAO,uCAAwC;AAAA,EAC1D;AAEA,SAAO,UAAW,MAAM,cAAe;AACxC;AAEA,IAAM,cAAc;AACpB,SAAS,cAAe,MAMtB;AACD,SAAO;AAAA,IACN,eAAe,KAAK;AAAA,IACpB,cAAc;AAAA,MACb,UAAU;AAAA,MACV,OAAO;AAAA,QACN,IAAK,MAAO,KAAK,KAAM,WAAY,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { get, OKLCH, parse, serialize } from 'colorjs.io/fn';\n\n/**\n * Internal dependencies\n */\nimport './lib/register-color-spaces';\nimport { buildRamp } from './lib/index';\nimport { clampAccentScaleReferenceLightness } from './lib/utils';\nimport { BG_RAMP_CONFIG, ACCENT_RAMP_CONFIG } from './lib/ramp-configs';\nimport type {\n\tRampResult as InternalRampResult,\n\tRampDirection,\n\tRamp,\n} from './lib/types';\nimport { getContrast } from './lib/color-utils';\nimport { CONTRAST_COMBINATIONS } from './lib/constants';\nexport { DEFAULT_SEED_COLORS } from './lib/constants';\n\n/**\n * Creates a background ramp.\n * @param seed The seed color for the background ramp.\n */\nexport function buildBgRamp( seed: string ) {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\treturn buildRamp( seed, BG_RAMP_CONFIG );\n}\n\nconst STEP_TO_PIN = 'surface2';\nfunction getBgRampInfo( ramp: InternalRampResult ): {\n\tmainDirection: RampDirection;\n\tpinLightness: {\n\t\tstepName: keyof Ramp;\n\t\tvalue: number;\n\t};\n} {\n\treturn {\n\t\tmainDirection: ramp.direction,\n\t\tpinLightness: {\n\t\t\tstepName: STEP_TO_PIN,\n\t\t\tvalue: clampAccentScaleReferenceLightness(\n\t\t\t\tget( parse( ramp.ramp[ STEP_TO_PIN ] ), [ OKLCH, 'l' ] ),\n\t\t\t\tramp.direction\n\t\t\t),\n\t\t},\n\t};\n}\n\n/**\n * Creates an accent ramp (ie used by primary, success, info, warning and error\n * ramps).\n * @param seed The seed color for the accent ramp.\n * @param bgRamp The ramp of the background on which the accent is shown.\n */\nexport function buildAccentRamp(\n\tseed: string,\n\tbgRamp?: InternalRampResult\n): InternalRampResult {\n\tif ( typeof seed !== 'string' || seed.trim() === '' ) {\n\t\tthrow new Error( 'Seed color must be a non-empty string' );\n\t}\n\n\tconst bgRampInfo = bgRamp ? getBgRampInfo( bgRamp ) : undefined;\n\treturn buildRamp( seed, ACCENT_RAMP_CONFIG, bgRampInfo );\n}\n\n/**\n * Checks that all bg/fg combinations generated by the ramps meet contrast\n * targets.\n * @param params\n * @param params.bgRamp\n * @param params.accentRamps\n */\nexport function checkAccessibleCombinations( {\n\tbgRamp,\n\taccentRamps = [],\n}: {\n\tbgRamp: InternalRampResult;\n\taccentRamps?: InternalRampResult[];\n} ) {\n\tconst unmetTargets: {\n\t\tbgName: keyof Ramp;\n\t\tbgColor: string;\n\t\tfgName: keyof Ramp;\n\t\tfgColor: string;\n\t\tunmetContrast: number;\n\t}[] = [];\n\n\t// Assess combinations within each ramp\n\t[ bgRamp, ...accentRamps ].forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = parse( ramp.ramp[ bg ] );\n\t\t\t\t\tconst fgColor = parse( ramp.ramp[ fg ] );\n\t\t\t\t\tif ( getContrast( bgColor, fgColor ) < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor: serialize( bgColor ),\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor: serialize( fgColor ),\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\t// Assess each accent ramp's fg color against bg ramp\n\taccentRamps.forEach( ( ramp ) => {\n\t\tCONTRAST_COMBINATIONS.forEach( ( { bgs, fgs, target } ) => {\n\t\t\tfor ( const bg of bgs ) {\n\t\t\t\tfor ( const fg of fgs ) {\n\t\t\t\t\tconst bgColor = parse( bgRamp.ramp[ bg ] );\n\t\t\t\t\tconst fgColor = parse( ramp.ramp[ fg ] );\n\t\t\t\t\tif ( getContrast( bgColor, fgColor ) < target ) {\n\t\t\t\t\t\tunmetTargets.push( {\n\t\t\t\t\t\t\tbgName: bg,\n\t\t\t\t\t\t\tbgColor: serialize( bgColor ),\n\t\t\t\t\t\t\tfgName: fg,\n\t\t\t\t\t\t\tfgColor: serialize( fgColor ),\n\t\t\t\t\t\t\tunmetContrast: target,\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} );\n\t} );\n\n\treturn unmetTargets;\n}\n\nexport type RampResult = InternalRampResult;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,KAAK,OAAO,OAAO,iBAA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cACR,SAAS,UAAW,OAAQ;AAAA,cAC5B,QAAQ;AAAA,cACR,SAAS,UAAW,OAAQ;AAAA,cAC5B,eAAe;AAAA,YAChB,CAAE;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,cAAY,QAAS,CAAE,SAAU;AAChC,0BAAsB,QAAS,CAAE,EAAE,KAAK,KAAK,OAAO,MAAO;AAC1D,iBAAY,MAAM,KAAM;AACvB,mBAAY,MAAM,KAAM;AACvB,gBAAM,UAAU,MAAO,OAAO,KAAM,EAAG,CAAE;AACzC,gBAAM,UAAU,MAAO,KAAK,KAAM,EAAG,CAAE;AACvC,cAAK,YAAa,SAAS,OAAQ,IAAI,QAAS;AAC/C,yBAAa,KAAM;AAAA,cAClB,QAAQ;AAAA,cACR,SAAS,UAAW,OAAQ;AAAA,cAC5B,QAAQ;AAAA,cACR,SAAS,UAAW,OAAQ;AAAA,cAC5B,eAAe;AAAA,YAChB,CAAE;AAAA,UACH;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAE;AAAA,EACH,CAAE;AAEF,SAAO;AACR;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,190 +2,190 @@
|
|
|
2
2
|
var DEFAULT_RAMPS = {
|
|
3
3
|
bg: {
|
|
4
4
|
ramp: {
|
|
5
|
-
surface2:
|
|
6
|
-
bgFill1:
|
|
7
|
-
fgFill:
|
|
8
|
-
bgFill2:
|
|
9
|
-
surface6:
|
|
10
|
-
surface5:
|
|
11
|
-
surface4:
|
|
12
|
-
surface3:
|
|
13
|
-
fgSurface4:
|
|
14
|
-
fgSurface3:
|
|
15
|
-
fgSurface2:
|
|
16
|
-
fgSurface1:
|
|
17
|
-
stroke3:
|
|
18
|
-
stroke4:
|
|
19
|
-
stroke2:
|
|
20
|
-
stroke1:
|
|
21
|
-
bgFillDark:
|
|
22
|
-
fgFillDark:
|
|
23
|
-
bgFillInverted2:
|
|
24
|
-
bgFillInverted1:
|
|
25
|
-
fgFillInverted:
|
|
26
|
-
surface1:
|
|
5
|
+
surface2: "#f8f8f8",
|
|
6
|
+
bgFill1: "#555",
|
|
7
|
+
fgFill: "#f0f0f0",
|
|
8
|
+
bgFill2: "#494949",
|
|
9
|
+
surface6: "#d3d3d3",
|
|
10
|
+
surface5: "#e3e3e3",
|
|
11
|
+
surface4: "#eaeaea",
|
|
12
|
+
surface3: "#fff",
|
|
13
|
+
fgSurface4: "#1e1e1e",
|
|
14
|
+
fgSurface3: "#6e6e6e",
|
|
15
|
+
fgSurface2: "#8b8b8b",
|
|
16
|
+
fgSurface1: "#ababab",
|
|
17
|
+
stroke3: "#8b8b8b",
|
|
18
|
+
stroke4: "#6d6d6d",
|
|
19
|
+
stroke2: "#adadad",
|
|
20
|
+
stroke1: "#cfcfcf",
|
|
21
|
+
bgFillDark: "#1e1e1e",
|
|
22
|
+
fgFillDark: "#f0f0f0",
|
|
23
|
+
bgFillInverted2: "#1e1e1e",
|
|
24
|
+
bgFillInverted1: "#2d2d2d",
|
|
25
|
+
fgFillInverted: "#f0f0f0",
|
|
26
|
+
surface1: "#f0f0f0"
|
|
27
27
|
},
|
|
28
28
|
direction: "darker"
|
|
29
29
|
},
|
|
30
30
|
primary: {
|
|
31
31
|
ramp: {
|
|
32
|
-
bgFill1:
|
|
33
|
-
fgFill:
|
|
34
|
-
bgFill2:
|
|
35
|
-
surface2:
|
|
36
|
-
surface6:
|
|
37
|
-
surface5:
|
|
38
|
-
surface4:
|
|
39
|
-
surface3:
|
|
40
|
-
fgSurface4:
|
|
41
|
-
fgSurface3:
|
|
42
|
-
fgSurface2:
|
|
43
|
-
fgSurface1:
|
|
44
|
-
stroke3:
|
|
45
|
-
stroke4:
|
|
46
|
-
stroke2:
|
|
47
|
-
stroke1:
|
|
48
|
-
bgFillDark:
|
|
49
|
-
fgFillDark:
|
|
50
|
-
bgFillInverted2:
|
|
51
|
-
bgFillInverted1:
|
|
52
|
-
fgFillInverted:
|
|
53
|
-
surface1:
|
|
32
|
+
bgFill1: "#3858e9",
|
|
33
|
+
fgFill: "#eff0f2",
|
|
34
|
+
bgFill2: "#2e49da",
|
|
35
|
+
surface2: "#f6f8fc",
|
|
36
|
+
surface6: "#c7d3ef",
|
|
37
|
+
surface5: "#dce3f5",
|
|
38
|
+
surface4: "#e5ebf7",
|
|
39
|
+
surface3: "#fff",
|
|
40
|
+
fgSurface4: "#080071",
|
|
41
|
+
fgSurface3: "#3858e9",
|
|
42
|
+
fgSurface2: "#5881ff",
|
|
43
|
+
fgSurface1: "#84a9ff",
|
|
44
|
+
stroke3: "#3858e9",
|
|
45
|
+
stroke4: "#2337c8",
|
|
46
|
+
stroke2: "#6d83bf",
|
|
47
|
+
stroke1: "#91a2cf",
|
|
48
|
+
bgFillDark: "#1b1e26",
|
|
49
|
+
fgFillDark: "#eff0f2",
|
|
50
|
+
bgFillInverted2: "#1b1e26",
|
|
51
|
+
bgFillInverted1: "#12009f",
|
|
52
|
+
fgFillInverted: "#eff0f2",
|
|
53
|
+
surface1: "#edf0fa"
|
|
54
54
|
},
|
|
55
55
|
direction: "darker"
|
|
56
56
|
},
|
|
57
57
|
info: {
|
|
58
58
|
ramp: {
|
|
59
|
-
bgFill1:
|
|
60
|
-
fgFill:
|
|
61
|
-
bgFill2:
|
|
62
|
-
surface2:
|
|
63
|
-
surface6:
|
|
64
|
-
surface5:
|
|
65
|
-
surface4:
|
|
66
|
-
surface3:
|
|
67
|
-
fgSurface4:
|
|
68
|
-
fgSurface3:
|
|
69
|
-
fgSurface2:
|
|
70
|
-
fgSurface1:
|
|
71
|
-
stroke3:
|
|
72
|
-
stroke4:
|
|
73
|
-
stroke2:
|
|
74
|
-
stroke1:
|
|
75
|
-
bgFillDark:
|
|
76
|
-
fgFillDark:
|
|
77
|
-
bgFillInverted2:
|
|
78
|
-
bgFillInverted1:
|
|
79
|
-
fgFillInverted:
|
|
80
|
-
surface1:
|
|
59
|
+
bgFill1: "#0090ff",
|
|
60
|
+
fgFill: "#1b1e23",
|
|
61
|
+
bgFill2: "#0081ef",
|
|
62
|
+
surface2: "#f5f9fd",
|
|
63
|
+
surface6: "#bed6f1",
|
|
64
|
+
surface5: "#d5e5f6",
|
|
65
|
+
surface4: "#e0ebf8",
|
|
66
|
+
surface3: "#fff",
|
|
67
|
+
fgSurface4: "#001758",
|
|
68
|
+
fgSurface3: "#006dd9",
|
|
69
|
+
fgSurface2: "#008cfb",
|
|
70
|
+
fgSurface1: "#53b1ff",
|
|
71
|
+
stroke3: "#006dd9",
|
|
72
|
+
stroke4: "#004eb8",
|
|
73
|
+
stroke2: "#5d8fc6",
|
|
74
|
+
stroke1: "#8aaed6",
|
|
75
|
+
bgFillDark: "#1b1e23",
|
|
76
|
+
fgFillDark: "#eff0f2",
|
|
77
|
+
bgFillInverted2: "#1b1e23",
|
|
78
|
+
bgFillInverted1: "#002675",
|
|
79
|
+
fgFillInverted: "#eff0f2",
|
|
80
|
+
surface1: "#eaf1fa"
|
|
81
81
|
},
|
|
82
82
|
direction: "darker"
|
|
83
83
|
},
|
|
84
84
|
success: {
|
|
85
85
|
ramp: {
|
|
86
|
-
bgFill1:
|
|
87
|
-
fgFill:
|
|
88
|
-
bgFill2:
|
|
89
|
-
surface2:
|
|
90
|
-
surface6:
|
|
91
|
-
surface5:
|
|
92
|
-
surface4:
|
|
93
|
-
surface3:
|
|
94
|
-
fgSurface4:
|
|
95
|
-
fgSurface3:
|
|
96
|
-
fgSurface2:
|
|
97
|
-
fgSurface1:
|
|
98
|
-
stroke3:
|
|
99
|
-
stroke4:
|
|
100
|
-
stroke2:
|
|
101
|
-
stroke1:
|
|
102
|
-
bgFillDark:
|
|
103
|
-
fgFillDark:
|
|
104
|
-
bgFillInverted2:
|
|
105
|
-
bgFillInverted1:
|
|
106
|
-
fgFillInverted:
|
|
107
|
-
surface1:
|
|
86
|
+
bgFill1: "#4ab866",
|
|
87
|
+
fgFill: "#1b1f1c",
|
|
88
|
+
bgFill2: "#37a857",
|
|
89
|
+
surface2: "#f0fcf2",
|
|
90
|
+
surface6: "#7eea95",
|
|
91
|
+
surface5: "#b7f2c1",
|
|
92
|
+
surface4: "#cdf5d3",
|
|
93
|
+
surface3: "#fff",
|
|
94
|
+
fgSurface4: "#002b00",
|
|
95
|
+
fgSurface3: "#008031",
|
|
96
|
+
fgSurface2: "#2c9f4e",
|
|
97
|
+
fgSurface1: "#54c16f",
|
|
98
|
+
stroke3: "#008031",
|
|
99
|
+
stroke4: "#006314",
|
|
100
|
+
stroke2: "#61986b",
|
|
101
|
+
stroke1: "#77ba84",
|
|
102
|
+
bgFillDark: "#1b1f1c",
|
|
103
|
+
fgFillDark: "#edf2ed",
|
|
104
|
+
bgFillInverted2: "#1b1f1c",
|
|
105
|
+
bgFillInverted1: "#003800",
|
|
106
|
+
fgFillInverted: "#edf2ed",
|
|
107
|
+
surface1: "#ddf8e1"
|
|
108
108
|
},
|
|
109
109
|
direction: "darker"
|
|
110
110
|
},
|
|
111
111
|
caution: {
|
|
112
112
|
ramp: {
|
|
113
|
-
bgFill1:
|
|
114
|
-
fgFill:
|
|
115
|
-
bgFill2:
|
|
116
|
-
surface2:
|
|
117
|
-
surface6:
|
|
118
|
-
surface5:
|
|
119
|
-
surface4:
|
|
120
|
-
surface3:
|
|
121
|
-
fgSurface4:
|
|
122
|
-
fgSurface3:
|
|
123
|
-
fgSurface2:
|
|
124
|
-
fgSurface1:
|
|
125
|
-
stroke3:
|
|
126
|
-
stroke4:
|
|
127
|
-
stroke2:
|
|
128
|
-
stroke1:
|
|
129
|
-
bgFillDark:
|
|
130
|
-
fgFillDark:
|
|
131
|
-
bgFillInverted2:
|
|
132
|
-
bgFillInverted1:
|
|
133
|
-
fgFillInverted:
|
|
134
|
-
surface1:
|
|
113
|
+
bgFill1: "#f0d149",
|
|
114
|
+
fgFill: "#1f1e1b",
|
|
115
|
+
bgFill2: "#ddbe30",
|
|
116
|
+
surface2: "#fdf9e7",
|
|
117
|
+
surface6: "#ecd367",
|
|
118
|
+
surface5: "#f5e399",
|
|
119
|
+
surface4: "#f8ebb5",
|
|
120
|
+
surface3: "#fff",
|
|
121
|
+
fgSurface4: "#291d00",
|
|
122
|
+
fgSurface3: "#876b00",
|
|
123
|
+
fgSurface2: "#a78900",
|
|
124
|
+
fgSurface1: "#c9aa00",
|
|
125
|
+
stroke3: "#876b00",
|
|
126
|
+
stroke4: "#675000",
|
|
127
|
+
stroke2: "#978c60",
|
|
128
|
+
stroke1: "#b8ab75",
|
|
129
|
+
bgFillDark: "#1f1e1b",
|
|
130
|
+
fgFillDark: "#f6f1da",
|
|
131
|
+
bgFillInverted2: "#1f1e1b",
|
|
132
|
+
bgFillInverted1: "#3a2b00",
|
|
133
|
+
fgFillInverted: "#f6f1da",
|
|
134
|
+
surface1: "#faf1cd"
|
|
135
135
|
},
|
|
136
136
|
direction: "darker"
|
|
137
137
|
},
|
|
138
138
|
warning: {
|
|
139
139
|
ramp: {
|
|
140
|
-
bgFill1:
|
|
141
|
-
fgFill:
|
|
142
|
-
bgFill2:
|
|
143
|
-
surface2:
|
|
144
|
-
surface6:
|
|
145
|
-
surface5:
|
|
146
|
-
surface4:
|
|
147
|
-
surface3:
|
|
148
|
-
fgSurface4:
|
|
149
|
-
fgSurface3:
|
|
150
|
-
fgSurface2:
|
|
151
|
-
fgSurface1:
|
|
152
|
-
stroke3:
|
|
153
|
-
stroke4:
|
|
154
|
-
stroke2:
|
|
155
|
-
stroke1:
|
|
156
|
-
bgFillDark:
|
|
157
|
-
fgFillDark:
|
|
158
|
-
bgFillInverted2:
|
|
159
|
-
bgFillInverted1:
|
|
160
|
-
fgFillInverted:
|
|
161
|
-
surface1:
|
|
140
|
+
bgFill1: "#f0b849",
|
|
141
|
+
fgFill: "#1f1e1b",
|
|
142
|
+
bgFill2: "#dea633",
|
|
143
|
+
surface2: "#fdf7ee",
|
|
144
|
+
surface6: "#f1ce90",
|
|
145
|
+
surface5: "#f6e0bb",
|
|
146
|
+
surface4: "#f8e9cd",
|
|
147
|
+
surface3: "#fff",
|
|
148
|
+
fgSurface4: "#2f1800",
|
|
149
|
+
fgSurface3: "#976300",
|
|
150
|
+
fgSurface2: "#b78100",
|
|
151
|
+
fgSurface1: "#d9a22e",
|
|
152
|
+
stroke3: "#976300",
|
|
153
|
+
stroke4: "#754900",
|
|
154
|
+
stroke2: "#9f8860",
|
|
155
|
+
stroke1: "#c2a776",
|
|
156
|
+
bgFillDark: "#1f1e1b",
|
|
157
|
+
fgFillDark: "#f3f0e9",
|
|
158
|
+
bgFillInverted2: "#1f1e1b",
|
|
159
|
+
bgFillInverted1: "#432600",
|
|
160
|
+
fgFillInverted: "#f3f0e9",
|
|
161
|
+
surface1: "#faefdc"
|
|
162
162
|
},
|
|
163
163
|
direction: "darker"
|
|
164
164
|
},
|
|
165
165
|
error: {
|
|
166
166
|
ramp: {
|
|
167
|
-
bgFill1:
|
|
168
|
-
fgFill:
|
|
169
|
-
bgFill2:
|
|
170
|
-
surface2:
|
|
171
|
-
surface6:
|
|
172
|
-
surface5:
|
|
173
|
-
surface4:
|
|
174
|
-
surface3:
|
|
175
|
-
fgSurface4:
|
|
176
|
-
fgSurface3:
|
|
177
|
-
fgSurface2:
|
|
178
|
-
fgSurface1:
|
|
179
|
-
stroke3:
|
|
180
|
-
stroke4:
|
|
181
|
-
stroke2:
|
|
182
|
-
stroke1:
|
|
183
|
-
bgFillDark:
|
|
184
|
-
fgFillDark:
|
|
185
|
-
bgFillInverted2:
|
|
186
|
-
bgFillInverted1:
|
|
187
|
-
fgFillInverted:
|
|
188
|
-
surface1:
|
|
167
|
+
bgFill1: "#cc1818",
|
|
168
|
+
fgFill: "#f2efef",
|
|
169
|
+
bgFill2: "#bc0001",
|
|
170
|
+
surface2: "#fdf6f5",
|
|
171
|
+
surface6: "#f5c9c2",
|
|
172
|
+
surface5: "#f9dcd8",
|
|
173
|
+
surface4: "#fae5e2",
|
|
174
|
+
surface3: "#fff",
|
|
175
|
+
fgSurface4: "#4a0000",
|
|
176
|
+
fgSurface3: "#cc1818",
|
|
177
|
+
fgSurface2: "#f84d41",
|
|
178
|
+
fgSurface1: "#ff8373",
|
|
179
|
+
stroke3: "#cc1818",
|
|
180
|
+
stroke4: "#a70000",
|
|
181
|
+
stroke2: "#ca675c",
|
|
182
|
+
stroke1: "#dc8e83",
|
|
183
|
+
bgFillDark: "#231c1b",
|
|
184
|
+
fgFillDark: "#f2efef",
|
|
185
|
+
bgFillInverted2: "#231c1b",
|
|
186
|
+
bgFillInverted1: "#680000",
|
|
187
|
+
fgFillInverted: "#f2efef",
|
|
188
|
+
surface1: "#fcedea"
|
|
189
189
|
},
|
|
190
190
|
direction: "darker"
|
|
191
191
|
}
|