fix(ui): meet wcag aa text contrast in both themes
- add --color-primary-text for lime used as text or icon color - stop dimming the idle refresh label with opacity - darken the light danger button and lighten the dark danger hover - define syntax highlighting colors per theme as --hl-* tokens - darken light muted text slightly - add a storybook contrast page, fail storybook tests on a11y violations and show live token values in the colors story - bump version to 1.20.2
This commit is contained in:
1 parent
8aadbd25fb
commit
6e9b99e415
11 files changed
+437
-24
No files matched your search
@@ -2,6 +2,24 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## 1.20.2 - 2026-09-30
|
||||||
|
|
||||||
|
Changes since 1.20.1:
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Text contrast now meets WCAG AA (4.5:1) in both themes:
|
||||||
|
- the "Live" refresh label and the table sort icon use a new `--color-primary-text` token (dark lime in the light theme) instead of the light lime brand color;
|
||||||
|
- the idle refresh label is no longer dimmed with opacity;
|
||||||
|
- the light theme's danger button is a little darker, and the dark theme's danger hover is lighter so its dark text stays readable;
|
||||||
|
- syntax highlighting colors are defined per theme (`--hl-*` tokens), darker in the light theme;
|
||||||
|
- muted text is slightly darker in the light theme.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A Storybook "Accessibility / Contrast" page that measures the contrast of the most contrast-prone components in both themes.
|
||||||
|
- Storybook accessibility checks now fail the tests on violations (`a11y.test: 'error'`). The Colors story shows each token's current value per theme and includes the syntax colors.
|
||||||
|
|
||||||
## 1.20.1 - 2026-09-30
|
## 1.20.1 - 2026-09-30
|
||||||
|
|
||||||
Changes since 1.20.0:
|
Changes since 1.20.0:
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ const preview: Preview = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
a11y: {
|
a11y: {
|
||||||
test: 'todo',
|
// Accessibility violations (e.g. color contrast) fail the story's test
|
||||||
|
test: 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
import React from 'react';
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
||||||
import type { Meta, StoryObj } from '@storybook/react-vite';
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||||
|
|
||||||
const palette = [
|
const palette = [
|
||||||
{ name: 'Atlantis', token: '--color-primary', hex: '#9DD341', role: 'Primary / Action' },
|
{ name: 'Atlantis', token: '--color-primary', hex: '#9DD341', role: 'Primary / Action' },
|
||||||
|
{
|
||||||
|
name: 'Atlantis text',
|
||||||
|
token: '--color-primary-text',
|
||||||
|
hex: '#496904',
|
||||||
|
role: 'Primary as text / icon',
|
||||||
|
},
|
||||||
{ name: 'Outer Space', token: '--color-text', hex: '#2D3339', role: 'Text / Surface' },
|
{ name: 'Outer Space', token: '--color-text', hex: '#2D3339', role: 'Text / Surface' },
|
||||||
{ name: 'Kimberly', token: '--color-text-muted', hex: '#6650C0', role: 'Muted text / Info' },
|
{ name: 'Kimberly', token: '--color-text-muted', hex: '#634DBD', role: 'Muted text / Info' },
|
||||||
{ name: 'Powder Ash', token: '--color-border', hex: '#AFBFB9', role: 'Border / Neutral' },
|
{ name: 'Powder Ash', token: '--color-border', hex: '#AFBFB9', role: 'Border / Neutral' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -23,12 +29,23 @@ const semanticColors = [
|
|||||||
{ name: 'Running fg', token: '--color-running-fg', hex: '#6B4A00' },
|
{ name: 'Running fg', token: '--color-running-fg', hex: '#6B4A00' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const syntaxColors = [
|
||||||
|
{ name: 'Comment', token: '--hl-comment', hex: '#4F6557' },
|
||||||
|
{ name: 'Keyword', token: '--hl-keyword', hex: '#764E99' },
|
||||||
|
{ name: 'String / title', token: '--hl-string', hex: '#4F6821' },
|
||||||
|
{ name: 'Number', token: '--hl-number', hex: '#895403' },
|
||||||
|
{ name: 'Function', token: '--hl-function', hex: '#056980' },
|
||||||
|
{ name: 'Variable / params', token: '--hl-variable', hex: '#815354' },
|
||||||
|
{ name: 'Property', token: '--hl-property', hex: '#1D6971' },
|
||||||
|
{ name: 'Meta', token: '--hl-meta', hex: '#615B7E' },
|
||||||
|
];
|
||||||
|
|
||||||
const surfaceColors = [
|
const surfaceColors = [
|
||||||
{ name: 'Background', token: '--color-bg', hex: '#E6EDEA' },
|
{ name: 'Background', token: '--color-bg', hex: '#E6EDEA' },
|
||||||
{ name: 'Background subtle', token: '--color-bg-subtle', hex: '#D8E2DE' },
|
{ name: 'Background subtle', token: '--color-bg-subtle', hex: '#D8E2DE' },
|
||||||
{ name: 'Secondary', token: '--color-secondary', hex: '#EDF1EF' },
|
{ name: 'Secondary', token: '--color-secondary', hex: '#EDF1EF' },
|
||||||
{ name: 'Secondary hover', token: '--color-secondary-hover', hex: '#DFE6E3' },
|
{ name: 'Secondary hover', token: '--color-secondary-hover', hex: '#DFE6E3' },
|
||||||
{ name: 'Danger', token: '--color-danger', hex: '#D94F4F' },
|
{ name: 'Danger', token: '--color-danger', hex: '#CE4546' },
|
||||||
{ name: 'Primary fg', token: '--color-primary-fg', hex: '#2D3339' },
|
{ name: 'Primary fg', token: '--color-primary-fg', hex: '#2D3339' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -43,8 +60,27 @@ function Swatch({
|
|||||||
hex: string;
|
hex: string;
|
||||||
role?: string;
|
role?: string;
|
||||||
}) {
|
}) {
|
||||||
|
// Show the token's current value (per theme) rather than a hard-coded copy
|
||||||
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
const [value, setValue] = useState(hex);
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
const read = () => {
|
||||||
|
if (!ref.current) return;
|
||||||
|
const resolved = getComputedStyle(ref.current).getPropertyValue(token).trim();
|
||||||
|
if (resolved) setValue(resolved.toUpperCase());
|
||||||
|
};
|
||||||
|
read();
|
||||||
|
// Re-read when the theme toolbar switches data-theme on <html>
|
||||||
|
const observer = new MutationObserver(read);
|
||||||
|
observer.observe(document.documentElement, {
|
||||||
|
attributes: true,
|
||||||
|
attributeFilter: ['data-theme'],
|
||||||
|
});
|
||||||
|
return () => observer.disconnect();
|
||||||
|
}, [token]);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
ref={ref}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
@@ -72,7 +108,7 @@ function Swatch({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
|
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
|
||||||
{hex}
|
{value}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
|
<div style={{ fontSize: 11, fontFamily: 'monospace', color: 'var(--color-text-muted)' }}>
|
||||||
{token}
|
{token}
|
||||||
@@ -128,6 +164,11 @@ function ColorPalette() {
|
|||||||
<Swatch key={c.token} {...c} />
|
<Swatch key={c.token} {...c} />
|
||||||
))}
|
))}
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section title="Syntax highlighting">
|
||||||
|
{syntaxColors.map((c) => (
|
||||||
|
<Swatch key={c.token} {...c} />
|
||||||
|
))}
|
||||||
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default meta;
|
|||||||
type Story = StoryObj<typeof ContextMenu>;
|
type Story = StoryObj<typeof ContextMenu>;
|
||||||
|
|
||||||
const trigger = (
|
const trigger = (
|
||||||
<Button variant="ghost" size="sm">
|
<Button variant="ghost" size="sm" aria-label="Actions">
|
||||||
<Settings size={16} />
|
<Settings size={16} />
|
||||||
</Button>
|
</Button>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,330 @@
|
|||||||
|
import React, { useLayoutEffect, useRef, useState } from 'react';
|
||||||
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
||||||
|
import { AutoRefreshIndicator } from '../../src/ui/AutoRefreshIndicator/AutoRefreshIndicator';
|
||||||
|
import { Button } from '../../src/ui/Button/Button';
|
||||||
|
import { CodeBlock } from '../../src/ui/CodeBlock/CodeBlock';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Text contrast review page (WCAG AA: 4.5:1 for normal text, 3:1 for large
|
||||||
|
* text) for the components where contrast is easiest to get wrong: light
|
||||||
|
* brand colors used as text, dimmed labels, colored buttons and syntax
|
||||||
|
* highlighting. Every sample is the real component, shown in both themes, and
|
||||||
|
* the contrast of each piece of text is measured live from the rendered
|
||||||
|
* colors - so this page stays accurate as the design tokens change.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ── Contrast measurement ─────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
type Rgba = [number, number, number, number];
|
||||||
|
|
||||||
|
function parseColor(value: string): Rgba {
|
||||||
|
const parts = value.match(/[\d.]+/g)?.map(Number) ?? [0, 0, 0];
|
||||||
|
return [parts[0], parts[1], parts[2], parts[3] ?? 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
function luminance([r, g, b]: Rgba): number {
|
||||||
|
const channel = (c: number) => {
|
||||||
|
const s = c / 255;
|
||||||
|
return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
|
||||||
|
};
|
||||||
|
return 0.2126 * channel(r) + 0.7152 * channel(g) + 0.0722 * channel(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
function contrast(a: Rgba, b: Rgba): number {
|
||||||
|
const [hi, lo] = [luminance(a), luminance(b)].sort((x, y) => y - x);
|
||||||
|
return (hi + 0.05) / (lo + 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Blends `top` over an opaque `bottom`. */
|
||||||
|
function blend(top: Rgba, bottom: Rgba): Rgba {
|
||||||
|
const a = top[3];
|
||||||
|
return [0, 1, 2].map((i) => top[i] * a + bottom[i] * (1 - a)).concat(1) as Rgba;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Product of the `opacity` of `el` and its ancestors (e.g. a dimmed idle label). */
|
||||||
|
function opacityChain(el: Element): number {
|
||||||
|
let opacity = 1;
|
||||||
|
for (let node: Element | null = el; node; node = node.parentElement) {
|
||||||
|
opacity *= parseFloat(getComputedStyle(node).opacity);
|
||||||
|
}
|
||||||
|
return opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** The opaque color behind `el`, from its own and its ancestors' backgrounds. */
|
||||||
|
function effectiveBackground(el: Element): Rgba {
|
||||||
|
const layers: Rgba[] = [];
|
||||||
|
for (let node: Element | null = el; node; node = node.parentElement) {
|
||||||
|
const bg = parseColor(getComputedStyle(node).backgroundColor);
|
||||||
|
bg[3] *= opacityChain(node);
|
||||||
|
if (bg[3] > 0) layers.push(bg);
|
||||||
|
if (bg[3] >= 1) break;
|
||||||
|
}
|
||||||
|
return layers.reduceRight<Rgba>((under, layer) => blend(layer, under), [255, 255, 255, 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const hex = ([r, g, b]: Rgba) =>
|
||||||
|
'#' + [r, g, b].map((c) => Math.round(c).toString(16).padStart(2, '0')).join('');
|
||||||
|
|
||||||
|
interface Measurement {
|
||||||
|
text: string;
|
||||||
|
fg: string;
|
||||||
|
bg: string;
|
||||||
|
ratio: number;
|
||||||
|
required: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Measures every element that directly contains visible text. */
|
||||||
|
function measure(root: HTMLElement): Measurement[] {
|
||||||
|
const seen = new Set<string>();
|
||||||
|
const results: Measurement[] = [];
|
||||||
|
for (const el of Array.from(root.querySelectorAll<HTMLElement>('*'))) {
|
||||||
|
const text = Array.from(el.childNodes)
|
||||||
|
.filter((n) => n.nodeType === Node.TEXT_NODE)
|
||||||
|
.map((n) => n.textContent ?? '')
|
||||||
|
.join('')
|
||||||
|
.trim();
|
||||||
|
if (!text || el.closest('[aria-hidden="true"]')) continue;
|
||||||
|
const style = getComputedStyle(el);
|
||||||
|
const fontSize = parseFloat(style.fontSize);
|
||||||
|
const bold = Number(style.fontWeight) >= 700;
|
||||||
|
// WCAG "large text": at least 24px, or 18.66px bold
|
||||||
|
const required = fontSize >= 24 || (bold && fontSize >= 18.66) ? 3 : 4.5;
|
||||||
|
const bgColor = effectiveBackground(el);
|
||||||
|
const fg = parseColor(style.color);
|
||||||
|
fg[3] *= opacityChain(el);
|
||||||
|
const fgColor = blend(fg, bgColor);
|
||||||
|
const key = `${hex(fgColor)}|${hex(bgColor)}|${required}`;
|
||||||
|
if (seen.has(key)) continue;
|
||||||
|
seen.add(key);
|
||||||
|
results.push({
|
||||||
|
text: text.length > 28 ? `${text.slice(0, 28)}…` : text,
|
||||||
|
fg: hex(fgColor),
|
||||||
|
bg: hex(bgColor),
|
||||||
|
ratio: contrast(fgColor, bgColor),
|
||||||
|
required,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return results.sort((a, b) => a.ratio / a.required - b.ratio / b.required);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Readout({ items }: { items: Measurement[] }) {
|
||||||
|
return (
|
||||||
|
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: 12, marginTop: 8 }}>
|
||||||
|
<tbody>
|
||||||
|
{items.map((m) => {
|
||||||
|
const pass = m.ratio >= m.required;
|
||||||
|
return (
|
||||||
|
<tr
|
||||||
|
key={`${m.fg}${m.bg}${m.required}`}
|
||||||
|
style={{ borderTop: '1px solid var(--color-border)' }}
|
||||||
|
>
|
||||||
|
<td style={{ padding: '4px 6px' }}>
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
display: 'inline-block',
|
||||||
|
padding: '1px 6px',
|
||||||
|
borderRadius: 3,
|
||||||
|
background: m.bg,
|
||||||
|
color: m.fg,
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{m.text}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
style={{
|
||||||
|
padding: '4px 6px',
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
color: 'var(--color-text-muted)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{m.fg} on {m.bg}
|
||||||
|
</td>
|
||||||
|
<td
|
||||||
|
style={{
|
||||||
|
padding: '4px 6px',
|
||||||
|
textAlign: 'right',
|
||||||
|
fontWeight: 700,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
color: pass ? 'var(--color-text)' : 'var(--color-danger)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{m.ratio.toFixed(2)}:1 {pass ? '✓' : `✗ needs ${m.required}:1`}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Renders a sample and measures its text contrast after layout. */
|
||||||
|
function Sample({ children }: { children: React.ReactNode }) {
|
||||||
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
const [items, setItems] = useState<Measurement[]>([]);
|
||||||
|
useLayoutEffect(() => {
|
||||||
|
const el = ref.current;
|
||||||
|
if (!el) return;
|
||||||
|
// Measure after the theme/styles have applied
|
||||||
|
const frame = requestAnimationFrame(() => setItems(measure(el)));
|
||||||
|
return () => cancelAnimationFrame(frame);
|
||||||
|
}, []);
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div ref={ref}>{children}</div>
|
||||||
|
<Readout items={items} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Page ─────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
// Covers every syntax color: comment, keyword, string, number, function
|
||||||
|
// (title), params, property
|
||||||
|
const JS_CODE = [
|
||||||
|
'// Open the app and wait for the dashboard',
|
||||||
|
'async function openDashboard(context, timeoutMs) {',
|
||||||
|
" const url = context.getEnv('BASE_URL');",
|
||||||
|
' await context.page.goto(url, { timeout: timeoutMs ?? 30000 });',
|
||||||
|
' return context.page.title();',
|
||||||
|
'}',
|
||||||
|
].join('\n');
|
||||||
|
const JSON_CODE = JSON.stringify(
|
||||||
|
{ status: 'pass', attempts: 2, cached: false, output: { title: 'Dashboard' } },
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
|
||||||
|
interface Issue {
|
||||||
|
title: string;
|
||||||
|
note: string;
|
||||||
|
render: () => React.ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const ISSUES: Issue[] = [
|
||||||
|
{
|
||||||
|
title: 'AutoRefreshIndicator label',
|
||||||
|
note: 'Active ("Live", --color-primary-text), idle and error labels (runs pages).',
|
||||||
|
render: () => (
|
||||||
|
<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap' }}>
|
||||||
|
<AutoRefreshIndicator active pulseKey={1} />
|
||||||
|
<AutoRefreshIndicator active={false} />
|
||||||
|
<AutoRefreshIndicator active={false} error />
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Danger button',
|
||||||
|
note: 'Danger, primary and secondary buttons (text on colored backgrounds).',
|
||||||
|
render: () => (
|
||||||
|
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
|
||||||
|
<Button variant="danger">Delete</Button>
|
||||||
|
<Button variant="danger" size="sm">
|
||||||
|
Delete
|
||||||
|
</Button>
|
||||||
|
<Button variant="primary">Run</Button>
|
||||||
|
<Button variant="secondary">Cancel</Button>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Code highlighting - JavaScript',
|
||||||
|
note: 'All --hl-* syntax colors on the page background (step code, snippets).',
|
||||||
|
render: () => <CodeBlock language="javascript" code={JS_CODE} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Code highlighting - JSON',
|
||||||
|
note: 'Keys, strings, numbers and literals in JSON step outputs.',
|
||||||
|
render: () => <CodeBlock language="json" code={JSON_CODE} />,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Muted text',
|
||||||
|
note: '--color-text-muted on both background shades (hints, table headers, descriptions).',
|
||||||
|
render: () => (
|
||||||
|
<div style={{ display: 'flex', gap: 8 }}>
|
||||||
|
{['var(--color-bg)', 'var(--color-bg-subtle)'].map((bg) => (
|
||||||
|
<span
|
||||||
|
key={bg}
|
||||||
|
style={{
|
||||||
|
background: bg,
|
||||||
|
color: 'var(--color-text-muted)',
|
||||||
|
padding: '4px 8px',
|
||||||
|
fontSize: 13,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Last run 2 minutes ago
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
function Panel({ theme }: { theme: 'light' | 'dark' }) {
|
||||||
|
return (
|
||||||
|
<section
|
||||||
|
// The dark tokens apply under [data-theme="dark"]; light is the page default
|
||||||
|
data-theme={theme === 'dark' ? 'dark' : undefined}
|
||||||
|
style={{
|
||||||
|
flex: '1 1 420px',
|
||||||
|
minWidth: 0,
|
||||||
|
padding: 16,
|
||||||
|
borderRadius: 8,
|
||||||
|
background: 'var(--color-bg)',
|
||||||
|
color: 'var(--color-text)',
|
||||||
|
border: '1px solid var(--color-border)',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<h2 style={{ margin: '0 0 12px', fontSize: 16 }}>
|
||||||
|
{theme === 'dark' ? 'Dark theme' : 'Light theme'}
|
||||||
|
</h2>
|
||||||
|
{ISSUES.map((issue) => (
|
||||||
|
<div key={issue.title} style={{ marginBottom: 24 }}>
|
||||||
|
<h3 style={{ margin: '0 0 2px', fontSize: 14 }}>{issue.title}</h3>
|
||||||
|
<p style={{ margin: '0 0 8px', fontSize: 12, color: 'var(--color-text-muted)' }}>
|
||||||
|
{issue.note}
|
||||||
|
</p>
|
||||||
|
<Sample>{issue.render()}</Sample>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ContrastPage() {
|
||||||
|
return (
|
||||||
|
<div style={{ padding: 16 }}>
|
||||||
|
<p
|
||||||
|
style={{
|
||||||
|
margin: '0 0 16px',
|
||||||
|
fontSize: 13,
|
||||||
|
color: 'var(--color-text-muted)',
|
||||||
|
maxWidth: 820,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Text contrast of the components where it's easiest to get wrong (WCAG AA: 4.5:1 for normal
|
||||||
|
text, 3:1 for large text). Each row is a piece of text in the sample, measured from its
|
||||||
|
rendered colors, worst first.
|
||||||
|
</p>
|
||||||
|
<div style={{ display: 'flex', gap: 16, flexWrap: 'wrap', alignItems: 'flex-start' }}>
|
||||||
|
<Panel theme="light" />
|
||||||
|
<Panel theme="dark" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta: Meta<typeof ContrastPage> = {
|
||||||
|
title: 'Accessibility/Contrast',
|
||||||
|
component: ContrastPage,
|
||||||
|
// a11y checks use the project default ('error' in preview.tsx)
|
||||||
|
parameters: { layout: 'fullscreen' },
|
||||||
|
// The light panel relies on the page default (light) theme
|
||||||
|
globals: { theme: 'light' },
|
||||||
|
};
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof ContrastPage>;
|
||||||
|
|
||||||
|
export const Overview: Story = {};
|
||||||
@@ -71,7 +71,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.active .label {
|
.active .label {
|
||||||
color: var(--color-primary);
|
color: var(--color-primary-text);
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +83,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.inactive .label {
|
.inactive .label {
|
||||||
|
/* Not dimmed with opacity: muted text already reads as inactive and keeps 4.5:1 */
|
||||||
color: var(--color-text-muted);
|
color: var(--color-text-muted);
|
||||||
opacity: 0.5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Error state ──────────────────────────────────────────── */
|
/* ── Error state ──────────────────────────────────────────── */
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
.code :global(.hljs-comment),
|
.code :global(.hljs-comment),
|
||||||
.code :global(.hljs-quote) {
|
.code :global(.hljs-quote) {
|
||||||
color: var(--hl-comment, #6A8072);
|
color: var(--hl-comment);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
.code :global(.hljs-built_in),
|
.code :global(.hljs-built_in),
|
||||||
.code :global(.hljs-name),
|
.code :global(.hljs-name),
|
||||||
.code :global(.hljs-tag) {
|
.code :global(.hljs-tag) {
|
||||||
color: var(--hl-keyword, #A67DCC);
|
color: var(--hl-keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-string),
|
.code :global(.hljs-string),
|
||||||
@@ -39,32 +39,32 @@
|
|||||||
.code :global(.hljs-template-variable),
|
.code :global(.hljs-template-variable),
|
||||||
.code :global(.hljs-type),
|
.code :global(.hljs-type),
|
||||||
.code :global(.hljs-addition) {
|
.code :global(.hljs-addition) {
|
||||||
color: var(--hl-string, #9BB870);
|
color: var(--hl-string);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-number),
|
.code :global(.hljs-number),
|
||||||
.code :global(.hljs-regexp),
|
.code :global(.hljs-regexp),
|
||||||
.code :global(.hljs-link) {
|
.code :global(.hljs-link) {
|
||||||
color: var(--hl-number, #E8A85F);
|
color: var(--hl-number);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-function),
|
.code :global(.hljs-function),
|
||||||
.code :global(.hljs-title.hljs-function_) {
|
.code :global(.hljs-title.hljs-function_) {
|
||||||
color: var(--hl-function, #5BB8D4);
|
color: var(--hl-function);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-variable),
|
.code :global(.hljs-variable),
|
||||||
.code :global(.hljs-params) {
|
.code :global(.hljs-params) {
|
||||||
color: var(--hl-variable, #D4A0A0);
|
color: var(--hl-variable);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-property) {
|
.code :global(.hljs-property) {
|
||||||
color: var(--hl-property, #79C0C8);
|
color: var(--hl-property);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-deletion),
|
.code :global(.hljs-deletion),
|
||||||
.code :global(.hljs-meta) {
|
.code :global(.hljs-meta) {
|
||||||
color: var(--hl-meta, #A9A3C9);
|
color: var(--hl-meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
.code :global(.hljs-emphasis) {
|
.code :global(.hljs-emphasis) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@
|
|||||||
|
|
||||||
.sortIconActive {
|
.sortIconActive {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
color: var(--color-primary);
|
color: var(--color-primary-text);
|
||||||
}
|
}
|
||||||
|
|
||||||
[data-theme="dark"] .th {
|
[data-theme="dark"] .th {
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
--color-primary-hover: #8ABD2E;
|
--color-primary-hover: #8ABD2E;
|
||||||
--color-primary-active: #77A320;
|
--color-primary-active: #77A320;
|
||||||
--color-primary-fg: #2D3339; /* Outer Space on bright green */
|
--color-primary-fg: #2D3339; /* Outer Space on bright green */
|
||||||
|
/* Primary as text/icon color on light surfaces (Atlantis is too light for text) */
|
||||||
|
--color-primary-text: #496904;
|
||||||
|
|
||||||
/* Secondary — Kimberly tint */
|
/* Secondary — Kimberly tint */
|
||||||
--color-secondary: #EDEAF8;
|
--color-secondary: #EDEAF8;
|
||||||
@@ -19,8 +21,8 @@
|
|||||||
--color-secondary-fg: #6650C0; /* Kimberly */
|
--color-secondary-fg: #6650C0; /* Kimberly */
|
||||||
--color-secondary-border: #B8B0E0;
|
--color-secondary-border: #B8B0E0;
|
||||||
|
|
||||||
/* Danger */
|
/* Danger (white text needs >= 4.5:1) */
|
||||||
--color-danger: #D94F4F;
|
--color-danger: #CE4546;
|
||||||
--color-danger-hover: #C03A3A;
|
--color-danger-hover: #C03A3A;
|
||||||
--color-danger-fg: #ffffff;
|
--color-danger-fg: #ffffff;
|
||||||
|
|
||||||
@@ -43,11 +45,21 @@
|
|||||||
--color-link-hover: #3D2F80;
|
--color-link-hover: #3D2F80;
|
||||||
|
|
||||||
--color-text: #2D3339;
|
--color-text: #2D3339;
|
||||||
--color-text-muted: #6650C0; /* Kimberly */
|
--color-text-muted: #634DBD; /* Kimberly, a touch darker for 4.5:1 on bg-subtle */
|
||||||
--color-border: #AFBFB9; /* Powder Ash */
|
--color-border: #AFBFB9; /* Powder Ash */
|
||||||
--color-bg: #E6EDEA; /* Powder Ash tint */
|
--color-bg: #E6EDEA; /* Powder Ash tint */
|
||||||
--color-bg-subtle: #D8E2DE; /* Powder Ash tint, 1 step darker */
|
--color-bg-subtle: #D8E2DE; /* Powder Ash tint, 1 step darker */
|
||||||
|
|
||||||
|
/* Syntax highlighting (CodeBlock); each >= 4.5:1 on bg and bg-subtle */
|
||||||
|
--hl-comment: #4F6557;
|
||||||
|
--hl-keyword: #764E99;
|
||||||
|
--hl-string: #4F6821;
|
||||||
|
--hl-number: #895403;
|
||||||
|
--hl-function: #056980;
|
||||||
|
--hl-variable: #815354;
|
||||||
|
--hl-property: #1D6971;
|
||||||
|
--hl-meta: #615B7E;
|
||||||
|
|
||||||
/* Spacing */
|
/* Spacing */
|
||||||
--space-1: 4px;
|
--space-1: 4px;
|
||||||
--space-2: 8px;
|
--space-2: 8px;
|
||||||
@@ -112,6 +124,7 @@ a:hover {
|
|||||||
--color-primary-hover: #AEDE55;
|
--color-primary-hover: #AEDE55;
|
||||||
--color-primary-active: #8ABD2E;
|
--color-primary-active: #8ABD2E;
|
||||||
--color-primary-fg: #1A1F24;
|
--color-primary-fg: #1A1F24;
|
||||||
|
--color-primary-text: #9DD341;
|
||||||
|
|
||||||
/* Secondary — dark Kimberly tint */
|
/* Secondary — dark Kimberly tint */
|
||||||
--color-secondary: #2A2548;
|
--color-secondary: #2A2548;
|
||||||
@@ -122,7 +135,7 @@ a:hover {
|
|||||||
|
|
||||||
/* Danger */
|
/* Danger */
|
||||||
--color-danger: #E06060;
|
--color-danger: #E06060;
|
||||||
--color-danger-hover: #CC4A4A;
|
--color-danger-hover: #F06E6D; /* lighter, so the dark text keeps >= 4.5:1 */
|
||||||
--color-danger-fg: #1A1F24;
|
--color-danger-fg: #1A1F24;
|
||||||
|
|
||||||
/* Semantic */
|
/* Semantic */
|
||||||
@@ -148,4 +161,14 @@ a:hover {
|
|||||||
--color-border: #3D4850;
|
--color-border: #3D4850;
|
||||||
--color-bg: #1A1F24; /* deeper than Outer Space */
|
--color-bg: #1A1F24; /* deeper than Outer Space */
|
||||||
--color-bg-subtle: #2D3339; /* Outer Space */
|
--color-bg-subtle: #2D3339; /* Outer Space */
|
||||||
|
|
||||||
|
/* Syntax highlighting (CodeBlock); each >= 4.5:1 on bg and bg-subtle */
|
||||||
|
--hl-comment: #8AA192;
|
||||||
|
--hl-keyword: #B38ADA;
|
||||||
|
--hl-string: #9BB870;
|
||||||
|
--hl-number: #E8A85F;
|
||||||
|
--hl-function: #5BB8D4;
|
||||||
|
--hl-variable: #D4A0A0;
|
||||||
|
--hl-property: #79C0C8;
|
||||||
|
--hl-meta: #A9A3C9;
|
||||||
}
|
}
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.20.1",
|
"version": "1.20.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.20.1",
|
"version": "1.20.2",
|
||||||
"workspaces": [
|
"workspaces": [
|
||||||
"server",
|
"server",
|
||||||
"client"
|
"client"
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liqa",
|
"name": "liqa",
|
||||||
"version": "1.20.1",
|
"version": "1.20.2",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24"
|
"node": ">=24"
|
||||||
|
|||||||
Reference in new issue
Block a user