Colors
Thanks to Stitches, using a theme color is as easy as passing that as a string to a color prop. Whether that's color
, background-color
, border-color
etc... you can pass the name of each color (listed below) and it will replace that with a css variable for you.
import { Text } from '@streamelements/frontend-ui';
<Text.Body css={{ color: '$brandPrimaryMain' }}>
I'm using the brand primary main color
</Text.Body>;
when used will render as
I'm using the brand primary main color
Available colors
Brand colors
$brandPrimaryMain
$brandPrimary75
$brandPrimary50
$brandPrimary25
Text colors
$textPrimaryMain
$textPrimary70
$textPrimary50
$textPrimary30
$textLink
$textSuccess
$textError
$textAttention
Ui colors
$uiPrimaryMain
$uiPrimary75
$uiPrimary50
$uiPrimary25
$uiSecondary
$uiTertiary
$uiQuaternary
$uiSuccessMain
$uiSuccess75
$uiSuccess50
$uiSuccess25
$uiErrorMain
$uiError75
$uiError50
$uiError25
$uiAttentionMain
$uiAttention75
$uiAttention50
$uiAttention25
$uiDisabledMain
$uiDisabled75
$uiDisabled50
$uiDisabled25
Dark mode
Brand colors
$brandPrimaryMain
$brandPrimary75
$brandPrimary50
$brandPrimary25
Text colors
$textPrimaryMain
$textPrimary70
$textPrimary50
$textPrimary30
$textLink
$textSuccess
$textError
$textAttention
Ui colors
$uiPrimaryMain
$uiPrimary75
$uiPrimary50
$uiPrimary25
$uiSecondary
$uiTertiary
$uiQuaternary
$uiSuccessMain
$uiSuccess75
$uiSuccess50
$uiSuccess25
$uiErrorMain
$uiError75
$uiError50
$uiError25
$uiAttentionMain
$uiAttention75
$uiAttention50
$uiAttention25
$uiDisabledMain
$uiDisabled75
$uiDisabled50
$uiDisabled25
"Always" text colors
In addition to the colors above, "always" colors are also available:
- textAlwaysDark [Main | 75 | 50 | 30]
- textAlwaysLight [Main | 75 | 50 | 30]
Example
Always dark text
import { Text } from '@streamelements/frontend-ui';
...
<Text.Body css={{ color: '$textAlwaysDarkMain' }}>
Always dark text
</Text.Body>
Always light text
import { Text } from '@streamelements/frontend-ui';
...
<Text.Body css={{ color: '$textAlwaysLightMain' }}>
Always light text
</Text.Body>