Skip to content

Commit

Permalink
Components: Deprecate COLORS.white
Browse files Browse the repository at this point in the history
  • Loading branch information
mirka committed Dec 5, 2024
1 parent 1418350 commit 2638c65
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/menu/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ const baseItem = css`
[aria-disabled='true']
) {
background-color: ${ COLORS.theme.accent };
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };
}
/* Keyboard focus (focus-visible) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ export const ItemBaseUI = styled.li`
&.is-active {
background-color: ${ COLORS.theme.accent };
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };
> button,
> a {
color: ${ COLORS.white };
color: ${ COLORS.theme.accentInverted };
opacity: 1;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const buttonView = ( {
background: transparent;
border: none;
border-radius: ${ CONFIG.radiusXSmall };
color: ${ COLORS.gray[ 700 ] };
color: ${ COLORS.theme.gray[ 700 ] };
fill: currentColor;
cursor: pointer;
display: flex;
Expand Down Expand Up @@ -70,7 +70,7 @@ export const buttonView = ( {
}
&:active {
background: ${ CONFIG.controlBackgroundColor };
background: ${ COLORS.ui.background };
}
${ isDeselectable && deselectable }
Expand All @@ -79,19 +79,19 @@ export const buttonView = ( {
`;

const pressed = css`
color: ${ COLORS.white };
color: ${ COLORS.theme.foregroundInverted };
&:active {
background: transparent;
}
`;

const deselectable = css`
color: ${ COLORS.gray[ 900 ] };
color: ${ COLORS.theme.foreground };
&:focus {
box-shadow:
inset 0 0 0 1px ${ COLORS.white },
inset 0 0 0 1px ${ COLORS.ui.background },
0 0 0 ${ CONFIG.borderWidthFocus } ${ COLORS.theme.accent };
outline: 2px solid transparent;
}
Expand All @@ -112,7 +112,7 @@ const isIconStyles = ( {
};

return css`
color: ${ COLORS.gray[ 900 ] };
color: ${ COLORS.theme.foreground };
height: ${ iconButtonSizes[ size ] };
aspect-ratio: 1;
padding-left: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const toggleGroupControl = ( {
content: '';
position: absolute;
pointer-events: none;
background: ${ COLORS.gray[ 900 ] };
background: ${ COLORS.theme.foreground };
// Windows High Contrast mode will show this outline, but not the box-shadow.
outline: 2px solid transparent;
Expand Down
3 changes: 3 additions & 0 deletions packages/components/src/utils/colors-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ export const COLORS = Object.freeze( {
* @deprecated Use semantic aliases in `COLORS.ui` or theme-ready variables in `COLORS.theme.gray`.
*/
gray: GRAY, // TODO: Stop exporting this when everything is migrated to `theme` or `ui`
/**
* @deprecated Prefer theme-ready variables in `COLORS.theme`.
*/
white,
alert: ALERT,
/**
Expand Down
1 change: 0 additions & 1 deletion packages/components/src/utils/config-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const CONTROL_PROPS = {
controlPaddingXSmall: 8,
controlPaddingXLarge: 12 * 1.3334, // TODO: Deprecate

controlBackgroundColor: COLORS.white,
controlBoxShadowFocus: `0 0 0 0.5px ${ COLORS.theme.accent }`,
controlHeight: CONTROL_HEIGHT,
controlHeightXSmall: `calc( ${ CONTROL_HEIGHT } * 0.6 )`,
Expand Down

0 comments on commit 2638c65

Please sign in to comment.