You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 26, 2024. It is now read-only.
Brand specific colors used in the first tier of design token abstraction. They **should not** be used in the code directly but referenced by [**Theme Colors**](/docs/colors-themecolors--light-theme-colors) used in second tier tokens. Most brand color progressions were generated using [0to255](https://0to255.com/037dd6)
8
+
The first tier of our design token abstraction consists of brand-specific colors. These colors uses literal color names (like red, green, etc.) and a numeric scale (where 000 is light and 900 is dark) by default.They form the foundation of our design system and are essential to maintaining visual consistency across our products.
9
9
10
-
<Canvas>
11
-
<Storyid="colors-brandcolors--default-story" />
12
-
</Canvas>
10
+
While these colors are fundamental to our design system, they **should not** be used directly in most cases. The exception is when a color needs to remain the same regardless of the theme (light or dark mode). Instead, these brand colors should be referenced via [**theme colors**](/docs/colors-themecolors--light-theme-colors), which form the second tier of our design tokens.
11
+
12
+
The majority of our brand color progressions were generated using the [0to255](https://0to255.com/037dd6) tool, which helps ensure smooth and consistent color transitions.
13
+
14
+
<Canvasof={BrandColorStories.DefaultStory} />
13
15
14
16
## References
15
17
16
-
-[Tool used to generate colors](http://www.0to255.com/037DD6)
17
-
-[Figma Brand Colors Library](https://www.figma.com/file/cBAUPFMnbv6tHR1J8KvBI2/Brand-Colors?node-id=0%3A1)(internal use only)
18
+
-[0to255](http://www.0to255.com/037DD6): The tool we used to generate our color progressions.
19
+
-[Figma Brand Colors Library](https://www.figma.com/file/cBAUPFMnbv6tHR1J8KvBI2/Brand-Colors?node-id=0%3A1): Our internal Figma library for brand colors. Please note that this is for internal use only.
Copy file name to clipboardExpand all lines: docs/IntroductionColor.stories.mdx
+95-16Lines changed: 95 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,11 +7,7 @@ import { lightTheme } from '../src/index.ts';
7
7
8
8
# Color
9
9
10
-
Color is used to express style and communicate meaning.
11
-
12
-
## Token Tiers
13
-
14
-
We follow a 3 tiered system for color design tokens.
10
+
Color is a powerful tool in design. It can express style, convey meaning, and establish visual hierarchy. In our design system, we manage colors through a three-tiered system of design tokens.
15
11
16
12
<div
17
13
style={{
@@ -26,26 +22,109 @@ We follow a 3 tiered system for color design tokens.
26
22
<br />
27
23
<br />
28
24
29
-
### **Brand colors** (first tier)
25
+
##Token tiers
30
26
31
-
These colors **SHOULD NOT** be used in your component styles directly. They are used as a reference for the [Theme Colors](/docs/colors-themecolors--light-theme-colors). Brand colors are used to keep track of all colors used in our app. See [Brand Colors](/docs/colors-brandcolors--default-story)
27
+
### **Brand colors (first tier)**
32
28
33
-
### **Theme Colors**(second tier)
29
+
Brand colors form the foundation of our color system. However, in most cases they **SHOULD NOT**be used directly in component styles. Instead, they serve as a reference for the [Theme Colors](/docs/colors-themecolors--light-theme-colors). You can view our brand colors in the [Brand Colors](/docs/colors-brandcolors--default-story) section.
34
30
35
-
These colors are color agnostic, semantically neutral and theme compatible design tokens that you can use in your code and styles. Please refer to the description of each token for it's intended purpose. See [Theme Colors](/docs/colors-themecolors--light-theme-colors)
31
+
### **Theme colors (second tier)**
36
32
37
-
### **Component colors** (third tier)
33
+
Theme colors are semantically neutral, theme-compatible design tokens that you can use directly in your code and styles. Each token has a specific purpose, which is described in its documentation. You can view our theme colors in the [Theme Colors](/docs/colors-themecolors--light-theme-colors) section.
38
34
39
-
Another level of abstraction is component colors that you can use at a component specific level. We do not currently provide any component tier colors but that may change in future.
35
+
### **Component colors (third tier)**
40
36
41
-
## Takeaways
37
+
Component colors provide another level of abstraction for component-specific colors. We currently do not provide any component tier colors, but this may change in the future.
42
38
43
-
- Do not use static HEX values in your code. Use the [Theme Colors](/docs/colors-themecolors--light-theme-colors). If one does not exist for your use case [create an issue](https://github.com/MetaMask/design-tokens/issues/new) and tag it with a `color` label.
44
-
- Make sure the design token you are using is for it's intended purpose. Please refer to the description of each token.
39
+
## Best practices
45
40
46
-
### Next 👉 [Theme Colors](/docs/colors-themecolors--light-theme-colors)
41
+
### **Prioritize theme colors**
47
42
48
-
<br />
43
+
Theme colors should be your go-to choice for 99% of use cases. Using theme tokens ensures that the UI works across all themes and modes. We have built-in accessibility and functionality into the theme colors to ensure this. By using theme colors, you're leveraging these benefits and ensuring a consistent and accessible color scheme across your project.
44
+
45
+
#### ✅ **DO**: Use theme colors in your components
#### ❌ **DON'T**: Use static color values or brand colors in your components
53
+
54
+
```
55
+
background-color: #ffffff; // Static color value
56
+
background-color: brandColors.white.white000; // Brand color
57
+
background-color: var(--brand-colors-white-white000); // Brand color
58
+
```
59
+
60
+
### **Use brand colors for theme-independent colors**
61
+
62
+
In the rare case where a color should remain the same regardless of the theme (for instance, if white should always be white, regardless of whether light or dark mode is active), use the corresponding brand color. However, always check first to ensure that there isn't an existing theme token that suits your needs.
63
+
64
+
#### ✅ **DO**: Use brand colors when the color should remain the same across all themes
65
+
66
+
```
67
+
fill: brandColors.white.white000;
68
+
fill: var(--brand-colors-white-white000);
69
+
```
70
+
71
+
#### ❌ **DON'T**: Use brand colors without checking for an existing theme token first
72
+
73
+
```
74
+
background-color: brandColors.blue.blue500; // Brand color instead of theme.color.primary.default
75
+
background-color: var(--brand-colors-blue-blue500); // Brand color instead of var(--color-primary-default)
76
+
```
77
+
78
+
### **Avoid static color values**
79
+
80
+
As a general rule, avoid applying static color values at the component level. This helps maintain consistency and makes it easier to update colors in the future.
81
+
82
+
#### ✅ **DO**: Use theme colors in your components
#### ❌ **DON'T**: Use static color values in your components
90
+
91
+
```jsx
92
+
background-color: #ffffff; // Static color value
93
+
```
94
+
95
+
### **Centralize non-token colors**
96
+
97
+
If you need to use colors that are not included in the design tokens, store these colors in a global file in your project. This makes it easier to keep track of these colors and update them as needed. Always consider this as a last resort, and strive to use design tokens wherever possible.
98
+
99
+
#### ✅ **DO**: Store non-token colors in a global file
#### ❌ **DON'T**: Use non-token colors directly in your components
118
+
119
+
```jsx
120
+
background-color: #abc123; // Custom color not in design tokens or global file
121
+
```
122
+
123
+
Remember, the goal of these practices is to maintain consistency across your project, make your code easier to maintain, and ensure that your project's colors align with the overall design system and MetaMask brand 🦊
124
+
125
+
## Next steps
126
+
127
+
Learn more about our [brand colors](/docs/colors-brandcolors--docs) or [theme colors](/docs/colors-themecolors--light-theme-colors) section
Copy file name to clipboardExpand all lines: docs/Shadows.mdx
+10-18Lines changed: 10 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,19 @@
1
1
import { Meta, Canvas, Story } from'@storybook/addon-docs';
2
-
importLinkTofrom'@storybook/addon-links/react';
2
+
import*asShadowStoriesfrom'./Shadows.stories';
3
3
4
4
<Metatitle="Design Tokens/Shadows" />
5
5
6
6
# Shadows
7
7
8
-
Shadows convey elevation of elements on a surface
8
+
Shadows in design are used to create depth and hierarchy. They can be used to differentiate between different elements, and to highlight interactive elements.
9
9
10
-
<Canvas>
11
-
<Storyid="shadows-shadows--shadow" />
12
-
</Canvas>
10
+
<Canvasof={ShadowStories.DefaultStory} />
13
11
14
12
## Size
15
13
16
-
There are 4 different sizesof shadow in MetaMask.
14
+
Shadows come in four different sizes: XS, SM, MD, and LG. The size of the shadow can be used to indicate the relative importance or prominence of an element.
@@ -28,25 +24,21 @@ There are 4 different sizes of shadow in MetaMask.
28
24
29
25
## Color
30
26
31
-
As well as the neutral colors for shadow 2 other colors exist that are used for the primary and error/danger button hover states
27
+
Shadows can have three different colors: default (neutral), primary, and error/danger. The color of the shadow can be used to indicate the state or functionality of an element.
0 commit comments