From b6f0e520780415488d6f8dfa97930b5b5a9a7ff2 Mon Sep 17 00:00:00 2001 From: Joshua Chen Date: Thu, 5 May 2022 14:54:50 +0800 Subject: [PATCH] fix lighthouse --- admin/scripts/format-lighthouse-score.mjs | 8 ++++---- website/src/css/custom.css | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/admin/scripts/format-lighthouse-score.mjs b/admin/scripts/format-lighthouse-score.mjs index b73595cdc3ad..38622370169a 100644 --- a/admin/scripts/format-lighthouse-score.mjs +++ b/admin/scripts/format-lighthouse-score.mjs @@ -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}`; }; /** diff --git a/website/src/css/custom.css b/website/src/css/custom.css index bcfe9fa251d5..ea43cb37b897 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -19,6 +19,8 @@ --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; } html[data-theme='dark'] { @@ -28,6 +30,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%); @@ -41,10 +47,12 @@ html[data-theme='dark'] { --ifm-color-primary-lightest: hsl( var(--site-primary-hue-saturation-light) 58% ); - /* Use a darker color to ensure contrast */ - --ifm-breadcrumb-color-active: var(--ifm-color-primary-darker); } +/* + * 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%);