By default, Mod ships with two themes: light and dark. Both themes are implemented as color palettes, made up of several CSS variables that can be overriden in your app.
Default Variables
The folowing variables are defined by Mod. For simplicity, the dark
theme is just an inversion of the light
theme, save for the primary colors (at the bottom of the table).
All variables have RGB variants
To help with blending, all CSS variables below offer an RGB-variant. For example, var(--mod-brand-rgb)
can be used with a call to rgba()
to adjust its opacity: rgba(var(--mod-brand-rgb), 0.5)
.
Light Swatch | Dark Swatch | CSS Variable | Hex Code (Light) | Hex Code (Dark) | RGB (Light) | RGB (Dark) |
---|---|---|---|---|---|---|
--mod-background |
#ffffff |
#111111 |
255, 255, 255 |
17, 17, 17 |
||
--mod-neutral-0 |
#000000 |
#ffffff |
0, 0, 0 |
255, 255, 255 |
||
--mod-neutral-1 |
#111111 |
#eeeeee |
17, 17, 17 |
238, 238, 238 |
||
--mod-neutral-2 |
#222222 |
#dddddd |
34, 34, 34 |
221, 221, 221 |
||
--mod-neutral-3 |
#333333 |
#cccccc |
51, 51, 51 |
204, 204, 204 |
||
--mod-neutral-4 |
#444444 |
#bbbbbb |
68, 68, 68 |
187, 187, 187 |
||
--mod-neutral-5 |
#555555 |
#aaaaaa |
85, 85, 85 |
170, 170, 170 |
||
--mod-neutral-6 |
#666666 |
#999999 |
102, 102, 102 |
153, 153, 153 |
||
--mod-neutral-7 |
#777777 |
#888888 |
119, 119, 119 |
136, 136, 136 |
||
--mod-neutral-8 |
#888888 |
#777777 |
136, 136, 136 |
119, 119, 119 |
||
--mod-neutral-9 |
#999999 |
#666666 |
153, 153, 153 |
102, 102, 102 |
||
--mod-neutral-a |
#aaaaaa |
#555555 |
170, 170, 170 |
85, 85, 85 |
||
--mod-neutral-b |
#bbbbbb |
#444444 |
187, 187, 187 |
68, 68, 68 |
||
--mod-neutral-c |
#cccccc |
#333333 |
204, 204, 204 |
51, 51, 51 |
||
--mod-neutral-d |
#dddddd |
#222222 |
221, 221, 221 |
34, 34, 34 |
||
--mod-neutral-e |
#eeeeee |
#111111 |
238, 238, 238 |
17, 17, 17 |
||
--mod-neutral-f |
#ffffff |
#000000 |
255, 255, 255 |
0, 0, 0 |
||
--mod-brand |
#6150FD |
#6150FD |
97, 80, 253 |
97, 80, 253 |
||
--mod-info |
#3A7BFC |
#3A7BFC |
58, 123, 252 |
58, 123, 252 |
||
--mod-success |
#04CB8C |
#04CB8C |
4, 203, 140 |
4, 203, 140 |
||
--mod-warning |
#FFD026 |
#FFD026 |
255, 208, 38 |
255, 208, 38 |
||
--mod-danger |
#e02727 |
#e02727 |
224, 39, 39 |
224, 39, 39 |
Overriding Variables
How you override Mod's built-in CSS variables depends on the load order of Mod's CSS relative to your own app's styles. If Mod is loaded before your app's own CSS (e.g., a global index.css
file), theme overrides can be defined as follows:
Single Theme Targeting
The examples below show customizing variables for both themes at the same time, but you can style each theme's variables independently.
index.css
[data-mod-theme="light"],
[data-mod-theme="dark"] {
--mod-brand: #ef7007;
}
Above, we target the --mod-brand
variable for both the light
and dark
themes in Mod. If we wanted to override additional variables, we'd place them inside of this CSS rule, for example:
index.css
[data-mod-theme="light"],
[data-mod-theme="dark"] {
--mod-brand: #ef7007;
--mod-success: lime;
}
If Mod's CSS is loaded after your own app's CSS, the approach is the same, however, you'll want to suffix each variable override with the CSS !important
rule:
index.css
[data-mod-theme="light"],
[data-mod-theme="dark"] {
--mod-brand: #ef7007 !important;
--mod-success: lime !important;
}
It's recommended that you load Mod's CSS first and then load your own app's styles so you can avoid the usage of !important
.