Skip to content

Commit 60a3cb8

Browse files
LilithJames-HDSjorytindallshleewhite
authored
Update Color page on Helios website (Foundations section) (#2870)
Co-authored-by: Jory Tindall <[email protected]> Co-authored-by: Lee White <[email protected]>
1 parent 40a1245 commit 60a3cb8

File tree

4 files changed

+44
-32
lines changed

4 files changed

+44
-32
lines changed
Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,106 @@
1-
## Color styles and tokens
1+
## Color tokens
22

3-
Color-naming syntax and usage can vary depending on context and tooling. This overview will clarify what naming conventions are typically used and how they align with the HDS standards implemented in our libraries.
3+
Color-naming syntax and usage can vary depending on context and tooling. Semantic naming conventions within our system allow us to implement consistent standards in our libraries.
44

5-
In Figma, reusable colors are referred to as “Styles.” They are categorized and stored in the right sidebar for fills, borders, and other properties that accept color values. Styles directly reference a HEX value but cannot reference each other (known as aliasing for Tokens). This means when we provide Figma Styles for semantic usage (like `Foreground/Primary`), the HEX value (`#3B3D45`) is directly referenced instead of the Core Palette color (`Palette/Neutral/Neutral 600`).
5+
In Figma, we use Variables to define and organize color values. Variables allow us to create palettes that reference (or alias) each other. Our Core Palette is a collection of HEX values and their color ramps (`neutral-50`, `neutral-100`,...`neutral-700`). These values are then connected to Semantic Variables (`foreground-primary`, `surface-faint`, `border-critical`). This alias connection allows us to designate multiple token uses for individual HEX values that lead back to the same Core Palette token.
66

7-
In code, we refer to reusable colors as “Tokens.” They are generated from platform-agnostic files, in our case JSON, and create atomic colors regardless of what platform or framework is used. For example, Core Palette colors like `--token-color-palette-neutral-600` are directly referenced in `--token-color-foreground-primary`.
7+
Tokens in code are generated from platform-agnostic files, in our case JSON, and create atomic colors regardless of what platform or framework is used. Core Palette values are directly referenced in Semantic Palette values in the same way that Figma variables alias one another.
88

9-
![Pyramid diagram of token color inheritance with the levels (from bottom to top): hex code, global token, alias token, component token](/assets/foundations/color/colors-what-are-semantic-tokens.png)
9+
![Diagram of token color inheritance with the levels (from left to right): hex code, core palette token, semantic token](/assets/foundations/color/colors-what-are-semantic-tokens.png)
1010

1111
## What are semantic colors?
1212

13-
The Semantic Palette helps ensure proper color usage across applications by embedding meaning directly into the name.
13+
The Semantic Palette embeds meaning into color names, making it easier to select correct consistent values across applications. These colors are designed to meet accessibility standards when used in combination with one another.
14+
- Foreground colors are intended to be used with surface or page colors.
15+
- Status color values consist of "surface," "on-surface," and "high-contrast" options to meet accessibility standards when used together.
1416

15-
Semantic colors were designed to be used together, ensuring they meet accessibility standards and look visually pleasing. For example, foreground colors are intended to be used with surface or page colors. In many cases, it is important to use specific contextual naming conventions, such as status colors, together. Here are some examples of semantic color combinations with their respective contrast ratios:
17+
Some examples of semantic color combinations with their respective contrast ratios are:
1618
- `Foreground/Strong` on `Surface/Primary` nets a ratio of 19.54:1
1719
- `Foreground/Success-on Surface` on `Surface/Success` nets a ratio of 5.37:1
1820
- `Foreground/Primary` on `Surface/Primary` nets a ratio of 10.82:1
1921
- `Foreground/Action` on `Surface/Faint` nets a ratio of 4.86:1
2022

2123
![A Card component with the color contrast ratios for each of the color combinations labelled](/assets/foundations/color/colors-semantic-tokens-accessibility-examples.png)
2224

23-
The **element** and the **role** are referenced in the name to help make more informed color decisions.
25+
### How are semantic names created?
2426

25-
HDS organizes semantic tokens into **element** categories:
27+
In semantic token naming, the **element** and the **role** are defined to make color decisions easier and more consistent. HDS organizes semantic tokens into **element** categories with **roles** appended.
2628

27-
- **Foreground** - For elements such as text, links, statuses, and icons.
28-
- **Border** - For borders on components, containers, or dividers.
29+
![Columns showing how the token name is broken down into a prefix, element, and role](/assets/foundations/color/colors-semantic-token-naming.png)
30+
31+
Examples of **element** naming include:
32+
33+
- **Foreground** - For text, link, status, and icon elements
34+
- **Border** - For borders (or strokes) on components, containers, or dividers
2935
- **Surface** - For the background (or surface) of a component or container
3036
- **Page** - For page backgrounds
3137

32-
Examples of **role** naming conventions include:
38+
Examples of **role** in naming include:
3339

3440
- Strong
3541
- Primary
3642
- Faint
3743
- Action (not to be used outside of context)
3844
- Disabled (not to be used outside of context)
3945

40-
### Foreground colors
46+
### Foreground
4147

42-
Foreground colors are used for elements such as text, links, and icons.
48+
Foreground colors are used for informational and decorative elements such as text, links, and icons.
4349

4450
Some common examples of semantic foreground colors include:
4551

4652
- `Foreground/Strong` for headings and secondary links
4753
- `Foreground/Primary` for body text
48-
- `Foreground/Faint` for less prominent text and UI elements.
49-
- `Foreground/Action` for primary call to action such as links
54+
- `Foreground/Faint` for less prominent text and UI elements
55+
- `Foreground/Action` for primary calls to action such as links
5056

5157
![Samples of text with their color tokens labelled](/assets/foundations/color/colors-foreground-examples.png)
5258

53-
Use status foreground colors to help contextualize responses from user actions or to indicate status within a UI. These colors should be used sparingly and within the context of specific components like [Alerts](/components/alert#color), [Toasts](/components/toast#color), or [Badges](/components/badge#color).
59+
Status foreground colors contextualize responses from user actions or indicate status within a UI. These colors should be used sparingly and within the context of specific components, for example:
60+
61+
- [Alerts](/components/alert#color)
62+
- [Toasts](/components/toast#color)
63+
- [Badges](/components/badge#color)
5464

5565
![Sample positive, warning, and error status badges with their associated foreground color tokens labelled.](/assets/foundations/color/colors-status-examples.png)
5666

57-
### Border colors
67+
### Border
5868

59-
Some common examples of border colors include:
69+
Some examples of border colors include:
6070

6171
- `Border/Strong` for secondary Button border
6272
- `Border/Primary` for Card border or divider
6373
- `Border/{Status color}` for Alert borders
6474

6575
![Sample borders applied on a button, card, and alert with the border color tokens labelled](/assets/foundations/color/colors-border-examples.png)
6676

67-
### Surface colors
77+
### Surface
6878

69-
Use surface colors for the background (or surface) of a component or container.
79+
Surface colors are intended to be used for the background (or surface) of a component or container.
7080

71-
Some common examples of surface colors include:
81+
Examples of surface colors include:
7282

73-
- `Surface/Strong` for the neutral Badge.
74-
- `Surface/Primary` for component containers.
75-
- `Surface/Faint` for the secondary Button.
76-
- `Surface/{Status color}` for Alert background.
83+
- `Surface/Strong` for the neutral Badge
84+
- `Surface/Primary` for component containers
85+
- `Surface/Faint` for the secondary Button
86+
- `Surface/{Status color}` for Alert backgrounds
7787

7888
![Sample surface colors being applied to a badge, card, button, and alert with the surface color token labelled.](/assets/foundations/color/colors-surface-examples.png)
7989

80-
### Page colors
90+
### Page
8191

82-
Page colors are used for page backgrounds. HDS components do not use these tokens; however, we recommend `Page/Primary` as the primary background color and `Page/Faint` as a means to create a secondary level on the page for highlighting information, if necessary.
92+
Page colors are used for page backgrounds. HDS components do not use these tokens; however, we recommend `Page/Primary` for all standard page backgrounds and `Page/Faint` as a means to create a secondary level on a page if necessary.
8393

8494
## Accessible color combinations
8595

86-
We intend to be conformant with WCAG 2.2 Level AA requirements. In terms of color contrast, this means a luminosity ratio of 4.5:1 for normal sized text, and 3:1 for large text (commonly 22px). Further details are outlined on [WCAG’s understanding of Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html). By default, semantic color tokens provide accessible color combinations out of the box with their associated naming conventions, while using palette colors requires manual validation, especially if you plan to mix and match. As an example, if a color has a semantic status name in it, then other associated status colors will be accessible.
96+
We are conformant with WCAG 2.2 Level AA requirements. For color contrast, this means a luminosity ratio of 4.5:1 for normal sized text, and 3:1 for large text (commonly 22px). Further details are outlined on [WCAG’s understanding of Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html).
97+
98+
HDS semantic color tokens provide accessible color combinations out of the box when used according to their naming conventions (`Surface/{Status color}`is compliant in combination with `Foreground/{Status color on surface}`). Using other color token combinations requires manual validation.
8799

88100
It is important to note that we [do not recommend the usage of disabled elements](/patterns/disabled-patterns), especially isolating disabled colors out of context, as they are not accessible.
89101

90102
### Using palette colors
91103

92-
The Core Palette is available if semantic colors do not meet your needs. These styles are usage-agnostic, which can introduce challenges in consistently scaling designs but also allow more freedom and flexibility in color pairing.
104+
If Semantic tokens do not meet your needs, the Core Palette is published for general use. These values are usage-agnostic, which can introduce challenges in consistently scaling designs but also allow more freedom and flexibility in color pairing.
93105

94-
When pairing colors from the Core Palette, ensure adjacent colors meet accessible contrast ratios. To validate your color combinations, use free tools like the [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/) or [Stark’s Figma plugin](https://www.figma.com/community/plugin/732603254453395948/stark-contrast-accessibility-checker).
106+
When pairing colors from the Core Palette, check that adjacent colors meet accessible contrast ratios. To validate your color combinations, use free tools like the [WebAIM contrast checker](https://webaim.org/resources/contrastchecker/) or [Stark’s Figma plugin](https://www.figma.com/community/plugin/732603254453395948/stark-contrast-accessibility-checker).
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
When choosing what colors to use, we recommend starting with semantic colors as their usage is clearly defined and common color pairings are accessible out of the box.
1+
When choosing color values in design, we recommend starting with semantic color tokens — values with clearly defined intent — and relying on color pairings in Helios that are accessible out of the box.
36.6 KB
Loading
-14.1 KB
Loading

0 commit comments

Comments
 (0)