Skip to content

Commit

Permalink
fix for color contrast
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Dec 21, 2023
1 parent 0d07455 commit 189338f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions scripts/color-contrast.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions scripts/color-contrast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 189338f

Please sign in to comment.