diff --git a/docs/package.json b/docs/package.json
index 7eafbf4a01c..acd932030aa 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -17,9 +17,9 @@
"@astro-community/astro-embed-youtube": "^0.5.2",
"@astrojs/starlight": "workspace:*",
"@lunariajs/core": "^0.1.1",
- "@types/culori": "^2.0.0",
+ "@types/culori": "^2.1.1",
"astro": "^4.10.2",
- "culori": "^3.2.0",
+ "culori": "^4.0.1",
"sharp": "^0.32.5"
},
"devDependencies": {
diff --git a/docs/src/components/theme-designer.astro b/docs/src/components/theme-designer.astro
index 4138dcaa908..286b2075b46 100644
--- a/docs/src/components/theme-designer.astro
+++ b/docs/src/components/theme-designer.astro
@@ -1,12 +1,16 @@
---
import { TabItem, Tabs } from '@astrojs/starlight/components';
import ColorEditor, { type Props as EditorProps } from './theme-designer/color-editor.astro';
+import ContrastLevel, {
+ type Props as ContrastLevelProps,
+} from './theme-designer/contrast-level.astro';
import Presets, { type Props as PresetsProps } from './theme-designer/presets.astro';
import Preview from './theme-designer/preview.astro';
interface Props {
labels: {
presets: PresetsProps['labels'];
+ contrast: ContrastLevelProps['labels'];
editor: EditorProps['labels'] & { accentColor: string; grayColor: string };
preview: Record<
'darkMode' | 'lightMode' | 'bodyText' | 'linkText' | 'dimText' | 'inlineCode',
@@ -15,12 +19,14 @@ interface Props {
};
}
const {
- labels: { presets, editor, preview },
+ labels: { presets, contrast, editor, preview },
} = Astro.props;
---
+
+
@@ -52,7 +58,7 @@ const {
+
+
diff --git a/docs/src/components/theme-designer/presets.astro b/docs/src/components/theme-designer/presets.astro
index 140cf1ae4d8..b0c8d73d2a2 100644
--- a/docs/src/components/theme-designer/presets.astro
+++ b/docs/src/components/theme-designer/presets.astro
@@ -64,6 +64,10 @@ const resolvedPresets = Object.entries(presets).map(([key, preset]) => {
font-size: var(--sl-text-xs);
cursor: pointer;
}
+ button:focus-visible {
+ outline: 2px solid;
+ outline-offset: -4px;
+ }
:global([data-theme='light']) [data-preset] {
background-color: var(--light-bg);
color: var(--light-text);
diff --git a/docs/src/components/theme-designer/store.ts b/docs/src/components/theme-designer/store.ts
index 6eb1aa8249d..6466a845814 100644
--- a/docs/src/components/theme-designer/store.ts
+++ b/docs/src/components/theme-designer/store.ts
@@ -1,4 +1,4 @@
-import { map } from './atom';
+import { atom, map } from './atom';
export const presets = {
ocean: {
@@ -27,6 +27,7 @@ export const store = {
accent: map(presets.default.accent),
gray: map(presets.default.gray),
};
+export const minimumContrast = atom(4.5);
export const usePreset = (name: string) => {
if (name in presets) {
diff --git a/docs/src/content/docs/guides/css-and-tailwind.mdx b/docs/src/content/docs/guides/css-and-tailwind.mdx
index 45c88e652b6..405b8e27c34 100644
--- a/docs/src/content/docs/guides/css-and-tailwind.mdx
+++ b/docs/src/content/docs/guides/css-and-tailwind.mdx
@@ -251,6 +251,8 @@ These variables are used throughout the UI with a range of gray shades used for
Use the sliders below to modify Starlight’s accent and gray color palettes.
The dark and light preview areas will show the resulting colors, and the whole page will also update to preview your changes.
+Use the Contrast Level option to specify which of the Web Content Accessibility Guideline [colour contrast standards](https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable/Color_contrast) to meet.
+
When you’re happy with your changes, copy the CSS or Tailwind code below and use it in your project.
import ThemeDesigner from '~/components/theme-designer.astro';
@@ -266,6 +268,9 @@ import ThemeDesigner from '~/components/theme-designer.astro';
default: 'Default',
random: 'Random',
},
+ contrast: {
+ label: 'Contrast Level',
+ },
editor: {
accentColor: 'Accent',
grayColor: 'Gray',
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4253d88deb2..4fb4f8fba46 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -48,14 +48,14 @@ importers:
specifier: ^0.1.1
version: 0.1.1
'@types/culori':
- specifier: ^2.0.0
- version: 2.0.0
+ specifier: ^2.1.1
+ version: 2.1.1
astro:
specifier: ^4.10.2
version: 4.10.2(@types/node@18.16.19)(typescript@5.4.5)
culori:
- specifier: ^3.2.0
- version: 3.2.0
+ specifier: ^4.0.1
+ version: 4.0.1
sharp:
specifier: ^0.32.5
version: 0.32.6
@@ -2088,8 +2088,8 @@ packages:
/@types/cookie@0.6.0:
resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
- /@types/culori@2.0.0:
- resolution: {integrity: sha512-bKpEra39sQS9UZ+1JoWhuGJEzwKS0dUkNCohVYmn6CAEBkqyIXimKiPDRZWtiOB7sKgkWMaTUpHFimygRoGIlg==}
+ /@types/culori@2.1.1:
+ resolution: {integrity: sha512-NzLYD0vNHLxTdPp8+RlvGbR2NfOZkwxcYGFwxNtm+WH2NuUNV8785zv1h0sulFQ5aFQ9n/jNDUuJeo3Bh7+oFA==}
dev: false
/@types/debug@4.1.12:
@@ -3093,8 +3093,8 @@ packages:
stream-transform: 2.1.3
dev: true
- /culori@3.2.0:
- resolution: {integrity: sha512-HIEbTSP7vs1mPq/2P9In6QyFE0Tkpevh0k9a+FkjhD+cwsYm9WRSbn4uMdW9O0yXlNYC3ppxL3gWWPOcvEl57w==}
+ /culori@4.0.1:
+ resolution: {integrity: sha512-LSnjA6HuIUOlkfKVbzi2OlToZE8OjFi667JWN9qNymXVXzGDmvuP60SSgC+e92sd7B7158f7Fy3Mb6rXS5EDPw==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
dev: false