From d88095e652c0e8d3200760c68752ebd4f97278ca Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Wed, 3 May 2023 13:29:57 +0200 Subject: [PATCH 1/2] Removing Tritanopia colorblind scale and replacing with override (#562) * Replace tritanopia scale with overrides * add changeset --- .changeset/tiny-wolves-prove.md | 5 + scripts/themes.config.ts | 7 +- .../light/overrides/light.tritanopia.json5 | 220 ++++++++++++++++++ 3 files changed, 230 insertions(+), 2 deletions(-) create mode 100644 .changeset/tiny-wolves-prove.md create mode 100644 src/tokens/functional/color/light/overrides/light.tritanopia.json5 diff --git a/.changeset/tiny-wolves-prove.md b/.changeset/tiny-wolves-prove.md new file mode 100644 index 000000000..c30eb8e83 --- /dev/null +++ b/.changeset/tiny-wolves-prove.md @@ -0,0 +1,5 @@ +--- +'@primer/primitives': patch +--- + +Replaces light Tritanopia scale with overrides diff --git a/scripts/themes.config.ts b/scripts/themes.config.ts index b940943d3..64e89a087 100644 --- a/scripts/themes.config.ts +++ b/scripts/themes.config.ts @@ -16,11 +16,14 @@ export const themes: TokenBuildInput[] = [ source: [ `src/tokens/functional/color/light/*.json5`, `src/tokens/functional/color/scales.json5`, - `src/tokens/functional/color/light/overrides/light.tritanopia.json5`, `src/tokens/functional/shadow/light.json5`, `src/tokens/functional/border/light.json5`, + `src/tokens/functional/color/light/overrides/light.tritanopia.json5`, + ], + include: [ + `src/tokens/base/color/light/light.json5`, + // `src/tokens/base/color/light/light.tritanopia.json5` ], - include: [`src/tokens/base/color/light/light.json5`, `src/tokens/base/color/light/light.tritanopia.json5`], }, { filename: 'light-colorblind', diff --git a/src/tokens/functional/color/light/overrides/light.tritanopia.json5 b/src/tokens/functional/color/light/overrides/light.tritanopia.json5 new file mode 100644 index 000000000..4d055d8a6 --- /dev/null +++ b/src/tokens/functional/color/light/overrides/light.tritanopia.json5 @@ -0,0 +1,220 @@ +/** + * Light tritanopia theme + * @extends all functional tokens + * @description All overwrites for functional color tokens for this theme are in this file + */ +{ + fgColor: { + success: { + $value: '{base.color.blue.5}', + $type: 'color', + }, + severe: { + $value: '{base.color.red.5}', + $type: 'color', + }, + }, + bgColor: { + success: { + muted: { + $value: '{base.color.blue.0}', + $type: 'color', + }, + emphasis: { + $value: '{base.color.blue.4}', + $type: 'color', + mix: { + color: '{base.color.blue.5}', + weight: 0.75, + }, + }, + }, + severe: { + muted: { + $value: '{base.color.red.0}', + $type: 'color', + }, + emphasis: { + $value: '{base.color.red.5}', + $type: 'color', + }, + }, + }, + borderColor: { + success: { + muted: { + $value: '{base.color.blue.3}', + $type: 'color', + alpha: 0.4, + }, + emphasis: { + $value: '{base.color.blue.4}', + $type: 'color', + }, + }, + severe: { + muted: { + $value: '{base.color.red.3}', + $type: 'color', + alpha: 0.4, + }, + emphasis: { + $value: '{base.color.red.5}', + $type: 'color', + }, + }, + }, + diffBlob: { + addition: { + bgColor: { + num: { + $value: '{base.color.blue.1}', + $type: 'color', + mix: { + color: '{base.color.blue.0}', + weight: 0.8, + }, + }, + line: { + $value: '{base.color.blue.0}', + $type: 'color', + }, + word: { + $value: '{base.color.blue.1}', + $type: 'color', + }, + }, + }, + }, + codeMirror: { + syntax: { + fgColor: { + variable: { + $value: '{base.color.red.6}', + $type: 'color', + }, + }, + }, + }, + button: { + primary: { + bgColor: { + hover: { + $value: '{bgColor.success.emphasis}', + $type: 'color', + mix: { + color: '{base.color.blue.6}', + weight: 0.2, + }, + }, + active: { + $value: '{bgColor.success.emphasis}', + $type: 'color', + mix: { + color: '{base.color.blue.6}', + weight: 0.4, + }, + }, + disabled: { + $value: '{base.color.blue.4}', + $type: 'color', + mix: { + color: '{base.color.blue.0}', + weight: 0.6, + }, + }, + }, + shadow: { + selected: { + $value: [ + { + color: '{base.color.blue.9}', + alpha: 0.3, + offsetX: '0px', + offsetY: '1px', + blur: '0px', + spread: '0px', + inset: true, + }, + ], + $type: 'shadow', + }, + }, + }, + }, + color: { + ansi: { + green: { + $value: '{base.color.blue.6}', + $type: 'color', + }, + 'green-bright': { + $value: '{base.color.blue.5}', + $type: 'color', + }, + }, + prettylights: { + syntax: { + 'string-regexp': { + $value: '{base.color.blue.6}', + $type: 'color', + }, + variable: { + $value: '{base.color.red.6}', + $type: 'color', + }, + markup: { + inserted: { + text: { + $value: '{base.color.blue.6}', + $type: 'color', + }, + bg: { + $value: '{base.color.blue.0}', + $type: 'color', + }, + }, + changed: { + text: { + $value: '{base.color.red.6}', + $type: 'color', + }, + bg: { + $value: '{base.color.red.1}', + $type: 'color', + }, + }, + }, + }, + }, + /** + * @description All overwrites for color scales + */ + scale: { + green: { + '0': {$value: '{base.color.blue.0}'}, + '1': {$value: '{base.color.blue.1}'}, + '2': {$value: '{base.color.blue.2}'}, + '3': {$value: '{base.color.blue.3}'}, + '4': {$value: '{base.color.blue.4}'}, + '5': {$value: '{base.color.blue.5}'}, + '6': {$value: '{base.color.blue.6}'}, + '7': {$value: '{base.color.blue.7}'}, + '8': {$value: '{base.color.blue.8}'}, + '9': {$value: '{base.color.blue.9}'}, + }, + orange: { + '0': {$value: '{base.color.red.0}'}, + '1': {$value: '{base.color.red.1}'}, + '2': {$value: '{base.color.red.2}'}, + '3': {$value: '{base.color.red.3}'}, + '4': {$value: '{base.color.red.4}'}, + '5': {$value: '{base.color.red.5}'}, + '6': {$value: '{base.color.red.6}'}, + '7': {$value: '{base.color.red.7}'}, + '8': {$value: '{base.color.red.8}'}, + '9': {$value: '{base.color.red.9}'}, + }, + }, + }, +} From b8bc786a5da55d55a5ccdcf61664be47810e92fb Mon Sep 17 00:00:00 2001 From: Lukas Oppermann Date: Wed, 3 May 2023 13:35:34 +0200 Subject: [PATCH 2/2] Dark protanopia deuteranopia adding overrides (#608) * adding overrides * add changeset --- .changeset/hip-trains-peel.md | 5 + scripts/themes.config.ts | 7 +- .../dark.protanopia-deuteranopia.json5 | 267 +++++++++++++++++- 3 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 .changeset/hip-trains-peel.md diff --git a/.changeset/hip-trains-peel.md b/.changeset/hip-trains-peel.md new file mode 100644 index 000000000..fc09eb5c6 --- /dev/null +++ b/.changeset/hip-trains-peel.md @@ -0,0 +1,5 @@ +--- +'@primer/primitives': patch +--- + +Replace dark-colorblind scale with overrides diff --git a/scripts/themes.config.ts b/scripts/themes.config.ts index 64e89a087..bc44cc451 100644 --- a/scripts/themes.config.ts +++ b/scripts/themes.config.ts @@ -87,11 +87,14 @@ export const themes: TokenBuildInput[] = [ source: [ `src/tokens/functional/color/dark/*.json5`, `src/tokens/functional/color/scales.json5`, - `src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5`, `src/tokens/functional/shadow/dark.json5`, `src/tokens/functional/border/dark.json5`, + `src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5`, + ], + include: [ + `src/tokens/base/color/dark/dark.json5`, + // , `src/tokens/base/color/dark/dark.protanopia-deuteranopia.json5` ], - include: [`src/tokens/base/color/dark/dark.json5`, `src/tokens/base/color/dark/dark.protanopia-deuteranopia.json5`], }, { filename: 'dark-high-contrast', diff --git a/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 b/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 index 72ee86699..1e8d1deaa 100644 --- a/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 +++ b/src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5 @@ -5,6 +5,14 @@ */ { fgColor: { + success: { + $value: '{base.color.blue.3}', + $type: 'color', + }, + danger: { + $value: '{base.color.orange.4}', + $type: 'color', + }, open: { $value: '{base.color.orange.3}', $type: 'color', @@ -15,6 +23,28 @@ }, }, bgColor: { + success: { + muted: { + $value: '{base.color.blue.4}', + $type: 'color', + alpha: 0.15, + }, + emphasis: { + $value: '{base.color.blue.5}', + $type: 'color', + }, + }, + danger: { + muted: { + $value: '{base.color.orange.4}', + $type: 'color', + alpha: 0.1, + }, + emphasis: { + $value: '{base.color.orange.5}', + $type: 'color', + }, + }, open: { muted: { $value: '{base.color.orange.4}', @@ -61,15 +91,250 @@ $type: 'color', }, }, + success: { + muted: { + $value: '{base.color.blue.4}', + $type: 'color', + alpha: 0.4, + }, + emphasis: { + $value: '{base.color.blue.5}', + $type: 'color', + }, + }, + danger: { + muted: { + $value: '{base.color.orange.4}', + $type: 'color', + alpha: 0.4, + }, + emphasis: { + $value: '{base.color.orange.5}', + $type: 'color', + }, + }, + }, + control: { + danger: { + fgColor: { + hover: { + $value: '{base.color.orange.3}', + $type: 'color', + }, + }, + }, + }, + codeMirror: { + syntax: { + fgColor: { + keyword: { + $value: '{base.color.orange.3}', + $type: 'color', + }, + storage: { + $value: '{base.color.orange.3}', + $type: 'color', + }, + }, + }, }, button: { primary: { bgColor: { + hover: { + $value: '{bgColor.success.emphasis}', + $type: 'color', + mix: { + color: '{base.color.blue.3}', + weight: 0.2, + }, + }, + active: { + $value: '{bgColor.success.emphasis}', + $type: 'color', + mix: { + color: '{base.color.blue.3}', + weight: 0.4, + }, + }, disabled: { - $value: '{base.color.green.6}', + $value: '{base.color.blue.6}', + $type: 'color', + mix: null, + }, + }, + }, + danger: { + bgColor: { + hover: { + $value: '{base.color.orange.6}', + $type: 'color', + }, + active: { + $value: '{base.color.orange.6}', + $type: 'color', + mix: { + color: '{base.color.orange.4}', + weight: 0.4, + }, + }, + }, + borderColor: { + hover: { + $value: '{base.color.orange.6}', + $type: 'color', + }, + }, + }, + }, + diffBlob: { + addition: { + bgColor: { + num: { + $value: '{base.color.blue.3}', + $type: 'color', + alpha: 0.3, + }, + line: { + $value: '{base.color.blue.4}', + $type: 'color', + alpha: 0.15, + mix: null, + }, + word: { + $value: '{base.color.blue.4}', + $type: 'color', + alpha: 0.4, + }, + }, + }, + deletion: { + bgColor: { + num: { + $value: '{base.color.orange.4}', + $type: 'color', + alpha: 0.3, + }, + line: { + $value: '{base.color.orange.4}', $type: 'color', + alpha: 0.15, mix: null, }, + word: { + $value: '{base.color.orange.4}', + $type: 'color', + alpha: 0.4, + }, + }, + }, + }, + color: { + ansi: { + green: { + $value: '{base.color.blue.3}', + $type: 'color', + }, + 'green-bright': { + $value: '{base.color.blue.2}', + $type: 'color', + }, + red: { + $value: '{base.color.orange.3}', + $type: 'color', + }, + 'red-bright': { + $value: '{base.color.orange.2}', + $type: 'color', + }, + }, + prettylights: { + syntax: { + 'entity-tag': { + $value: '{base.color.blue.1}', + $type: 'color', + }, + keyword: { + $value: '{base.color.orange.3}', + $type: 'color', + }, + brackethighlighter: { + unmatched: { + $value: '{base.color.orange.4}', + $type: 'color', + }, + }, + invalid: { + illegal: { + bg: { + $value: '{base.color.orange.7}', + $type: 'color', + }, + }, + }, + carriage: { + return: { + bg: { + $value: '{base.color.orange.6}', + $type: 'color', + }, + }, + }, + 'string-regexp': { + $value: '{base.color.blue.1}', + $type: 'color', + }, + markup: { + deleted: { + text: { + $value: '{base.color.orange.0}', + $type: 'color', + }, + bg: { + $value: '{base.color.orange.8}', + $type: 'color', + }, + }, + inserted: { + text: { + $value: '{base.color.blue.0}', + $type: 'color', + }, + bg: { + $value: '{base.color.blue.8}', + $type: 'color', + }, + }, + }, + }, + }, + /** + * @description All overwrites for color scales + */ + scale: { + green: { + '0': {$value: '{base.color.blue.0}'}, + '1': {$value: '{base.color.blue.1}'}, + '2': {$value: '{base.color.blue.2}'}, + '3': {$value: '{base.color.blue.3}'}, + '4': {$value: '{base.color.blue.4}'}, + '5': {$value: '{base.color.blue.5}'}, + '6': {$value: '{base.color.blue.6}'}, + '7': {$value: '{base.color.blue.7}'}, + '8': {$value: '{base.color.blue.8}'}, + '9': {$value: '{base.color.blue.9}'}, + }, + red: { + '0': {$value: '{base.color.orange.0}'}, + '1': {$value: '{base.color.orange.1}'}, + '2': {$value: '{base.color.orange.2}'}, + '3': {$value: '{base.color.orange.3}'}, + '4': {$value: '{base.color.orange.4}'}, + '5': {$value: '{base.color.orange.5}'}, + '6': {$value: '{base.color.orange.6}'}, + '7': {$value: '{base.color.orange.7}'}, + '8': {$value: '{base.color.orange.8}'}, + '9': {$value: '{base.color.orange.9}'}, }, }, },