mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 10:17:55 +02:00
fix(website): fix multiple accessibility issues around color contrast (#7336)
* fix(website): darken breadcrumbs color to ensure contrast * fix lighthouse * fix more a11y * more fix
This commit is contained in:
parent
eea27aad68
commit
8f80f6c0b2
3 changed files with 22 additions and 5 deletions
|
@ -18,12 +18,12 @@ const summaryKeys = {
|
|||
pwa: 'PWA',
|
||||
};
|
||||
|
||||
/** @param {number} score */
|
||||
const scoreEntry = (score) => {
|
||||
const normalizedScore = Math.round(score * 100);
|
||||
/** @param {number} rawScore */
|
||||
const scoreEntry = (rawScore) => {
|
||||
const score = Math.round(rawScore * 100);
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
const scoreIcon = score >= 90 ? '🟢' : score >= 50 ? '🟠' : '🔴';
|
||||
return `${scoreIcon} ${normalizedScore}`;
|
||||
return `${scoreIcon} ${score}`;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
--site-color-checkbox-checked-bg: hsl(167deg 56% 73% / 25%);
|
||||
--site-color-feedback-background: #fff;
|
||||
--docusaurus-highlighted-code-line-bg: rgb(0 0 0 / 10%);
|
||||
/* Use a darker color to ensure contrast, ideally we don't need important */
|
||||
--ifm-breadcrumb-color-active: var(--ifm-color-primary-darker) !important;
|
||||
--ifm-menu-color-active: var(--ifm-color-primary-darker) !important;
|
||||
}
|
||||
|
||||
html[data-theme='dark'] {
|
||||
|
@ -28,6 +31,10 @@ html[data-theme='dark'] {
|
|||
--docusaurus-highlighted-code-line-bg: rgb(66 66 66 / 35%);
|
||||
}
|
||||
|
||||
/*
|
||||
* This selector will be dynamically replaced by the color generator. Don't put
|
||||
* other properties here.
|
||||
*/
|
||||
[data-theme='light'] {
|
||||
--ifm-color-primary: hsl(var(--site-primary-hue-saturation) 30%);
|
||||
--ifm-color-primary-dark: hsl(var(--site-primary-hue-saturation) 26%);
|
||||
|
@ -43,6 +50,10 @@ html[data-theme='dark'] {
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* This selector will be dynamically replaced by the color generator. Don't put
|
||||
* other properties here.
|
||||
*/
|
||||
[data-theme='dark'] {
|
||||
--ifm-color-primary: hsl(var(--site-primary-hue-saturation) 45%);
|
||||
--ifm-color-primary-dark: hsl(var(--site-primary-hue-saturation) 41%);
|
||||
|
|
|
@ -51,7 +51,7 @@ export default {
|
|||
{
|
||||
types: ['font-matter', 'string', 'attr-value'],
|
||||
style: {
|
||||
color: '#E3116C',
|
||||
color: '#C6105F',
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -90,5 +90,11 @@ export default {
|
|||
color: '#E36209',
|
||||
},
|
||||
},
|
||||
{
|
||||
types: ['comment'],
|
||||
style: {
|
||||
color: '#6B6B6B',
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue