feat(tokens): add gray and text colors#30799
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| // TODO: ADD TYPE | ||
| export const darkPrimitiveColors = { | ||
| // TODO: Update hex values to use the text color variable and background color variable | ||
| gray: generateColorSteps('#ffffff', '#000', true), |
There was a problem hiding this comment.
I decided to use white and black for the base because base should be as simple as possible.
| // TODO: ADD TYPE | ||
| export const defaultPrimitiveColors = { | ||
| // TODO: Update hex values to use the text color variable and background color variable | ||
| gray: generateColorSteps('#fff', '#000'), |
There was a problem hiding this comment.
I decided to use white and black for the base because base should be as simple as possible.
| font-size: 12px; | ||
| font-weight: normal; | ||
|
|
||
| color: var(--ion-color-step-600); |
There was a problem hiding this comment.
This wasn't being used.
| font-size: 12px; | ||
| font-weight: normal; | ||
|
|
||
| color: var(--ion-color-step-600); |
There was a problem hiding this comment.
It's not being used.
|
|
||
| /// @prop - Color of the breadcrumb | ||
| $breadcrumb-ios-color: var(--ion-color-step-850, var(--ion-text-color-step-150, #2d4665)); | ||
| $breadcrumb-ios-color: var(--ion-components-ion-breadcrumb-color); |
There was a problem hiding this comment.
Any variable that uses --ion-components-ion-COMPONENT-NAME-* will be updated to be --ion-COMPONENT-NAME- once the chip PR is merged due to the code changes done there to shorten the names.
| font-size: 12px; | ||
| font-weight: normal; | ||
|
|
||
| color: var(--ion-color-step-600); |
There was a problem hiding this comment.
It's not being used.
| font-size: 12px; | ||
| font-weight: normal; | ||
|
|
||
| color: var(--ion-color-step-600); |
There was a problem hiding this comment.
It's not being used.
| // Exclude palette from the default tokens | ||
| // eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
| const { palette, components, ...defaultTokens } = theme; | ||
| const { palette, ...defaultTokens } = theme; |
There was a problem hiding this comment.
This change will be undone through chip. Once chip is merged in, I'll come back and update this.
|
Can we convert this back to a draft until it's ready for review? |
Issue number: internal
What is the current behavior?
Themes are still using the stepped color variables.
What is the new behavior?
The CSS variable
--ion-background-color-step-{number}is no longer recommended for use and has been replaced by a more intuitive and standardized naming convention as part of Ionic's new theming structure. The functionality provided by the old variable has been replaced with a new set of CSS variables that use the same color values but are named:--ion-color-gray-{number}.This new structure aligns with how other popular design systems and frameworks are setting up their color palettes (e.g., using names like
gray,red,blue, followed by a number to denote the shade). Additionally, it follows the proposal agreed upon within the design doc.The CSS variable
--ion-text-color-step-*is being replaced by--ion-color-text-*to adhere to the standardized naming convention for Ionic's new theming structure (--ion-color-*-*). This change aims for greater clarity and consistency within the framework's color palette.The original thought was to use only the
--ion-color-gray-*variables for all purposes (backgrounds, text, icons, etc.). However, it was quickly determined that text color requirements are not a 1:1 match with the gray steps designed for backgrounds and other elements. Text often requires a different shade to maintain proper contrast and readability across various theme palettes (especially between high contrast and high contrast dark modes). Introducing the dedicated functional variable--ion-color-text-*solves this issue by allowing text color to be defined independently based on the current palette's needs.Does this introduce a breaking change?
You simply need to swap the text of the background stepped variables with the gray variables. The number suffix remains exactly the same:
--ion-background-color-step-50--ion-color-gray-50--ion-background-color-step-900--ion-background-color-step-900Unlike the migration for background colors, the number suffix for text colors is not a direct swap. Due to the inverse nature required for contrast, the new text variable number is calculated by subtracting the old number from 1000.
--ion-text-color-step-501000−50--ion-color-text-950--ion-text-color-step-9001000-900--ion-color-text-100Other information
Gray: preview
Action sheet: basic
Alert: basic
Breadcrumbs: basic
Breadcrumbs: collapsed
Card: basic
Checkbox: bottom content
Datetime button: basic
Datetime: basic
Datetime: color
Infinite scroll: basic
Input: fill
Input: basic
Input OTP: basic
Item: dividers
Item: basic
Label: basic
List header: basic
Loading: basic
Modal: sheet
Note: basic
Picker: basic
Popover: basic
Progress bar: basic
Radio group: supporting text
Range: basic
Refresher: basic
Searchbar: basic
Segment: basic
Select: fill
Select: basic
Select: bottom content
Textarea: fill
Textarea: basic
Textarea: bottom content
Toast: basic
Toggle: bottom content