Skip to content

Commit

Permalink
make borders same as fill, like it is in normal modes (#1146)
Browse files Browse the repository at this point in the history
* make borders same as fill, like it is in normal modes

* fix borderColor for colorblind mode

* add borderColor to separate file
  • Loading branch information
lukasoppermann authored Dec 20, 2024
1 parent 5100c76 commit a16f30e
Show file tree
Hide file tree
Showing 15 changed files with 653 additions and 1,276 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-tools-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/primitives': patch
---

Fix borderColors in colorblind modes
9 changes: 9 additions & 0 deletions scripts/buildFigma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/light/display-light.json5`,
`src/tokens/functional/color/light/primitives-light.json5`,
`src/tokens/functional/color/light/patterns-light.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'light',
Expand All @@ -134,6 +135,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/light/display-light.json5`,
`src/tokens/functional/color/light/primitives-light.json5`,
`src/tokens/functional/color/light/patterns-light.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'light-high-contrast',
Expand All @@ -147,6 +149,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/light/display-light.json5`,
`src/tokens/functional/color/light/primitives-light.json5`,
`src/tokens/functional/color/light/patterns-light.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'light-protanopia-deuteranopia',
Expand All @@ -160,6 +163,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/light/display-light.json5`,
`src/tokens/functional/color/light/primitives-light.json5`,
`src/tokens/functional/color/light/patterns-light.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'light-tritanopia',
Expand All @@ -172,6 +176,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/dark/display-dark.json5`,
`src/tokens/functional/color/dark/primitives-dark.json5`,
`src/tokens/functional/color/dark/patterns-dark.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'dark',
Expand All @@ -185,6 +190,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/dark/display-dark.json5`,
`src/tokens/functional/color/dark/primitives-dark.json5`,
`src/tokens/functional/color/dark/patterns-dark.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'dark-high-contrast',
Expand All @@ -198,6 +204,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/dark/display-dark.json5`,
`src/tokens/functional/color/dark/primitives-dark.json5`,
`src/tokens/functional/color/dark/patterns-dark.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'dark-dimmed',
Expand All @@ -211,6 +218,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/dark/display-dark.json5`,
`src/tokens/functional/color/dark/primitives-dark.json5`,
`src/tokens/functional/color/dark/patterns-dark.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'dark-protanopia-deuteranopia',
Expand All @@ -224,6 +232,7 @@ const buildFigma = async (buildOptions: ConfigGeneratorOptions): Promise<void> =
`src/tokens/base/color/dark/display-dark.json5`,
`src/tokens/functional/color/dark/primitives-dark.json5`,
`src/tokens/functional/color/dark/patterns-dark.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/component/*.json5`,
],
theme: 'dark-tritanopia',
Expand Down
11 changes: 2 additions & 9 deletions scripts/buildTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,8 @@ export const buildDesignTokens = async (buildOptions: ConfigGeneratorOptions): P
// color, shadow & borders
{
filename: 'theme',
source: [
`src/tokens/base/color/light/light.json5`,
`src/tokens/base/color/light/display-light.json5`,
`src/tokens/functional/color/light/*.json5`,
`src/tokens/functional/shadow/light.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
],
include: [`src/tokens/base/color/light/light.json5`, 'src/tokens/functional/size/border.json5'],
source: themes.find(theme => theme.filename === 'light')?.source || [],
include: themes.find(theme => theme.filename === 'light')?.include || [],
},
// typography
{
Expand Down
11 changes: 10 additions & 1 deletion scripts/themes.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ export const themes: TokenBuildInput[] = [
filename: 'light',
theme: 'light',
source: [
`src/tokens/functional/color/light/*.json5`,
`src/tokens/functional/shadow/light.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/light/*.json5`,
],
include: [
`src/tokens/functional/size/border.json5`,
Expand All @@ -23,6 +24,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/light.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/light/*.json5`,
`src/tokens/functional/color/light/overrides/light.tritanopia.json5`,
],
Expand All @@ -39,6 +41,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/light.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/light/*.json5`,
`src/tokens/functional/color/light/overrides/light.protanopia-deuteranopia.json5`,
],
Expand All @@ -55,6 +58,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/light.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/light/*.json5`,
`src/tokens/functional/color/light/overrides/light.high-contrast.json5`,
],
Expand All @@ -72,6 +76,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/dark.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/dark/*.json5`,
],
include: [
Expand All @@ -87,6 +92,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/dark.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/dark/*.json5`,
`src/tokens/functional/color/dark/overrides/dark.dimmed.json5`,
],
Expand All @@ -104,6 +110,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/dark.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/dark/*.json5`,
`src/tokens/functional/color/dark/overrides/dark.tritanopia.json5`,
],
Expand All @@ -120,6 +127,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/dark.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/dark/*.json5`,
`src/tokens/functional/color/dark/overrides/dark.protanopia-deuteranopia.json5`,
],
Expand All @@ -136,6 +144,7 @@ export const themes: TokenBuildInput[] = [
`src/tokens/functional/shadow/dark.json5`,
`src/tokens/functional/border/*.json5`,
`src/tokens/component/*.json5`,
`src/tokens/functional/color/*.json5`,
`src/tokens/functional/color/dark/*.json5`,
`src/tokens/functional/color/dark/overrides/dark.high-contrast.json5`,
],
Expand Down
2 changes: 1 addition & 1 deletion src/schemas/colorToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const colorToken = baseColorToken
errorMap: e => {
if (e.code === 'unrecognized_keys') {
return {
message: `Unrecognized key: "${e.keys.join(', ')}", must be one of: light, light-tritanopia, light-protanopia-deutranopia, light-high-contrast, dark, dark-tritanopia, dark-protanopia-deutranopia, dark-high-contrast, dark-dimmed`,
message: `Unrecognized key: "${e.keys.join(', ')}", must be one of: light, light-tritanopia, light-protanopia-deuteranopia, light-high-contrast, dark, dark-tritanopia, dark-protanopia-deuteranopia, dark-high-contrast, dark-dimmed`,
}
}
return {message: `Error: ${e.code}`}
Expand Down
Loading

0 comments on commit a16f30e

Please sign in to comment.