@principal-ade/industry-theme 0.1.20 → 0.1.22
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/cjs/ContrastReport.d.ts +20 -0
- package/dist/cjs/ContrastReport.d.ts.map +1 -0
- package/dist/cjs/contrast.d.ts +75 -0
- package/dist/cjs/contrast.d.ts.map +1 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +286 -12
- package/dist/esm/ContrastReport.d.ts +20 -0
- package/dist/esm/ContrastReport.d.ts.map +1 -0
- package/dist/esm/contrast.d.ts +75 -0
- package/dist/esm/contrast.d.ts.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +286 -12
- package/package.json +8 -7
- package/src/ContrastReport.stories.tsx +77 -0
- package/src/ContrastReport.tsx +226 -0
- package/src/README.md +2 -3
- package/src/ThemeProvider.tsx +1 -20
- package/src/contrast.ts +172 -0
- package/src/index.ts +22 -0
- package/src/themes.ts +11 -11
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from './index';
|
|
3
|
+
export interface ContrastReportProps {
|
|
4
|
+
/** A single theme to audit. */
|
|
5
|
+
theme?: Theme;
|
|
6
|
+
/** Multiple named themes to audit side by side. */
|
|
7
|
+
themes?: {
|
|
8
|
+
name: string;
|
|
9
|
+
theme: Theme;
|
|
10
|
+
}[];
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders a WCAG contrast audit for one or more themes — a deterministic,
|
|
15
|
+
* exhaustive view of every declared foreground/background pairing with its
|
|
16
|
+
* ratio and AA/AAA grade. Complements `@storybook/addon-a11y`, which only
|
|
17
|
+
* checks contrast on actually-rendered text.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ContrastReport: React.FC<ContrastReportProps>;
|
|
20
|
+
//# sourceMappingURL=ContrastReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContrastReport.d.ts","sourceRoot":"","sources":["../../src/ContrastReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,mDAAmD;IACnD,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgLD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+BxD,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG 2.x contrast evaluation for themes.
|
|
3
|
+
*
|
|
4
|
+
* Implements the relative-luminance / contrast-ratio formulas from
|
|
5
|
+
* https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio and provides a
|
|
6
|
+
* declarative audit of the meaningful foreground/background pairings in a
|
|
7
|
+
* {@link Theme}. This is the deterministic, exhaustive counterpart to the
|
|
8
|
+
* axe-core checks surfaced by `@storybook/addon-a11y`: axe only inspects text
|
|
9
|
+
* that is actually rendered, whereas this audits every declared color role.
|
|
10
|
+
*/
|
|
11
|
+
import { Theme } from './index';
|
|
12
|
+
/** WCAG 2.x contrast thresholds. */
|
|
13
|
+
export declare const WCAG_THRESHOLDS: {
|
|
14
|
+
/** Normal-size text (< 18pt, or < 14pt bold). */
|
|
15
|
+
readonly text: {
|
|
16
|
+
readonly AA: 4.5;
|
|
17
|
+
readonly AAA: 7;
|
|
18
|
+
};
|
|
19
|
+
/** Large text (>= 18pt, or >= 14pt bold). */
|
|
20
|
+
readonly large: {
|
|
21
|
+
readonly AA: 3;
|
|
22
|
+
readonly AAA: 4.5;
|
|
23
|
+
};
|
|
24
|
+
/** Non-text UI components & graphical objects (borders, icons, focus rings). */
|
|
25
|
+
readonly ui: {
|
|
26
|
+
readonly AA: 3;
|
|
27
|
+
readonly AAA: 3;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type ContrastUse = keyof typeof WCAG_THRESHOLDS;
|
|
31
|
+
export type ContrastLevel = 'AAA' | 'AA' | 'fail';
|
|
32
|
+
/** Parse a CSS color string into an [r, g, b] triple in the 0–255 range. */
|
|
33
|
+
export declare function parseColor(input: string): [number, number, number] | null;
|
|
34
|
+
/** Relative luminance per WCAG, from an [r, g, b] triple (0–255). */
|
|
35
|
+
export declare function relativeLuminance([r, g, b]: [number, number, number]): number;
|
|
36
|
+
/**
|
|
37
|
+
* WCAG contrast ratio between two colors (1–21). Returns `null` if either
|
|
38
|
+
* color cannot be parsed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function contrastRatio(fg: string, bg: string): number | null;
|
|
41
|
+
/** Classify a ratio against the thresholds for a given use. */
|
|
42
|
+
export declare function gradeContrast(ratio: number, use: ContrastUse): ContrastLevel;
|
|
43
|
+
type ColorKey = keyof Theme['colors'];
|
|
44
|
+
/** A foreground/background pairing to audit. */
|
|
45
|
+
export interface ContrastPair {
|
|
46
|
+
label: string;
|
|
47
|
+
fg: ColorKey;
|
|
48
|
+
bg: ColorKey;
|
|
49
|
+
use: ContrastUse;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The meaningful color pairings every theme should satisfy. Text-on-surface
|
|
53
|
+
* pairs require AA 4.5:1; borders/graphical roles require AA 3:1.
|
|
54
|
+
*/
|
|
55
|
+
export declare const CONTRAST_PAIRS: ContrastPair[];
|
|
56
|
+
export interface ContrastResult {
|
|
57
|
+
pair: ContrastPair;
|
|
58
|
+
fgColor: string;
|
|
59
|
+
bgColor: string;
|
|
60
|
+
ratio: number | null;
|
|
61
|
+
/** Threshold required for AA at this pair's use. */
|
|
62
|
+
required: number;
|
|
63
|
+
level: ContrastLevel;
|
|
64
|
+
}
|
|
65
|
+
export interface ThemeContrastReport {
|
|
66
|
+
results: ContrastResult[];
|
|
67
|
+
/** Pairs that fail AA. */
|
|
68
|
+
failures: ContrastResult[];
|
|
69
|
+
/** True when every parseable pair clears AA. */
|
|
70
|
+
passesAA: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Run the full contrast audit for a single theme. */
|
|
73
|
+
export declare function evaluateThemeContrast(theme: Theme): ThemeContrastReport;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=contrast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../src/contrast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,oCAAoC;AACpC,eAAO,MAAM,eAAe;IAC1B,iDAAiD;;;;;IAEjD,6CAA6C;;;;;IAE7C,gFAAgF;;;;;CAExE,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,eAAe,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;AAElD,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAuCzE;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAM7E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASnE;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,GAAG,aAAa,CAK5E;AAED,KAAK,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC;AAEtC,gDAAgD;AAChD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,QAAQ,CAAC;IACb,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,WAAW,CAAC;CAClB;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,YAAY,EAwBxC,CAAC;AAEF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,0BAA0B;IAC1B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,sDAAsD;AACtD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB,CAYvE"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -131,5 +131,9 @@ export { getColor, getSpace, getFontSize, getRadius, getShadow, getZIndex, respo
|
|
|
131
131
|
export { overrideColors, makeTheme, addMode, getMode } from './themeHelpers';
|
|
132
132
|
export { ThemeShowcase } from './ThemeShowcase';
|
|
133
133
|
export type { ThemeShowcaseProps } from './ThemeShowcase';
|
|
134
|
+
export { WCAG_THRESHOLDS, CONTRAST_PAIRS, parseColor, relativeLuminance, contrastRatio, gradeContrast, evaluateThemeContrast, } from './contrast';
|
|
135
|
+
export type { ContrastUse, ContrastLevel, ContrastPair, ContrastResult, ThemeContrastReport, } from './contrast';
|
|
136
|
+
export { ContrastReport } from './ContrastReport';
|
|
137
|
+
export type { ContrastReportProps } from './ContrastReport';
|
|
134
138
|
export default theme;
|
|
135
139
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,eAAe,CAAC,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E,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,UAAU,EACV,EAAE,EACF,WAAW,EACX,WAAW,GACZ,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG7E,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG1D,OAAO,EACL,eAAe,EACf,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,eAAe,KAAK,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -53,7 +53,9 @@ __export(exports_src, {
|
|
|
53
53
|
scaleThemeFonts: () => scaleThemeFonts,
|
|
54
54
|
responsive: () => responsive,
|
|
55
55
|
resetFontScale: () => resetFontScale,
|
|
56
|
+
relativeLuminance: () => relativeLuminance,
|
|
56
57
|
regalTheme: () => regalTheme,
|
|
58
|
+
parseColor: () => parseColor,
|
|
57
59
|
overrideColors: () => overrideColors,
|
|
58
60
|
neuralPulseTheme: () => neuralPulseTheme,
|
|
59
61
|
mergeThemes: () => mergeThemes,
|
|
@@ -66,6 +68,7 @@ __export(exports_src, {
|
|
|
66
68
|
iceTangerineTheme: () => iceTangerineTheme,
|
|
67
69
|
iceTangerineDarkTheme: () => iceTangerineDarkTheme,
|
|
68
70
|
humanCentricTheme: () => humanCentricTheme,
|
|
71
|
+
gradeContrast: () => gradeContrast,
|
|
69
72
|
getZIndex: () => getZIndex,
|
|
70
73
|
getSpace: () => getSpace,
|
|
71
74
|
getShadow: () => getShadow,
|
|
@@ -73,6 +76,7 @@ __export(exports_src, {
|
|
|
73
76
|
getMode: () => getMode,
|
|
74
77
|
getFontSize: () => getFontSize,
|
|
75
78
|
getColor: () => getColor,
|
|
79
|
+
evaluateThemeContrast: () => evaluateThemeContrast,
|
|
76
80
|
enterpriseTheme: () => enterpriseTheme,
|
|
77
81
|
defaultTerminalTheme: () => defaultTerminalTheme,
|
|
78
82
|
defaultMarkdownTheme: () => defaultMarkdownTheme,
|
|
@@ -80,9 +84,13 @@ __export(exports_src, {
|
|
|
80
84
|
default: () => src_default,
|
|
81
85
|
decreaseFontScale: () => decreaseFontScale,
|
|
82
86
|
createStyle: () => createStyle,
|
|
87
|
+
contrastRatio: () => contrastRatio,
|
|
83
88
|
addMode: () => addMode,
|
|
89
|
+
WCAG_THRESHOLDS: () => WCAG_THRESHOLDS,
|
|
84
90
|
ThemeShowcase: () => ThemeShowcase,
|
|
85
|
-
ThemeProvider: () => ThemeProvider
|
|
91
|
+
ThemeProvider: () => ThemeProvider,
|
|
92
|
+
ContrastReport: () => ContrastReport,
|
|
93
|
+
CONTRAST_PAIRS: () => CONTRAST_PAIRS
|
|
86
94
|
});
|
|
87
95
|
module.exports = __toCommonJS(exports_src);
|
|
88
96
|
|
|
@@ -1719,7 +1727,7 @@ var slateNeonTheme = {
|
|
|
1719
1727
|
colors: {
|
|
1720
1728
|
text: "#d0d6e0",
|
|
1721
1729
|
background: "#1a1c1e",
|
|
1722
|
-
primary: "#
|
|
1730
|
+
primary: "#F36F41",
|
|
1723
1731
|
secondary: "#ff8257",
|
|
1724
1732
|
accent: "#00ff00",
|
|
1725
1733
|
highlight: "#2a1f18",
|
|
@@ -1738,8 +1746,8 @@ var slateNeonTheme = {
|
|
|
1738
1746
|
textTertiary: "#6b7280",
|
|
1739
1747
|
textMuted: "#4b5563",
|
|
1740
1748
|
highlightBg: "#2a1f18",
|
|
1741
|
-
highlightBorder: "#
|
|
1742
|
-
textOnPrimary: "#
|
|
1749
|
+
highlightBorder: "#F36F41",
|
|
1750
|
+
textOnPrimary: "#1a1c1e",
|
|
1743
1751
|
textOnSecondary: "#ffffff",
|
|
1744
1752
|
textOnAccent: "#1a1c1e"
|
|
1745
1753
|
},
|
|
@@ -1960,7 +1968,7 @@ var iceTangerineDarkTheme = {
|
|
|
1960
1968
|
zIndices: [0, 1, 10, 20, 30, 40, 50],
|
|
1961
1969
|
colors: {
|
|
1962
1970
|
text: "#d0e5ea",
|
|
1963
|
-
background: "#
|
|
1971
|
+
background: "#0a1829",
|
|
1964
1972
|
primary: "#ff6b35",
|
|
1965
1973
|
secondary: "#ff8257",
|
|
1966
1974
|
accent: "#0893d2",
|
|
@@ -1970,26 +1978,26 @@ var iceTangerineDarkTheme = {
|
|
|
1970
1978
|
warning: "#f59e0b",
|
|
1971
1979
|
error: "#ef4444",
|
|
1972
1980
|
info: "#0893d2",
|
|
1973
|
-
border: "#
|
|
1981
|
+
border: "#5a82aa",
|
|
1974
1982
|
backgroundSecondary: "#0f2e58",
|
|
1975
1983
|
backgroundTertiary: "#123461",
|
|
1976
1984
|
backgroundLight: "#0b1f3f",
|
|
1977
|
-
backgroundDark: "#
|
|
1985
|
+
backgroundDark: "#040b15",
|
|
1978
1986
|
backgroundHover: "#2a1f18",
|
|
1979
1987
|
primaryBlade: "#0e2b53",
|
|
1980
1988
|
surface: "#0f2e58",
|
|
1981
1989
|
textSecondary: "#9fc4d4",
|
|
1982
1990
|
textTertiary: "#7ba8bc",
|
|
1983
|
-
textMuted: "#
|
|
1991
|
+
textMuted: "#73a0b3",
|
|
1984
1992
|
highlightBg: "#2a1f18",
|
|
1985
1993
|
highlightBorder: "#ff6b35",
|
|
1986
|
-
textOnPrimary: "#
|
|
1987
|
-
textOnSecondary: "#
|
|
1988
|
-
textOnAccent: "#
|
|
1994
|
+
textOnPrimary: "#0d274d",
|
|
1995
|
+
textOnSecondary: "#0d274d",
|
|
1996
|
+
textOnAccent: "#0a1829"
|
|
1989
1997
|
},
|
|
1990
1998
|
buttons: {
|
|
1991
1999
|
primary: {
|
|
1992
|
-
color: "#
|
|
2000
|
+
color: "#0d274d",
|
|
1993
2001
|
bg: "primary",
|
|
1994
2002
|
borderWidth: 0,
|
|
1995
2003
|
"&:hover": {
|
|
@@ -2893,6 +2901,272 @@ var ThemeShowcase = ({
|
|
|
2893
2901
|
}
|
|
2894
2902
|
}, modeName)))));
|
|
2895
2903
|
};
|
|
2904
|
+
// src/contrast.ts
|
|
2905
|
+
var WCAG_THRESHOLDS = {
|
|
2906
|
+
text: { AA: 4.5, AAA: 7 },
|
|
2907
|
+
large: { AA: 3, AAA: 4.5 },
|
|
2908
|
+
ui: { AA: 3, AAA: 3 }
|
|
2909
|
+
};
|
|
2910
|
+
function parseColor(input) {
|
|
2911
|
+
if (!input)
|
|
2912
|
+
return null;
|
|
2913
|
+
const color = input.trim().toLowerCase();
|
|
2914
|
+
if (color.startsWith("#")) {
|
|
2915
|
+
let hex = color.slice(1);
|
|
2916
|
+
if (hex.length === 3 || hex.length === 4) {
|
|
2917
|
+
hex = hex.split("").map((c) => c + c).join("");
|
|
2918
|
+
}
|
|
2919
|
+
if (hex.length === 6 || hex.length === 8) {
|
|
2920
|
+
const r = parseInt(hex.slice(0, 2), 16);
|
|
2921
|
+
const g = parseInt(hex.slice(2, 4), 16);
|
|
2922
|
+
const b = parseInt(hex.slice(4, 6), 16);
|
|
2923
|
+
if ([r, g, b].some((n) => Number.isNaN(n)))
|
|
2924
|
+
return null;
|
|
2925
|
+
return [r, g, b];
|
|
2926
|
+
}
|
|
2927
|
+
return null;
|
|
2928
|
+
}
|
|
2929
|
+
const rgbMatch = color.match(/^rgba?\(([^)]+)\)$/);
|
|
2930
|
+
if (rgbMatch) {
|
|
2931
|
+
const parts = rgbMatch[1].split(/[,/\s]+/).filter(Boolean).slice(0, 3);
|
|
2932
|
+
if (parts.length < 3)
|
|
2933
|
+
return null;
|
|
2934
|
+
const channels = parts.map((p) => p.endsWith("%") ? Math.round(parseFloat(p) / 100 * 255) : parseFloat(p));
|
|
2935
|
+
if (channels.some((n) => Number.isNaN(n)))
|
|
2936
|
+
return null;
|
|
2937
|
+
return [channels[0], channels[1], channels[2]];
|
|
2938
|
+
}
|
|
2939
|
+
return null;
|
|
2940
|
+
}
|
|
2941
|
+
function relativeLuminance([r, g, b]) {
|
|
2942
|
+
const toLinear = (c) => {
|
|
2943
|
+
const s = c / 255;
|
|
2944
|
+
return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
|
|
2945
|
+
};
|
|
2946
|
+
return 0.2126 * toLinear(r) + 0.7152 * toLinear(g) + 0.0722 * toLinear(b);
|
|
2947
|
+
}
|
|
2948
|
+
function contrastRatio(fg, bg) {
|
|
2949
|
+
const a = parseColor(fg);
|
|
2950
|
+
const b = parseColor(bg);
|
|
2951
|
+
if (!a || !b)
|
|
2952
|
+
return null;
|
|
2953
|
+
const l1 = relativeLuminance(a);
|
|
2954
|
+
const l2 = relativeLuminance(b);
|
|
2955
|
+
const lighter = Math.max(l1, l2);
|
|
2956
|
+
const darker = Math.min(l1, l2);
|
|
2957
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
2958
|
+
}
|
|
2959
|
+
function gradeContrast(ratio, use) {
|
|
2960
|
+
const t = WCAG_THRESHOLDS[use];
|
|
2961
|
+
if (ratio >= t.AAA)
|
|
2962
|
+
return "AAA";
|
|
2963
|
+
if (ratio >= t.AA)
|
|
2964
|
+
return "AA";
|
|
2965
|
+
return "fail";
|
|
2966
|
+
}
|
|
2967
|
+
var CONTRAST_PAIRS = [
|
|
2968
|
+
{ label: "text on background", fg: "text", bg: "background", use: "text" },
|
|
2969
|
+
{ label: "text on surface", fg: "text", bg: "surface", use: "text" },
|
|
2970
|
+
{ label: "text on backgroundSecondary", fg: "text", bg: "backgroundSecondary", use: "text" },
|
|
2971
|
+
{ label: "textSecondary on background", fg: "textSecondary", bg: "background", use: "text" },
|
|
2972
|
+
{ label: "textTertiary on background", fg: "textTertiary", bg: "background", use: "text" },
|
|
2973
|
+
{ label: "textMuted on background", fg: "textMuted", bg: "background", use: "text" },
|
|
2974
|
+
{ label: "textOnPrimary on primary", fg: "textOnPrimary", bg: "primary", use: "text" },
|
|
2975
|
+
{ label: "textOnSecondary on secondary", fg: "textOnSecondary", bg: "secondary", use: "text" },
|
|
2976
|
+
{ label: "textOnAccent on accent", fg: "textOnAccent", bg: "accent", use: "text" },
|
|
2977
|
+
{ label: "primary on background", fg: "primary", bg: "background", use: "large" },
|
|
2978
|
+
{ label: "success on background", fg: "success", bg: "background", use: "ui" },
|
|
2979
|
+
{ label: "warning on background", fg: "warning", bg: "background", use: "ui" },
|
|
2980
|
+
{ label: "error on background", fg: "error", bg: "background", use: "ui" },
|
|
2981
|
+
{ label: "info on background", fg: "info", bg: "background", use: "ui" },
|
|
2982
|
+
{ label: "border on background", fg: "border", bg: "background", use: "ui" },
|
|
2983
|
+
{ label: "border on surface", fg: "border", bg: "surface", use: "ui" }
|
|
2984
|
+
];
|
|
2985
|
+
function evaluateThemeContrast(theme2) {
|
|
2986
|
+
const results = CONTRAST_PAIRS.map((pair) => {
|
|
2987
|
+
const fgColor = theme2.colors[pair.fg] ?? "";
|
|
2988
|
+
const bgColor = theme2.colors[pair.bg] ?? "";
|
|
2989
|
+
const ratio = contrastRatio(fgColor, bgColor);
|
|
2990
|
+
const required = WCAG_THRESHOLDS[pair.use].AA;
|
|
2991
|
+
const level = ratio === null ? "fail" : gradeContrast(ratio, pair.use);
|
|
2992
|
+
return { pair, fgColor, bgColor, ratio, required, level };
|
|
2993
|
+
});
|
|
2994
|
+
const failures = results.filter((r) => r.level === "fail");
|
|
2995
|
+
return { results, failures, passesAA: failures.length === 0 };
|
|
2996
|
+
}
|
|
2997
|
+
// src/ContrastReport.tsx
|
|
2998
|
+
var import_react3 = __toESM(require("react"));
|
|
2999
|
+
var LEVEL_STYLE = {
|
|
3000
|
+
AAA: { bg: "#0f7b3f", fg: "#ffffff", label: "AAA" },
|
|
3001
|
+
AA: { bg: "#1f6feb", fg: "#ffffff", label: "AA" },
|
|
3002
|
+
fail: { bg: "#cf222e", fg: "#ffffff", label: "FAIL" }
|
|
3003
|
+
};
|
|
3004
|
+
var ui = {
|
|
3005
|
+
fontFamily: "ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
3006
|
+
text: "#1c2128",
|
|
3007
|
+
subtle: "#57606a",
|
|
3008
|
+
border: "#d0d7de",
|
|
3009
|
+
surface: "#ffffff",
|
|
3010
|
+
panel: "#f6f8fa"
|
|
3011
|
+
};
|
|
3012
|
+
var Badge = ({ level }) => {
|
|
3013
|
+
const s = LEVEL_STYLE[level];
|
|
3014
|
+
return /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
3015
|
+
style: {
|
|
3016
|
+
display: "inline-block",
|
|
3017
|
+
minWidth: 44,
|
|
3018
|
+
textAlign: "center",
|
|
3019
|
+
padding: "2px 8px",
|
|
3020
|
+
borderRadius: 999,
|
|
3021
|
+
fontSize: 11,
|
|
3022
|
+
fontWeight: 700,
|
|
3023
|
+
letterSpacing: 0.4,
|
|
3024
|
+
backgroundColor: s.bg,
|
|
3025
|
+
color: s.fg
|
|
3026
|
+
}
|
|
3027
|
+
}, s.label);
|
|
3028
|
+
};
|
|
3029
|
+
var Swatch = ({ fg, bg }) => /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
3030
|
+
title: `${fg} on ${bg}`,
|
|
3031
|
+
style: {
|
|
3032
|
+
display: "inline-flex",
|
|
3033
|
+
alignItems: "center",
|
|
3034
|
+
justifyContent: "center",
|
|
3035
|
+
width: 40,
|
|
3036
|
+
height: 24,
|
|
3037
|
+
borderRadius: 4,
|
|
3038
|
+
border: `1px solid ${ui.border}`,
|
|
3039
|
+
backgroundColor: bg,
|
|
3040
|
+
color: fg,
|
|
3041
|
+
fontSize: 13,
|
|
3042
|
+
fontWeight: 700
|
|
3043
|
+
}
|
|
3044
|
+
}, "Aa");
|
|
3045
|
+
var Row = ({ r }) => {
|
|
3046
|
+
const failed = r.level === "fail";
|
|
3047
|
+
return /* @__PURE__ */ import_react3.default.createElement("tr", {
|
|
3048
|
+
style: { backgroundColor: failed ? "#fff5f5" : "transparent" }
|
|
3049
|
+
}, /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3050
|
+
style: cell
|
|
3051
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Swatch, {
|
|
3052
|
+
fg: r.fgColor,
|
|
3053
|
+
bg: r.bgColor
|
|
3054
|
+
})), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3055
|
+
style: { ...cell, fontWeight: 500 }
|
|
3056
|
+
}, r.pair.label, /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
3057
|
+
style: { fontSize: 11, color: ui.subtle, fontFamily: "monospace" }
|
|
3058
|
+
}, r.fgColor, " / ", r.bgColor)), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3059
|
+
style: { ...cell, textAlign: "right", fontVariantNumeric: "tabular-nums" }
|
|
3060
|
+
}, /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
3061
|
+
style: { fontWeight: 700, color: failed ? "#cf222e" : ui.text }
|
|
3062
|
+
}, r.ratio === null ? "—" : `${r.ratio.toFixed(2)}:1`)), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3063
|
+
style: {
|
|
3064
|
+
...cell,
|
|
3065
|
+
textAlign: "right",
|
|
3066
|
+
color: ui.subtle,
|
|
3067
|
+
fontVariantNumeric: "tabular-nums"
|
|
3068
|
+
}
|
|
3069
|
+
}, r.required, ":1"), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3070
|
+
style: { ...cell, textAlign: "center", textTransform: "capitalize", color: ui.subtle }
|
|
3071
|
+
}, r.pair.use), /* @__PURE__ */ import_react3.default.createElement("td", {
|
|
3072
|
+
style: { ...cell, textAlign: "center" }
|
|
3073
|
+
}, /* @__PURE__ */ import_react3.default.createElement(Badge, {
|
|
3074
|
+
level: r.level
|
|
3075
|
+
})));
|
|
3076
|
+
};
|
|
3077
|
+
var cell = {
|
|
3078
|
+
padding: "8px 12px",
|
|
3079
|
+
borderBottom: `1px solid ${ui.border}`,
|
|
3080
|
+
fontSize: 13,
|
|
3081
|
+
verticalAlign: "middle"
|
|
3082
|
+
};
|
|
3083
|
+
var headCell = {
|
|
3084
|
+
padding: "8px 12px",
|
|
3085
|
+
textAlign: "left",
|
|
3086
|
+
fontSize: 11,
|
|
3087
|
+
fontWeight: 700,
|
|
3088
|
+
textTransform: "uppercase",
|
|
3089
|
+
letterSpacing: 0.5,
|
|
3090
|
+
color: ui.subtle,
|
|
3091
|
+
borderBottom: `2px solid ${ui.border}`
|
|
3092
|
+
};
|
|
3093
|
+
var ThemeTable = ({ name, theme: theme2 }) => {
|
|
3094
|
+
const report = evaluateThemeContrast(theme2);
|
|
3095
|
+
const fails = report.failures.length;
|
|
3096
|
+
return /* @__PURE__ */ import_react3.default.createElement("section", {
|
|
3097
|
+
style: {
|
|
3098
|
+
marginBottom: 28,
|
|
3099
|
+
border: `1px solid ${ui.border}`,
|
|
3100
|
+
borderRadius: 8,
|
|
3101
|
+
overflow: "hidden",
|
|
3102
|
+
backgroundColor: ui.surface
|
|
3103
|
+
}
|
|
3104
|
+
}, /* @__PURE__ */ import_react3.default.createElement("header", {
|
|
3105
|
+
style: {
|
|
3106
|
+
display: "flex",
|
|
3107
|
+
alignItems: "center",
|
|
3108
|
+
justifyContent: "space-between",
|
|
3109
|
+
gap: 12,
|
|
3110
|
+
padding: "12px 16px",
|
|
3111
|
+
backgroundColor: ui.panel,
|
|
3112
|
+
borderBottom: `1px solid ${ui.border}`
|
|
3113
|
+
}
|
|
3114
|
+
}, /* @__PURE__ */ import_react3.default.createElement("h3", {
|
|
3115
|
+
style: { margin: 0, fontSize: 16, color: ui.text }
|
|
3116
|
+
}, name), /* @__PURE__ */ import_react3.default.createElement("span", {
|
|
3117
|
+
style: {
|
|
3118
|
+
fontSize: 12,
|
|
3119
|
+
fontWeight: 700,
|
|
3120
|
+
padding: "4px 10px",
|
|
3121
|
+
borderRadius: 999,
|
|
3122
|
+
backgroundColor: report.passesAA ? "#dafbe1" : "#ffebe9",
|
|
3123
|
+
color: report.passesAA ? "#0f7b3f" : "#cf222e"
|
|
3124
|
+
}
|
|
3125
|
+
}, report.passesAA ? "✓ Passes AA" : `${fails} AA failure${fails === 1 ? "" : "s"}`)), /* @__PURE__ */ import_react3.default.createElement("table", {
|
|
3126
|
+
style: { width: "100%", borderCollapse: "collapse" }
|
|
3127
|
+
}, /* @__PURE__ */ import_react3.default.createElement("thead", null, /* @__PURE__ */ import_react3.default.createElement("tr", null, /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3128
|
+
style: headCell
|
|
3129
|
+
}, "Sample"), /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3130
|
+
style: headCell
|
|
3131
|
+
}, "Pair"), /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3132
|
+
style: { ...headCell, textAlign: "right" }
|
|
3133
|
+
}, "Ratio"), /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3134
|
+
style: { ...headCell, textAlign: "right" }
|
|
3135
|
+
}, "Req. (AA)"), /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3136
|
+
style: { ...headCell, textAlign: "center" }
|
|
3137
|
+
}, "Use"), /* @__PURE__ */ import_react3.default.createElement("th", {
|
|
3138
|
+
style: { ...headCell, textAlign: "center" }
|
|
3139
|
+
}, "Grade"))), /* @__PURE__ */ import_react3.default.createElement("tbody", null, report.results.map((r, i) => /* @__PURE__ */ import_react3.default.createElement(Row, {
|
|
3140
|
+
key: i,
|
|
3141
|
+
r
|
|
3142
|
+
})))));
|
|
3143
|
+
};
|
|
3144
|
+
var ContrastReport = ({
|
|
3145
|
+
theme: theme2,
|
|
3146
|
+
themes,
|
|
3147
|
+
title = "WCAG Contrast Report"
|
|
3148
|
+
}) => {
|
|
3149
|
+
const list = themes ?? (theme2 ? [{ name: title, theme: theme2 }] : []);
|
|
3150
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", {
|
|
3151
|
+
style: {
|
|
3152
|
+
fontFamily: ui.fontFamily,
|
|
3153
|
+
color: ui.text,
|
|
3154
|
+
backgroundColor: ui.panel,
|
|
3155
|
+
padding: 24,
|
|
3156
|
+
minHeight: "100vh"
|
|
3157
|
+
}
|
|
3158
|
+
}, /* @__PURE__ */ import_react3.default.createElement("header", {
|
|
3159
|
+
style: { marginBottom: 20 }
|
|
3160
|
+
}, /* @__PURE__ */ import_react3.default.createElement("h1", {
|
|
3161
|
+
style: { margin: "0 0 6px", fontSize: 22 }
|
|
3162
|
+
}, title), /* @__PURE__ */ import_react3.default.createElement("p", {
|
|
3163
|
+
style: { margin: 0, fontSize: 13, color: ui.subtle, maxWidth: 720 }
|
|
3164
|
+
}, "WCAG 2.x contrast ratios for each theme's declared color roles. Text pairs require AA", " ", WCAG_THRESHOLDS.text.AA, ":1 (AAA ", WCAG_THRESHOLDS.text.AAA, ":1); large text requires", " ", WCAG_THRESHOLDS.large.AA, ":1; borders and other non-text UI require", " ", WCAG_THRESHOLDS.ui.AA, ":1.")), list.map((t) => /* @__PURE__ */ import_react3.default.createElement(ThemeTable, {
|
|
3165
|
+
key: t.name,
|
|
3166
|
+
name: t.name,
|
|
3167
|
+
theme: t.theme
|
|
3168
|
+
})));
|
|
3169
|
+
};
|
|
2896
3170
|
|
|
2897
3171
|
// src/index.ts
|
|
2898
3172
|
var theme = terminalTheme;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Theme } from './index';
|
|
3
|
+
export interface ContrastReportProps {
|
|
4
|
+
/** A single theme to audit. */
|
|
5
|
+
theme?: Theme;
|
|
6
|
+
/** Multiple named themes to audit side by side. */
|
|
7
|
+
themes?: {
|
|
8
|
+
name: string;
|
|
9
|
+
theme: Theme;
|
|
10
|
+
}[];
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders a WCAG contrast audit for one or more themes — a deterministic,
|
|
15
|
+
* exhaustive view of every declared foreground/background pairing with its
|
|
16
|
+
* ratio and AA/AAA grade. Complements `@storybook/addon-a11y`, which only
|
|
17
|
+
* checks contrast on actually-rendered text.
|
|
18
|
+
*/
|
|
19
|
+
export declare const ContrastReport: React.FC<ContrastReportProps>;
|
|
20
|
+
//# sourceMappingURL=ContrastReport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContrastReport.d.ts","sourceRoot":"","sources":["../../src/ContrastReport.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,WAAW,mBAAmB;IAClC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,mDAAmD;IACnD,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE,EAAE,CAAC;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgLD;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CA+BxD,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WCAG 2.x contrast evaluation for themes.
|
|
3
|
+
*
|
|
4
|
+
* Implements the relative-luminance / contrast-ratio formulas from
|
|
5
|
+
* https://www.w3.org/TR/WCAG21/#dfn-contrast-ratio and provides a
|
|
6
|
+
* declarative audit of the meaningful foreground/background pairings in a
|
|
7
|
+
* {@link Theme}. This is the deterministic, exhaustive counterpart to the
|
|
8
|
+
* axe-core checks surfaced by `@storybook/addon-a11y`: axe only inspects text
|
|
9
|
+
* that is actually rendered, whereas this audits every declared color role.
|
|
10
|
+
*/
|
|
11
|
+
import { Theme } from './index';
|
|
12
|
+
/** WCAG 2.x contrast thresholds. */
|
|
13
|
+
export declare const WCAG_THRESHOLDS: {
|
|
14
|
+
/** Normal-size text (< 18pt, or < 14pt bold). */
|
|
15
|
+
readonly text: {
|
|
16
|
+
readonly AA: 4.5;
|
|
17
|
+
readonly AAA: 7;
|
|
18
|
+
};
|
|
19
|
+
/** Large text (>= 18pt, or >= 14pt bold). */
|
|
20
|
+
readonly large: {
|
|
21
|
+
readonly AA: 3;
|
|
22
|
+
readonly AAA: 4.5;
|
|
23
|
+
};
|
|
24
|
+
/** Non-text UI components & graphical objects (borders, icons, focus rings). */
|
|
25
|
+
readonly ui: {
|
|
26
|
+
readonly AA: 3;
|
|
27
|
+
readonly AAA: 3;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type ContrastUse = keyof typeof WCAG_THRESHOLDS;
|
|
31
|
+
export type ContrastLevel = 'AAA' | 'AA' | 'fail';
|
|
32
|
+
/** Parse a CSS color string into an [r, g, b] triple in the 0–255 range. */
|
|
33
|
+
export declare function parseColor(input: string): [number, number, number] | null;
|
|
34
|
+
/** Relative luminance per WCAG, from an [r, g, b] triple (0–255). */
|
|
35
|
+
export declare function relativeLuminance([r, g, b]: [number, number, number]): number;
|
|
36
|
+
/**
|
|
37
|
+
* WCAG contrast ratio between two colors (1–21). Returns `null` if either
|
|
38
|
+
* color cannot be parsed.
|
|
39
|
+
*/
|
|
40
|
+
export declare function contrastRatio(fg: string, bg: string): number | null;
|
|
41
|
+
/** Classify a ratio against the thresholds for a given use. */
|
|
42
|
+
export declare function gradeContrast(ratio: number, use: ContrastUse): ContrastLevel;
|
|
43
|
+
type ColorKey = keyof Theme['colors'];
|
|
44
|
+
/** A foreground/background pairing to audit. */
|
|
45
|
+
export interface ContrastPair {
|
|
46
|
+
label: string;
|
|
47
|
+
fg: ColorKey;
|
|
48
|
+
bg: ColorKey;
|
|
49
|
+
use: ContrastUse;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The meaningful color pairings every theme should satisfy. Text-on-surface
|
|
53
|
+
* pairs require AA 4.5:1; borders/graphical roles require AA 3:1.
|
|
54
|
+
*/
|
|
55
|
+
export declare const CONTRAST_PAIRS: ContrastPair[];
|
|
56
|
+
export interface ContrastResult {
|
|
57
|
+
pair: ContrastPair;
|
|
58
|
+
fgColor: string;
|
|
59
|
+
bgColor: string;
|
|
60
|
+
ratio: number | null;
|
|
61
|
+
/** Threshold required for AA at this pair's use. */
|
|
62
|
+
required: number;
|
|
63
|
+
level: ContrastLevel;
|
|
64
|
+
}
|
|
65
|
+
export interface ThemeContrastReport {
|
|
66
|
+
results: ContrastResult[];
|
|
67
|
+
/** Pairs that fail AA. */
|
|
68
|
+
failures: ContrastResult[];
|
|
69
|
+
/** True when every parseable pair clears AA. */
|
|
70
|
+
passesAA: boolean;
|
|
71
|
+
}
|
|
72
|
+
/** Run the full contrast audit for a single theme. */
|
|
73
|
+
export declare function evaluateThemeContrast(theme: Theme): ThemeContrastReport;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=contrast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contrast.d.ts","sourceRoot":"","sources":["../../src/contrast.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,oCAAoC;AACpC,eAAO,MAAM,eAAe;IAC1B,iDAAiD;;;;;IAEjD,6CAA6C;;;;;IAE7C,gFAAgF;;;;;CAExE,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,eAAe,CAAC;AACvD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,CAAC;AAElD,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,MAAM,EA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5 +131,9 @@ export { getColor, getSpace, getFontSize, getRadius, getShadow, getZIndex, respo
|
|
|
131
131
|
export { overrideColors, makeTheme, addMode, getMode } from './themeHelpers';
|
|
132
132
|
export { ThemeShowcase } from './ThemeShowcase';
|
|
133
133
|
export type { ThemeShowcaseProps } from './ThemeShowcase';
|
|
134
|
+
export { WCAG_THRESHOLDS, CONTRAST_PAIRS, parseColor, relativeLuminance, contrastRatio, gradeContrast, evaluateThemeContrast, } from './contrast';
|
|
135
|
+
export type { ContrastUse, ContrastLevel, ContrastPair, ContrastResult, ThemeContrastReport, } from './contrast';
|
|
136
|
+
export { ContrastReport } from './ContrastReport';
|
|
137
|
+
export type { ContrastReportProps } from './ContrastReport';
|
|
134
138
|
export default theme;
|
|
135
139
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,KAAK,aAAa,GAAG;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,W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