Skip to content

Commit

Permalink
chore: fix staticWhite color rebrand
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra committed Jan 11, 2024
1 parent 6b92f3c commit a692797
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ const textColor = (property: 'icon' | 'text') => {
return {
base: {
primary: {
default: `interactive.${property}.staticWhite.normal`,
highlighted: `interactive.${property}.staticWhite.normal`,
default: `interactive.${property}.onPrimary.normal`,
highlighted: `interactive.${property}.onPrimary.normal`,
disabled: `interactive.${property}.primary.disabled`,
},
secondary: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const CheckboxIcon = ({
size,
}: CheckboxIconProps) => {
const { theme } = useTheme();
const iconColor = getIn(theme, 'colors.interactive.icon.staticWhite.normal');
const iconColor = getIn(theme, 'colors.interactive.icon.onPrimary.normal');
return (
<CheckboxIconWrapper
size={size}
Expand Down
8 changes: 4 additions & 4 deletions packages/blade/src/components/Radio/radioTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const radioIconColors: RadioIconColors = {
variants: {
default: {
dot: {
checked: 'colors.interactive.icon.staticWhite.normal',
checked: 'colors.interactive.icon.onPrimary.normal',
unchecked: 'colors.transparent',
},
border: {
Expand All @@ -72,8 +72,8 @@ const radioIconColors: RadioIconColors = {
},
disabled: {
dot: {
checked: 'colors.interactive.icon.staticWhite.normal',
unchecked: 'colors.interactive.icon.staticWhite.normal',
checked: 'colors.interactive.icon.onPrimary.normal',
unchecked: 'colors.interactive.icon.onPrimary.normal',
},
border: {
checked: 'colors.transparent',
Expand All @@ -86,7 +86,7 @@ const radioIconColors: RadioIconColors = {
},
negative: {
dot: {
checked: 'colors.interactive.icon.staticWhite.normal',
checked: 'colors.interactive.icon.onPrimary.normal',
unchecked: 'colors.transparent',
},
border: {
Expand Down
80 changes: 40 additions & 40 deletions packages/blade/src/tokens/theme/createTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ const getOnLightOverrides = (
): DeepPartial<ThemeTokens['colors']['onLight']> => {
// Select the most readable color to use as the foreground color on top of surface color
// For example: On Secondary Button where the background color is surface color, the text color should be either the brand color or dark color depending on which is more readable on top of that surface color
const foregroundOnSurfaceLight = tinycolor.isReadable(
const foregroundOnSurface = tinycolor.isReadable(
globalColors.neutral.blueGrayLight[50],
brandColors[600],
WCAG2ContrastOptions,
)
? brandColors[600]
: globalColors.neutral.blueGrayLight[1100];

const staticWhiteDefault = tinycolor
const foregroundOnBrand = tinycolor
.mostReadable(
brandColors[900],
[globalColors.neutral.white[500], globalColors.neutral.black[500]],
Expand Down Expand Up @@ -142,30 +142,30 @@ const getOnLightOverrides = (
},
text: {
primary: {
normal: foregroundOnSurfaceLight,
disabled: foregroundOnSurfaceLight,
muted: foregroundOnSurfaceLight,
subtle: foregroundOnSurfaceLight,
normal: foregroundOnSurface,
disabled: foregroundOnSurface,
muted: foregroundOnSurface,
subtle: foregroundOnSurface,
},
staticWhite: {
normal: staticWhiteDefault,
disabled: staticWhiteDefault,
muted: staticWhiteDefault,
subtle: staticWhiteDefault,
onPrimary: {
normal: foregroundOnBrand,
disabled: foregroundOnBrand,
muted: foregroundOnBrand,
subtle: foregroundOnBrand,
},
},
icon: {
primary: {
normal: foregroundOnSurfaceLight,
disabled: foregroundOnSurfaceLight,
muted: foregroundOnSurfaceLight,
subtle: foregroundOnSurfaceLight,
normal: foregroundOnSurface,
disabled: foregroundOnSurface,
muted: foregroundOnSurface,
subtle: foregroundOnSurface,
},
staticWhite: {
normal: staticWhiteDefault,
disabled: staticWhiteDefault,
muted: staticWhiteDefault,
subtle: staticWhiteDefault,
onPrimary: {
normal: foregroundOnBrand,
disabled: foregroundOnBrand,
muted: foregroundOnBrand,
subtle: foregroundOnBrand,
},
},
},
Expand All @@ -185,15 +185,15 @@ const getOnDarkOverrides = (
): DeepPartial<ThemeTokens['colors']['onDark']> => {
// Select the most readable color to use as the foreground color on top of surface color
// For example: On Secondary Button where the background color is surface color, the text color should be either the brand color or dark color depending on which is more readable on top of that surface color
const foregroundOnSurfaceDark = tinycolor.isReadable(
const foregroundOnSurface = tinycolor.isReadable(
globalColors.neutral.blueGrayDark[1100],
brandColors[400],
WCAG2ContrastOptions,
)
? brandColors[400]
: globalColors.neutral.blueGrayDark[0];

const staticWhiteDefault = tinycolor
const foregroundOnBrand = tinycolor
.mostReadable(
brandColors[900],
[globalColors.neutral.white[500], globalColors.neutral.black[500]],
Expand Down Expand Up @@ -223,30 +223,30 @@ const getOnDarkOverrides = (
},
text: {
primary: {
normal: foregroundOnSurfaceDark,
disabled: foregroundOnSurfaceDark,
muted: foregroundOnSurfaceDark,
subtle: foregroundOnSurfaceDark,
normal: foregroundOnSurface,
disabled: foregroundOnSurface,
muted: foregroundOnSurface,
subtle: foregroundOnSurface,
},
staticWhite: {
normal: staticWhiteDefault,
disabled: staticWhiteDefault,
muted: staticWhiteDefault,
subtle: staticWhiteDefault,
onPrimary: {
normal: foregroundOnBrand,
disabled: foregroundOnBrand,
muted: foregroundOnBrand,
subtle: foregroundOnBrand,
},
},
icon: {
primary: {
normal: foregroundOnSurfaceDark,
disabled: foregroundOnSurfaceDark,
muted: foregroundOnSurfaceDark,
subtle: foregroundOnSurfaceDark,
normal: foregroundOnSurface,
disabled: foregroundOnSurface,
muted: foregroundOnSurface,
subtle: foregroundOnSurface,
},
staticWhite: {
normal: staticWhiteDefault,
disabled: staticWhiteDefault,
muted: staticWhiteDefault,
subtle: staticWhiteDefault,
onPrimary: {
normal: foregroundOnBrand,
disabled: foregroundOnBrand,
muted: foregroundOnBrand,
subtle: foregroundOnBrand,
},
},
},
Expand Down

0 comments on commit a692797

Please sign in to comment.