Color

Variables for changing an elements color

Import

Import just the all of the color variables or just the ones you want. Note if you want to make use of data-accent-color you will need to make sure you import the accent css.

/* all colors */
@import "@winnie-ui/base/colors";
/* each color individually */
@import "@winnie-ui/base/colors/red";
@import "@winnie-ui/base/colors/orange";
@import "@winnie-ui/base/colors/yellow";
@import "@winnie-ui/base/colors/green";
@import "@winnie-ui/base/colors/blue";
@import "@winnie-ui/base/colors/purple";
@import "@winnie-ui/base/colors/pink";
@import "@winnie-ui/base/colors/grey";
@import "@winnie-ui/base/colors/black";
@import "@winnie-ui/base/colors/white";
/* accent color */
@import "@winnie-ui/base/colors/accent";

Scales

Winnie CSS includes a default set of colors that is a great place to start when building your next application. These colors are loosely based on the colors provided by Tailwind and were created using the Radix Colors custom palette generator.

Grey

 
123456789101112
grey
grey Alpha
grey Dark
grey Alpha Dark

Brand

 
123456789101112
brand
brand Alpha
brand Dark
brand Alpha Dark

Red

 
123456789101112
red
red Alpha
red Dark
red Alpha Dark

Orange

 
123456789101112
orange
orange Alpha
orange Dark
orange Alpha Dark

Yellow

 
123456789101112
yellow
yellow Alpha
yellow Dark
yellow Alpha Dark

Green

 
123456789101112
green
green Alpha
green Dark
green Alpha Dark

Blue

 
123456789101112
blue
blue Alpha
blue Dark
blue Alpha Dark

Purple

 
123456789101112
purple
purple Alpha
purple Dark
purple Alpha Dark

Pink

 
123456789101112
pink
pink Alpha
pink Dark
pink Alpha Dark

Mono

 
123456789101112
black Alpha
white Alpha Dark

Working with Color Scales

Winnie CSS makes working with colors predictable using the Radix Color System. There are 12 colors in each scale, each color has a specific purpose. However, there will be cases where these colors need to be adjusted to get things just right. There is no silver bullet when it comes to swapping hues for dark mode, so be sure to take extra care when designing for dark mode.

StepUse Case
1App background
2Subtle background
3UI element background
4Hovered UI element background
5Active / Selected UI element background
6Subtle borders and separators
7UI element border and focus rings
8Hovered UI element border
9Solid background for things like buttons
10Hovered solid background
11Low-contast text
12High-contast text
contrastStep 9 and 10 contrast color for text

Customizing Colors

When the default palette doesn’t suit your needs you can customize any of the colors by overriding the CSS Variables.

Luckily, the community has started to create some amazing tools for generating color palettes. Our color palette is based on the one defined by Radix Color Palette Generator. We suggest you start there when it comes to configuring your brand color.

Each color can be overridden using css variables defined in a global css file in your application. For example, if you want to define a custom brand color for your application you can do the following:

global.css
:root,
.light,
.light-theme,
[data-theme="light"] {
--wui-color-brand-1: #fcfdff;
--wui-color-brand-2: #f5f9ff;
--wui-color-brand-3: #eaf2ff;
--wui-color-brand-4: #dcebff;
--wui-color-brand-5: #cbe1ff;
--wui-color-brand-6: #b8d4ff;
--wui-color-brand-7: #9fc2fb;
--wui-color-brand-8: #7baaf6;
--wui-color-brand-9: #3b82f6;
--wui-color-brand-10: #2c74e9;
--wui-color-brand-11: #256cde;
--wui-color-brand-12: #123164;
--wui-color-brand-a1: #0055ff03;
--wui-color-brand-a2: #0066ff0a;
--wui-color-brand-a3: #0062ff15;
--wui-color-brand-a4: #006eff23;
--wui-color-brand-a5: #006cff34;
--wui-color-brand-a6: #0065ff47;
--wui-color-brand-a7: #005df560;
--wui-color-brand-a8: #005bee84;
--wui-color-brand-a9: #005df3c4;
--wui-color-brand-a10: #0057e5d3;
--wui-color-brand-a11: #0053d8da;
--wui-color-brand-a12: #002158ed;
--wui-color-brand-contrast: #fff;
}
.dark,
.dark-theme,
[data-theme="dark"] {
--wui-color-brand-1: #fcfdff;
--wui-color-brand-2: #f5f9ff;
--wui-color-brand-3: #eaf2ff;
--wui-color-brand-4: #dcebff;
--wui-color-brand-5: #cbe1ff;
--wui-color-brand-6: #b8d4ff;
--wui-color-brand-7: #9fc2fb;
--wui-color-brand-8: #7baaf6;
--wui-color-brand-9: #3b82f6;
--wui-color-brand-10: #2c74e9;
--wui-color-brand-11: #256cde;
--wui-color-brand-12: #123164;
--wui-color-brand-a1: #0055ff03;
--wui-color-brand-a2: #0066ff0a;
--wui-color-brand-a3: #0062ff15;
--wui-color-brand-a4: #006eff23;
--wui-color-brand-a5: #006cff34;
--wui-color-brand-a6: #0065ff47;
--wui-color-brand-a7: #005df560;
--wui-color-brand-a8: #005bee84;
--wui-color-brand-a9: #005df3c4;
--wui-color-brand-a10: #0057e5d3;
--wui-color-brand-a11: #0053d8da;
--wui-color-brand-a12: #002158ed;
--wui-color-brand-contrast: #fff;
}

Once you have configured your custom brand color you can set data-accent-color to brand and all of your components will use that color as the accent. Keep in mind that brand is a special accent color that has been defined by Winnie CSS. You cannot choose an arbitrary color name and use it as an accent color. Only the colors provided by Winnie CSS can be customized.

Dark Mode

Winnie CSS supports dark mode with no compromises. It even allows you to scope dark mode colors to specific components or sections of your applications.

Usage

Dark mode can be configured via class name or data attribute. For class names you can use dark or dark-theme and for data attributes you can use [data-theme="dark"]

root.tsx
export default function Root() {
return (
<html>
<head></head>
<body class="winnie-ui" data-theme="dark" data-accent-color="purple">
<App />
</body>
</html>
);
}

Example

Dark mode can be also be scoped to specific components. This means you are not restricted to the application level. This is useful for items that you want to be higher contrast.

Reference

Below is a list of the available color variables in Winnie CSS.

VariableTailwind Class
--wui-color-grey-1<color prefix>-grey-1
--wui-color-grey-2<color prefix>-grey-2
--wui-color-grey-3<color prefix>-grey-3
--wui-color-grey-4<color prefix>-grey-4
--wui-color-grey-5<color prefix>-grey-5
--wui-color-grey-6<color prefix>-grey-6
--wui-color-grey-7<color prefix>-grey-7
--wui-color-grey-8<color prefix>-grey-8
--wui-color-grey-9<color prefix>-grey-9
--wui-color-grey-10<color prefix>-grey-10
--wui-color-grey-11<color prefix>-grey-11
--wui-color-grey-12<color prefix>-grey-12
--wui-color-grey-a1<color prefix>-grey-a1
--wui-color-grey-a2<color prefix>-grey-a2
--wui-color-grey-a3<color prefix>-grey-a3
--wui-color-grey-a4<color prefix>-grey-a4
--wui-color-grey-a5<color prefix>-grey-a5
--wui-color-grey-a6<color prefix>-grey-a6
--wui-color-grey-a7<color prefix>-grey-a7
--wui-color-grey-a8<color prefix>-grey-a8
--wui-color-grey-a9<color prefix>-grey-a9
--wui-color-grey-a10<color prefix>-grey-a10
--wui-color-grey-a11<color prefix>-grey-a11
--wui-color-grey-a12<color prefix>-grey-a12
--wui-color-grey-contrast<color prefix>-grey-contrast
--wui-color-brand-1<color prefix>-brand-1
--wui-color-brand-2<color prefix>-brand-2
--wui-color-brand-3<color prefix>-brand-3
--wui-color-brand-4<color prefix>-brand-4
--wui-color-brand-5<color prefix>-brand-5
--wui-color-brand-6<color prefix>-brand-6
--wui-color-brand-7<color prefix>-brand-7
--wui-color-brand-8<color prefix>-brand-8
--wui-color-brand-9<color prefix>-brand-9
--wui-color-brand-10<color prefix>-brand-10
--wui-color-brand-11<color prefix>-brand-11
--wui-color-brand-12<color prefix>-brand-12
--wui-color-brand-a1<color prefix>-brand-a1
--wui-color-brand-a2<color prefix>-brand-a2
--wui-color-brand-a3<color prefix>-brand-a3
--wui-color-brand-a4<color prefix>-brand-a4
--wui-color-brand-a5<color prefix>-brand-a5
--wui-color-brand-a6<color prefix>-brand-a6
--wui-color-brand-a7<color prefix>-brand-a7
--wui-color-brand-a8<color prefix>-brand-a8
--wui-color-brand-a9<color prefix>-brand-a9
--wui-color-brand-a10<color prefix>-brand-a10
--wui-color-brand-a11<color prefix>-brand-a11
--wui-color-brand-a12<color prefix>-brand-a12
--wui-color-brand-contrast<color prefix>-brand-contrast
--wui-color-red-1<color prefix>-red-1
--wui-color-red-2<color prefix>-red-2
--wui-color-red-3<color prefix>-red-3
--wui-color-red-4<color prefix>-red-4
--wui-color-red-5<color prefix>-red-5
--wui-color-red-6<color prefix>-red-6
--wui-color-red-7<color prefix>-red-7
--wui-color-red-8<color prefix>-red-8
--wui-color-red-9<color prefix>-red-9
--wui-color-red-10<color prefix>-red-10
--wui-color-red-11<color prefix>-red-11
--wui-color-red-12<color prefix>-red-12
--wui-color-red-a1<color prefix>-red-a1
--wui-color-red-a2<color prefix>-red-a2
--wui-color-red-a3<color prefix>-red-a3
--wui-color-red-a4<color prefix>-red-a4
--wui-color-red-a5<color prefix>-red-a5
--wui-color-red-a6<color prefix>-red-a6
--wui-color-red-a7<color prefix>-red-a7
--wui-color-red-a8<color prefix>-red-a8
--wui-color-red-a9<color prefix>-red-a9
--wui-color-red-a10<color prefix>-red-a10
--wui-color-red-a11<color prefix>-red-a11
--wui-color-red-a12<color prefix>-red-a12
--wui-color-red-contast<color prefix>-red-contrast
--wui-color-orange-1<color prefix>-orange-1
--wui-color-orange-2<color prefix>-orange-2
--wui-color-orange-3<color prefix>-orange-3
--wui-color-orange-4<color prefix>-orange-4
--wui-color-orange-5<color prefix>-orange-5
--wui-color-orange-6<color prefix>-orange-6
--wui-color-orange-7<color prefix>-orange-7
--wui-color-orange-8<color prefix>-orange-8
--wui-color-orange-9<color prefix>-orange-9
--wui-color-orange-10<color prefix>-orange-10
--wui-color-orange-11<color prefix>-orange-11
--wui-color-orange-12<color prefix>-orange-12
--wui-color-orange-a1<color prefix>-orange-a1
--wui-color-orange-a2<color prefix>-orange-a2
--wui-color-orange-a3<color prefix>-orange-a3
--wui-color-orange-a4<color prefix>-orange-a4
--wui-color-orange-a5<color prefix>-orange-a5
--wui-color-orange-a6<color prefix>-orange-a6
--wui-color-orange-a7<color prefix>-orange-a7
--wui-color-orange-a8<color prefix>-orange-a8
--wui-color-orange-a9<color prefix>-orange-a9
--wui-color-orange-a10<color prefix>-orange-a10
--wui-color-orange-a11<color prefix>-orange-a11
--wui-color-orange-a12<color prefix>-orange-a12
--wui-color-orange-contast<color prefix>-orange-contrast
--wui-color-yellow-1<color prefix>-yellow-1
--wui-color-yellow-2<color prefix>-yellow-2
--wui-color-yellow-3<color prefix>-yellow-3
--wui-color-yellow-4<color prefix>-yellow-4
--wui-color-yellow-5<color prefix>-yellow-5
--wui-color-yellow-6<color prefix>-yellow-6
--wui-color-yellow-7<color prefix>-yellow-7
--wui-color-yellow-8<color prefix>-yellow-8
--wui-color-yellow-9<color prefix>-yellow-9
--wui-color-yellow-10<color prefix>-yellow-10
--wui-color-yellow-11<color prefix>-yellow-11
--wui-color-yellow-12<color prefix>-yellow-12
--wui-color-yellow-a1<color prefix>-yellow-a1
--wui-color-yellow-a2<color prefix>-yellow-a2
--wui-color-yellow-a3<color prefix>-yellow-a3
--wui-color-yellow-a4<color prefix>-yellow-a4
--wui-color-yellow-a5<color prefix>-yellow-a5
--wui-color-yellow-a6<color prefix>-yellow-a6
--wui-color-yellow-a7<color prefix>-yellow-a7
--wui-color-yellow-a8<color prefix>-yellow-a8
--wui-color-yellow-a9<color prefix>-yellow-a9
--wui-color-yellow-a10<color prefix>-yellow-a10
--wui-color-yellow-a11<color prefix>-yellow-a11
--wui-color-yellow-a12<color prefix>-yellow-a12
--wui-color-yellow-contrast<color prefix>-yellow-contrast
--wui-color-green-1<color prefix>-green-1
--wui-color-green-2<color prefix>-green-2
--wui-color-green-3<color prefix>-green-3
--wui-color-green-4<color prefix>-green-4
--wui-color-green-5<color prefix>-green-5
--wui-color-green-6<color prefix>-green-6
--wui-color-green-7<color prefix>-green-7
--wui-color-green-8<color prefix>-green-8
--wui-color-green-9<color prefix>-green-9
--wui-color-green-10<color prefix>-green-10
--wui-color-green-11<color prefix>-green-11
--wui-color-green-12<color prefix>-green-12
--wui-color-green-a1<color prefix>-green-a1
--wui-color-green-a2<color prefix>-green-a2
--wui-color-green-a3<color prefix>-green-a3
--wui-color-green-a4<color prefix>-green-a4
--wui-color-green-a5<color prefix>-green-a5
--wui-color-green-a6<color prefix>-green-a6
--wui-color-green-a7<color prefix>-green-a7
--wui-color-green-a8<color prefix>-green-a8
--wui-color-green-a9<color prefix>-green-a9
--wui-color-green-a10<color prefix>-green-a10
--wui-color-green-a11<color prefix>-green-a11
--wui-color-green-a12<color prefix>-green-a12
--wui-color-green-contrast<color prefix>-green-contrast
--wui-color-blue-1<color prefix>-blue-1
--wui-color-blue-2<color prefix>-blue-2
--wui-color-blue-3<color prefix>-blue-3
--wui-color-blue-4<color prefix>-blue-4
--wui-color-blue-5<color prefix>-blue-5
--wui-color-blue-6<color prefix>-blue-6
--wui-color-blue-7<color prefix>-blue-7
--wui-color-blue-8<color prefix>-blue-8
--wui-color-blue-9<color prefix>-blue-9
--wui-color-blue-10<color prefix>-blue-10
--wui-color-blue-11<color prefix>-blue-11
--wui-color-blue-12<color prefix>-blue-12
--wui-color-blue-a1<color prefix>-blue-a1
--wui-color-blue-a2<color prefix>-blue-a2
--wui-color-blue-a3<color prefix>-blue-a3
--wui-color-blue-a4<color prefix>-blue-a4
--wui-color-blue-a5<color prefix>-blue-a5
--wui-color-blue-a6<color prefix>-blue-a6
--wui-color-blue-a7<color prefix>-blue-a7
--wui-color-blue-a8<color prefix>-blue-a8
--wui-color-blue-a9<color prefix>-blue-a9
--wui-color-blue-a10<color prefix>-blue-a10
--wui-color-blue-a11<color prefix>-blue-a11
--wui-color-blue-a12<color prefix>-blue-a12
--wui-color-blue-contrast<color prefix>-blue-contrast
--wui-color-purple-1<color prefix>-purple-1
--wui-color-purple-2<color prefix>-purple-2
--wui-color-purple-3<color prefix>-purple-3
--wui-color-purple-4<color prefix>-purple-4
--wui-color-purple-5<color prefix>-purple-5
--wui-color-purple-6<color prefix>-purple-6
--wui-color-purple-7<color prefix>-purple-7
--wui-color-purple-8<color prefix>-purple-8
--wui-color-purple-9<color prefix>-purple-9
--wui-color-purple-10<color prefix>-purple-10
--wui-color-purple-11<color prefix>-purple-11
--wui-color-purple-12<color prefix>-purple-12
--wui-color-purple-a1<color prefix>-purple-a1
--wui-color-purple-a2<color prefix>-purple-a2
--wui-color-purple-a3<color prefix>-purple-a3
--wui-color-purple-a4<color prefix>-purple-a4
--wui-color-purple-a5<color prefix>-purple-a5
--wui-color-purple-a6<color prefix>-purple-a6
--wui-color-purple-a7<color prefix>-purple-a7
--wui-color-purple-a8<color prefix>-purple-a8
--wui-color-purple-a9<color prefix>-purple-a9
--wui-color-purple-a10<color prefix>-purple-a10
--wui-color-purple-a11<color prefix>-purple-a11
--wui-color-purple-a12<color prefix>-purple-a12
--wui-color-purple-contrast<color prefix>-purple-contrast
--wui-color-pink-1<color prefix>-pink-1
--wui-color-pink-2<color prefix>-pink-2
--wui-color-pink-3<color prefix>-pink-3
--wui-color-pink-4<color prefix>-pink-4
--wui-color-pink-5<color prefix>-pink-5
--wui-color-pink-6<color prefix>-pink-6
--wui-color-pink-7<color prefix>-pink-7
--wui-color-pink-8<color prefix>-pink-8
--wui-color-pink-9<color prefix>-pink-9
--wui-color-pink-10<color prefix>-pink-10
--wui-color-pink-11<color prefix>-pink-11
--wui-color-pink-12<color prefix>-pink-12
--wui-color-pink-a1<color prefix>-pink-a1
--wui-color-pink-a2<color prefix>-pink-a2
--wui-color-pink-a3<color prefix>-pink-a3
--wui-color-pink-a4<color prefix>-pink-a4
--wui-color-pink-a5<color prefix>-pink-a5
--wui-color-pink-a6<color prefix>-pink-a6
--wui-color-pink-a7<color prefix>-pink-a7
--wui-color-pink-a8<color prefix>-pink-a8
--wui-color-pink-a9<color prefix>-pink-a9
--wui-color-pink-a10<color prefix>-pink-a10
--wui-color-pink-a11<color prefix>-pink-a11
--wui-color-pink-a12<color prefix>-pink-a12
--wui-color-pink-contrast<color prefix>-pink-contrast
--wui-color-black-a1<color prefix>-black-a1
--wui-color-black-a2<color prefix>-black-a2
--wui-color-black-a3<color prefix>-black-a3
--wui-color-black-a4<color prefix>-black-a4
--wui-color-black-a5<color prefix>-black-a5
--wui-color-black-a6<color prefix>-black-a6
--wui-color-black-a7<color prefix>-black-a7
--wui-color-black-a8<color prefix>-black-a8
--wui-color-black-a9<color prefix>-black-a9
--wui-color-black-a10<color prefix>-black-a10
--wui-color-black-a11<color prefix>-black-a11
--wui-color-black-a12<color prefix>-black-a12
--wui-color-white-a1<color prefix>-white-a1
--wui-color-white-a2<color prefix>-white-a2
--wui-color-white-a3<color prefix>-white-a3
--wui-color-white-a4<color prefix>-white-a4
--wui-color-white-a5<color prefix>-white-a5
--wui-color-white-a6<color prefix>-white-a6
--wui-color-white-a7<color prefix>-white-a7
--wui-color-white-a8<color prefix>-white-a8
--wui-color-white-a9<color prefix>-white-a9
--wui-color-white-a10<color prefix>-white-a10
--wui-color-white-a11<color prefix>-white-a11
--wui-color-white-a12<color prefix>-white-a12