Skip to content

Commit 2a60cf8

Browse files
authored
docs: fix some wcag-aa color contrast issues (#9468)
1 parent 3934206 commit 2a60cf8

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

docs/.vitepress/components/ListItem.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ function reset() {
1919
const color = computed(() => {
2020
return {
2121
'--vp-c-brand-1': state.value === 1
22-
? '#66ba1c'
22+
? 'var(--color-brand)'
2323
: state.value === 2
24-
? 'rgba(248, 113, 113)'
25-
: 'rgba(250, 204, 21)',
24+
? 'var(--vp-c-red-1)'
25+
: 'var(--vp-c-yellow-1)',
2626
} as any
2727
})
2828
@@ -42,7 +42,9 @@ onMounted(async () => {
4242
<li :style="color">
4343
<div ref="el" class="icon-container">
4444
<div class="icon-wrapper" :class="state ? 'flip' : ''">
45-
<Icon icon="carbon:circle-dash" class="icon-spinner" width="1.2em" height="1.2em" />
45+
<svg xmlns="http://www.w3.org/2000/svg" width="1.2em" height="1.2em" viewBox="0 0 32 32" class="icon-spinner">
46+
<circle cx="16" cy="16" r="13" fill="none" stroke="currentColor" stroke-width="2" stroke-dasharray="8 4" />
47+
</svg>
4648
</div>
4749
<div class="icon-wrapper" :class="state === 2 ? '' : 'flip'">
4850
<Icon icon="carbon:close-outline" class="icon-error" width="1.2em" height="1.2em" />
@@ -79,15 +81,15 @@ onMounted(async () => {
7981
8082
.icon-spinner {
8183
animation: spin 1s linear infinite;
82-
color: rgb(250, 204, 21);
84+
color: var(--vp-c-yellow-1);
8385
}
8486
8587
.icon-error {
86-
color: rgb(248, 113, 113);
88+
color: var(--vp-c-red-1);
8789
}
8890
8991
.icon-success {
90-
color: var(--vp-c-brand-1);
92+
color: var(--color-brand);
9193
}
9294
9395
@keyframes spin {

docs/.vitepress/theme/styles.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55
/* Vitest */
66
:root[data-variant="vitest"] {
77
--color-brand: #008039;
8+
/* TODO: home page wcag-aa color contrast (remove this once fixed at void0 theme):
9+
* - why vitest section and texts
10+
* - vitest, resources, versions and social
11+
* - footer
12+
*/
13+
--color-grey: #867e8e;
814
}
915

1016
:root.dark:not([data-theme])[data-variant="vitest"],
1117
:root[data-theme="dark"][data-variant="vitest"] {
1218
--color-brand: var(--color-zest);
1319
}
1420

21+
:root[data-variant="vitest"]:not(.dark):not([data-theme="light"]),
1522
:root[data-theme="light"][data-variant="vitest"] {
1623
--color-brand: #008039;
24+
/* TODO: code block (remove this once fixed at void0 theme) */
25+
--vp-code-color: #007d38;
1726
}
1827

1928

@@ -48,4 +57,4 @@ html:not(.dark) .VPContent kbd {
4857
padding: 2px 5px;
4958
position: relative;
5059
top: -1px;
51-
}
60+
}

0 commit comments

Comments
 (0)