From 0d0745526dbb1d73c0059d5f8c0aaa235cb2c317 Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Thu, 21 Dec 2023 10:34:32 +0100 Subject: [PATCH 1/2] updated contrast check --- scripts/color-contrast.config.ts | 10 ++++++---- scripts/color-contrast.ts | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/color-contrast.config.ts b/scripts/color-contrast.config.ts index 988894440..2df22dfac 100644 --- a/scripts/color-contrast.config.ts +++ b/scripts/color-contrast.config.ts @@ -19,8 +19,9 @@ const baseRequirements: ContrastRequirement[] = [ [4.5, 'fg.default', 'canvas.inset'], [4.5, 'fg.muted', 'canvas.inset'], // default text vs link - [3, 'fg.default', 'accent.fg'], - [3, 'fg.default', 'fg.muted'], + // disbaled because we now have the underline for links + // [3, 'fg.default', 'accent.fg'], + // [3, 'fg.default', 'fg.muted'], // default text on role bg // TODO: contrast does not work with semi-transparent colors [4.5, 'fg.default', 'accent.subtle'], @@ -108,8 +109,9 @@ const highContrast: ContrastRequirement[] = [ [7, 'fg.default', 'canvas.inset'], [7, 'fg.muted', 'canvas.inset'], // default text vs link - [4.5, 'fg.default', 'accent.fg'], - [4.5, 'fg.default', 'fg.muted'], + // disbaled because we now have the underline for links + // [4.5, 'fg.default', 'accent.fg'], + // [4.5, 'fg.default', 'fg.muted'], // default text on role bg // TODO: contrast does not work with semi-transparent colors [7, 'fg.default', 'accent.subtle'], diff --git a/scripts/color-contrast.ts b/scripts/color-contrast.ts index 9f2ea2e5e..fd862491b 100644 --- a/scripts/color-contrast.ts +++ b/scripts/color-contrast.ts @@ -248,9 +248,9 @@ export const check = async (themes?: Themes[], output: 'log' | 'file' | 'all' | const results = await checkContrastForThemes(contrastRequirements, themes) if (output === 'log' || output === 'all') { - for (const {resultTable, failingContrast} of results) { + for (const {resultTable, failingContrast, theme} of results) { // eslint-disable-next-line no-console - console.log('\n', resultTable, '\n') + console.log('\n', '\x1b[1m', `Theme: ${theme}\n`, '\x1b[0m', resultTable, '\n') if (failingContrast > 0) { // eslint-disable-next-line no-console console.error('❌ Failing contrast checks:', failingContrast, '\n') From 189338f2e43b5caa3533321c0cb34b3feb0de599 Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Thu, 21 Dec 2023 10:46:45 +0100 Subject: [PATCH 2/2] fix for color contrast --- scripts/color-contrast.config.ts | 10 ++++------ scripts/color-contrast.ts | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/scripts/color-contrast.config.ts b/scripts/color-contrast.config.ts index 2df22dfac..988894440 100644 --- a/scripts/color-contrast.config.ts +++ b/scripts/color-contrast.config.ts @@ -19,9 +19,8 @@ const baseRequirements: ContrastRequirement[] = [ [4.5, 'fg.default', 'canvas.inset'], [4.5, 'fg.muted', 'canvas.inset'], // default text vs link - // disbaled because we now have the underline for links - // [3, 'fg.default', 'accent.fg'], - // [3, 'fg.default', 'fg.muted'], + [3, 'fg.default', 'accent.fg'], + [3, 'fg.default', 'fg.muted'], // default text on role bg // TODO: contrast does not work with semi-transparent colors [4.5, 'fg.default', 'accent.subtle'], @@ -109,9 +108,8 @@ const highContrast: ContrastRequirement[] = [ [7, 'fg.default', 'canvas.inset'], [7, 'fg.muted', 'canvas.inset'], // default text vs link - // disbaled because we now have the underline for links - // [4.5, 'fg.default', 'accent.fg'], - // [4.5, 'fg.default', 'fg.muted'], + [4.5, 'fg.default', 'accent.fg'], + [4.5, 'fg.default', 'fg.muted'], // default text on role bg // TODO: contrast does not work with semi-transparent colors [7, 'fg.default', 'accent.subtle'], diff --git a/scripts/color-contrast.ts b/scripts/color-contrast.ts index fd862491b..9f2ea2e5e 100644 --- a/scripts/color-contrast.ts +++ b/scripts/color-contrast.ts @@ -248,9 +248,9 @@ export const check = async (themes?: Themes[], output: 'log' | 'file' | 'all' | const results = await checkContrastForThemes(contrastRequirements, themes) if (output === 'log' || output === 'all') { - for (const {resultTable, failingContrast, theme} of results) { + for (const {resultTable, failingContrast} of results) { // eslint-disable-next-line no-console - console.log('\n', '\x1b[1m', `Theme: ${theme}\n`, '\x1b[0m', resultTable, '\n') + console.log('\n', resultTable, '\n') if (failingContrast > 0) { // eslint-disable-next-line no-console console.error('❌ Failing contrast checks:', failingContrast, '\n')