Minor Changes
-
b1c31fd: - Introduces deep nested
colorPalettes
for enhanced color management- Previous color palette structure was flat and less flexible, now
colorPalettes
can be organized hierarchically for
improved organization
Example: Define colors within categories, variants and states
const theme = { extend: { semanticTokens: { colors: { button: { dark: { value: 'navy', }, light: { DEFAULT: { value: 'skyblue', }, accent: { DEFAULT: { value: 'cyan', }, secondary: { value: 'blue', }, }, }, }, }, }, }, }
You can now use the root
button
color palette and its values directly:import { css } from '../styled-system/css' export const App = () => { return ( <button className={css({ colorPalette: 'button', color: 'colorPalette.light', backgroundColor: 'colorPalette.dark', _hover: { color: 'colorPalette.light.accent', background: 'colorPalette.light.accent.secondary', }, })} > Root color palette </button> ) }
Or you can use any deeply nested property (e.g.
button.light.accent
) as a root color palette:import { css } from '../styled-system/css' export const App = () => { return ( <button className={css({ colorPalette: 'button.light.accent', color: 'colorPalette.secondary', })} > Nested color palette leaf </button> ) }
- Previous color palette structure was flat and less flexible, now