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
Copy file name to clipboardExpand all lines: docs/foundation/colors.md
+56-2Lines changed: 56 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,55 @@ sidebar_position: 2
3
3
sidebar_label: Colors
4
4
title: "Colors"
5
5
---
6
+
## Colors
7
+
Our default library Colors object is using **System Colors** and **Design Tokens**.
8
+
9
+
### System Colors
10
+
The System Colors are all the colors we use in our design system. (red30, grey10 and so on).
11
+
12
+
### Design Tokens
13
+
Design Tokens are contextual colors based on the system colors.
14
+
The design token name structure is "$[property]-[semantic]-[weight]". (e.g $backgroundPrimaryHeavy, $textSuccessLight)
15
+
***Property** - The property we use this token for. The properties are:
16
+
*`background`
17
+
*`text`
18
+
*`icon`
19
+
*`outline`
20
+
21
+
22
+
***Semantic** - the meaning of the color, what is the message that we want to pass using this color. The semantics are:
23
+
*`neutral`
24
+
*`primary` - the primary color of the app, means, blue for Spaces app and green for Fit app.
25
+
*`general`
26
+
*`success`
27
+
*`warning`
28
+
*`danger`
29
+
*`disabled`
30
+
*`inverted`
31
+
*`default`
32
+
33
+
34
+
***Weight** - the weight of the color (optional). The weights are:
35
+
*`light`
36
+
*`medium`
37
+
*`heavy`
38
+
39
+
So, for example, a valid token can be: `$backgroundPrimaryHeavy` or `$textSuccess`.
40
+
A full list of our design tokens can be found here -
41
+
42
+
### Dark Mode Support
43
+
By using design tokens, your getting dark mode support out of the box!
44
+
Each token is mapped to a single system color in light mode and to a (usually different) single system color in dark mode.
45
+
For example, `$textSuccess` is mapped to `green10` in light (deafult) mode, and to `green60` in dark mode.
46
+
All the design tokens and their mapping in light mode can be found [here](https://github.com/wix/react-native-ui-lib/blob/master/src/style/designTokens.ts), dark mode mapping can be found [here](https://github.com/wix/react-native-ui-lib/blob/master/src/style/designTokensDM.ts).
47
+
48
+
### Add Your Own Design Tokens
49
+
Adding or overriding your own design tokens can be done by using the [loadSchemes](https://wix.github.io/react-native-ui-lib/docs/foundation/colors#loadschemes) method.
50
+
To generate the design tokens, based on your app primary color and load them automatically into the `Colors` object, use:
0 commit comments