Color Palettes
On this page
Red Hat Design System comes with a contextual color-theming feature called "Color palettes", designed to make page developers' and content authors' jobs easier and to improve customers' digital experiences. Authors and developers who adopt the color palette system will produce accessible, branded experiences with less effort and greater cross-property consistency.
What are color palettes
RHDS defines six color palettes They range from lightest to darkest, and those are the two palettes you will use the most for the majority of your projects.
Create, manage, and dynamically scale automation across your entire enterprise.
More cloud choice. Less cloud management.
<div id="elements">
<rh-disclosure summary="Results from Customer Portal"></rh-disclosure>
<rh-accordion>
<rh-accordion-header>Results from Customer Portal</rh-accordion-header>
<rh-accordion-panel>
<p> <rh-tag color="green">Hey now!</rh-tag> They're all looking pretty good! </p>
</rh-accordion-panel>
</rh-accordion>
<rh-cta href="#" variant="primary">Get started</rh-cta>
<rh-audio-player layout="mini"></rh-audio-player>
<rh-pagination>
<ol>
<li><a href="#">1</a></li>
<li><a href="#2">2</a></li>
<li><a href="#3">3</a></li>
<li><a href="#4">4</a></li>
<li><a href="#5">5</a></li>
</ol>
</rh-pagination>
<rh-card>
<p>Create, manage, and dynamically scale automation across your entire enterprise.</p>
<rh-cta slot="footer" href="#">Get product details</rh-cta>
</rh-card>
<p>More cloud choice. Less cloud management.</p>
<rh-tabs box="box">
<rh-tab slot="tab">App development and delivery</rh-tab>
<rh-tab-panel>App development and delivery content</rh-tab-panel>
<rh-tab slot="tab">Modernize existing apps</rh-tab>
<rh-tab-panel>Modernize existing apps content</rh-tab-panel>
<rh-tab slot="tab">AI/ML</rh-tab>
<rh-tab-panel>AI/ML content</rh-tab-panel>
<rh-tab slot="tab">Edge computing</rh-tab>
<rh-tab-panel>Edge computing content</rh-tab-panel>
</rh-tabs>
</div>
Copy to Clipboard
Copied!
Toggle line wrap
#elements {
min-height: auto;
display: grid;
gap: var(--rh-space-2xl);
grid-template-areas:
'disclosure'
'cta'
'audio-player'
'card'
'pagination'
'p'
'tabs';
grid-template-columns: 1fr;
grid-template-rows: auto;
& rh-card { grid-area: card; }
& rh-cta { grid-area: cta; }
& rh-tabs { grid-area: tabs; }
& rh-disclosure,
& rh-accordion { grid-area: disclosure; }
& rh-pagination {
grid-area: pagination;
&::part(numeric) {
display: none;
}
}
& rh-audio-player {
grid-area: audio-player;
}
& p { margin: 0; }
& > p {
grid-area: p;
font-size: var(--rh-font-size-body-text-2xl);
font-weight: var(--rh-font-weight-heading-bold);
}
@container (min-width: 768px) {
margin: var(--rh-space-2xl);
grid-template:
'disclosure disclosure '
'cta audio-player'
'pagination card'
'p card'
'tabs tabs' / 1fr 1fr;
grid-template-rows: repeat(5, min-content);
grid-template-columns: 1fr 1fr;
& rh-audio-player {
max-width: 340px;
}
}
@container (min-width: 992px) {
margin: var(--rh-space-2xl);
grid-template:
'disclosure disclosure disclosure'
'cta audio-player card'
'pagination pagination card'
'p p card'
'tabs tabs tabs' / 1fr 1fr 2fr;
grid-template-columns: max-content max-content 3fr;
}
}
Copy to Clipboard
Copied!
Toggle line wrap
Copy to Clipboard
Copied!
Toggle line wrap
How color palettes work
RHDS' color palette system is an HTML and CSS system with some supporting JavaScript[1]. The color palette system has two main parts: providers and consumers. Providers actively define a color palette, while consumers passively accept their background color from the nearest provider ancestor.
Color palettes allow for the creation of different experiences using the same design system. When a color palette is changed, elements change including color, space, text, and more. Layouts, content, and imagery usually stay the same.
Choosing a color palette
How you choose a color palette is based on content, user experience, and accessibility needs.
Lightest color palette
The lightest color palette is the default and has lots of use cases.
Darkest color palette
The darkest color palette can be used for highlighting content with dark colors or if a brighter interface would otherwise disrupt the user experience. Most light elements and patterns have dark counterparts.
Brand red and accessibility
Do not apply the Red Hat red color to text in dark environments unless it meets WCAG 2.1 AA requirements.
Illustrations and imagery
Illustrations and imagery should align to the color palette. The light color palette should feature imagery with light colors and vice versa. Imagery with high contrast is only acceptable if it has a transparent background. If you cannot find color-palette-specific imagery, contact the Brand team. Developers have a number of art-direction techniques at their disposal for creating themeable, responsive graphics.
Backgrounds and theme tokens
Color palettes
Providers define the color palette for themselves and their child elements. There are six color palettes in RHDS:
Lightest Lighter Light Dark Darker Darkest
Context providers typically use the lightest
color palette as the default.
Authors may define the color palette of a container using the color-palette
HTML attribute. So for example, to create a card with the darkest color palette,
use this HTML:
This card uses the default
color palette.
This card uses the author-set
"darkest" color palette.
Copy to Clipboard
Copied!
Toggle line wrap
<rh-card>
<p>
This card uses the default
color palette.
</p>
</rh-card>
<rh-card color-palette="darkest">
<p>
This card uses the author-set
"darkest" color palette.
</p>
</rh-card>
Copy to Clipboard
Copied!
Toggle line wrap
Copy to Clipboard
Copied!
Toggle line wrap
A color palette provider is a surface on which a particular color palette is active, as well as a container for themeable consumer elements.
Backgrounds
Consumers are elements which automatically adapt to their background surface. Color Consumers adopt a background color based on the palette of the surface they are on. In other words, the background of a consumer corresponds to the color palette of it's containing surface. There are two backgrounds in RHDS:
These backgrounds don't represent a specific colour, but rather they indicate whether the background is light or dark. This is so things like icons, text, and border colours can be chosen which will contrast enough with the background to remain legible. In other words, the background is the color context in which a consumer finds itself.
Extending our card example from above, if our page author then adds an
<rh-cta>
to the card, it will automatically adopt the dark color theme. The
page author need not and should not customize the CTA.
The card and CTA respond to the theme of their container.
On a light container, the CTA uses the light theme, and dark on dark.
The card uses the "darkest" palette.
The CTA is always themed with the "dark" theme, because the card
sets its own palette, rather than responding to it's container's.
Copy to Clipboard
Copied!
Toggle line wrap
<rh-card>
<p>
The card <em>and</em> CTA respond to the theme of their container.
On a light container, the CTA uses the light theme, and dark on dark.
</p>
<rh-cta slot="footer">Fine!</rh-cta>
</rh-card>
<rh-card color-palette="darkest">
<p>
The card uses the "darkest" palette.
The CTA is always themed with the "dark" theme, because the card
sets its own palette, rather than responding to it's container's.
</p>
<rh-cta slot="footer">Nice!</rh-cta>
</rh-card>
Copy to Clipboard
Copied!
Toggle line wrap
Copy to Clipboard
Copied!
Toggle line wrap
To summarize: color providers can adopt one six palettes, three dark and
three light, and they provide a dark
or light
background to their children.
Combination elements
Some elements are both providers and consumers. Card, for example is both a provider and a consumer. It can accept the color theme of its parent context and it can also set its own color palette.
This card acts as a consumer.
It will always receive its parent's This card acts as a provider.
Try changing this card's
Consumer
ColorTheme
.Provider
color-palette
and see how it affects this card's children.
Copy to Clipboard
Copied!
Toggle line wrap
<rh-card>
<h2 slot="header">Consumer</h2>
<rh-tag slot="header" icon="info" color="purple">passive</rh-tag>
<p>This card acts as a consumer.
It will always receive its parent's <code>ColorTheme</code>.</p>
<rh-cta slot="footer" href="/elements/card/">Read card docs</rh-cta>
</rh-card>
<rh-card id="provider-card" color-palette="lightest">
<h2 slot="header">Provider</h2>
<rh-tag slot="header" icon="info" color="green">active</rh-tag>
<p>This card acts as a provider.
Try changing this card's
<code>color-palette</code>
and see how it affects this card's children.
</p>
<label for="provider-picker">
Set this card's color palette.
<rh-context-picker id="provider-picker" target="provider-card" allow="darkest, lighter, lightest" value="lightest"></rh-context-picker>
</label>
<rh-cta slot="footer" href="/elements/call-to-action/">Read CTA docs</rh-cta>
</rh-card>
Copy to Clipboard
Copied!
Toggle line wrap
Copy to Clipboard
Copied!
Toggle line wrap
Inline color palettes
>
Beta
Inlining a color palette is when a section switches palette and looks different
than the rest of the page or interface. Some use cases include highlighting an
important section on a page or adding a sidebar to an interface. Use inline
palettes only for major shifts in color. For minor shifts, use a related color
palette, e.g. from lightest
to light
.
Update from the team
The design system team is working on creating inline color palette best practices in the near future. Contact us if you would like to contribute.
More information
High contrast is using bright elements, patterns, or images in dark environments and vice versa. This is useful to focus attention or create visual tension.
Other libraries
To learn more about our other libraries, visit this page.
Feedback
To give feedback about anything on this page, contact us.
Other libraries
To learn more about our other libraries, visit the getting started page.