Color fundamentals
Color is used distinguish our brand, convey meaning, and invoke emotions. A color palette ensures a familiar and consistent experience across our products.
Palette
Section titled PaletteNeutral colors
Section titled Neutral colorsThe neutral palette consists of black, white, and grays. The neutral palette is dominant in our UI, using subtle shifts in value to create hierarchy and organize content.
Saturated colors
Section titled Saturated colorsStacks uses 5 colors with 6 stops per color. Colors are used sparingly and intentionally to convey meaning, draw attention to UI, or create associations.
Award colors
Section titled Award colorsStacks has 3 award colors with 4 stops per color. Colors are used to represent gold, silver, and bronze within gamification aspects of our products.
Usage
Section titled UsageColor roles
Section titled Color rolesColor roles describe the intention behind the color.
Role | Description | |
---|---|---|
Neutral | Use for text and secondary UI elements, such as buttons | |
Primary | Use for primary actions | |
Accent | Use for UI that either relates to the brand or doesn’t have a specific meaning tied to it. | |
Information | Use for UI to communicate information that you’d like the user to be aware of | |
Success | Use for UI to communicate a successful action has taken place | |
Warning | Use for UI that communicates a user should proceed with caution | |
Danger | Use for UI that communicates the user has encountered danger or an error | |
Discovery | Use for UI that depicts something new, such as onboarding or a new feature |
Backgrounds
Section titled BackgroundsStops 50 through 200 are used for background layers
Borders
Section titled BordersStops 200 and 225 are used for decorative borders and dividers throughout our UI. The 250 stop is used for input borders such as text field or secondary button.
Stops 500 and 600 can be used for text. Neutrals, blue, red, and green can also be used at 400 and will meet APCA contrast minimums within these shades. Orange and yellow should not be used at 400 because it does not meet our contrast standards.
Icons and illustrations
Section titled Icons and illustrationsStops 400 and 500 are for icons, while 350 should be used for more detailed illustrations.
Layering
Section titled LayeringColors in the neutral palette are layered on top of each other to foster a sense of hierarchy and create associations.
Background layer | Light mode | Dark mode |
---|---|---|
Body background |
|
|
Content |
|
|
Component |
|
|
Component alt |
|
|
Emphasis levels
Section titled Emphasis levelsEmphasis determines the amount of contrast a color has against the default surface. Emphasis has a range from subtle to bold. Bold emphasis has more contrast against the background, which adds more attention than using UI with the subtle or default emphasis level.
Interaction states
Section titled Interaction statesIn Stacks, a component will get darker (or lighter in dark mode) as they interact with it. These progresses happen by adding 100 to the color before the interaction happens. Example: Blue-400 on hover becomes Blue-500. For a disabled button state, subtract 100 from the default color.
Light, dark, and high contrast modes
Section titled Light, dark, and high contrast modesStacks supports light, dark, and high contrast modes. By using Stacks, you will get each of these modes for free. By using a Stacks component, an atomic color class, or CSS variable directly, your theme will switch appropriately based on the following methods:
- You can apply
.theme-system
to thebody
element. This will change colors based on theprefers-color-scheme
media query, which is ultimately powered by the user’s system or browser settings. This can be preferable for folks who have their system turn to dark mode based on ambient light or time of day. - Alternatively, you can set a dark mode that is not system dependent by attaching
.theme-dark
to thebody
element. - Adding
.theme-highcontrast
to thebody
element will boost colors to WCAG Level AAA contrast ratios in as many places as possible. This mode stacks on top of both light and dark modes. The only exception is branded themed colors remain untouched by high contrast mode.
There are also conditional classes that can be applied to override assumed dark mode colors, force light mode, or to force dark mode. Forcing modes can be good for previews in admin-only situations.