File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,17 @@ module.exports = {
11
11
theme: {
12
12
colors: {
13
13
// Create a custom color that uses a CSS custom value
14
- primary: " rgb(var(--color-primary ) / <alpha-value>)" ,
14
+ primary: " rgb(var(--color-values ) / <alpha-value>)" ,
15
15
},
16
16
},
17
17
plugins: [
18
18
// Set a default value on the `:root` element
19
- ({ addBase }) => addBase ({ " :root" : { " --color-primary" : " 255 0 0" } }),
19
+ ({ addBase }) => addBase ({
20
+ " :root" : {
21
+ " --color-values" : " 255 0 0" ,
22
+ " --color-rgb" : " rgb(255 0 0)"
23
+ }
24
+ }),
20
25
],
21
26
};
22
27
```
@@ -25,18 +30,20 @@ module.exports = {
25
30
import { vars } from ' nativewind'
26
31
27
32
const userTheme = vars ({
28
- ' --color-primary' : ' 255 0 0'
33
+ ' --color-values' : ' 0 255 0' ,
34
+ ' --color-rgb' : ' rbg(0 0 255)'
29
35
});
30
36
31
37
export default App () {
32
38
return (
33
39
<View >
34
40
<Text className = " text-primary" > Access as a theme value </Text >
35
- <Text className = " text-[--color-primary ]" > Or the variable directly < / Text >
41
+ <Text className = " text-[--color-rgb ]" > Or the variable directly < / Text >
36
42
37
43
{/* Variables can be changed inline */ }
38
44
<View style = {userTheme }>
39
- <Text className = " text-primary" > I am now red ! < / Text >
45
+ <Text className = " text-primary" > I am now green ! < / Text >
46
+ <Text className = " text-[--color-rgb]" > I am now blue ! < / Text >
40
47
</View >
41
48
</View >
42
49
)
You can’t perform that action at this time.
0 commit comments