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: general/app/customisation/remote-themes.md
+26-30Lines changed: 26 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ Once you have everything ready, you can configure your theme by going to "Site a
23
23
You can get started with the following example, and you should see the background of the top bar change to red once you log into the app:
24
24
25
25
```css
26
-
html {
26
+
:root {
27
27
--core-header-toolbar-background: red;
28
28
}
29
29
```
@@ -76,23 +76,23 @@ Each of these also define other variants: `rgb`, `contrast`, `contrast-rgb`, `sh
76
76
For example, if you want to override the primary color, you'll need to override the following variables:
77
77
78
78
```css
79
-
html {
80
-
--ion-color-primary: #006600;
79
+
:root {
80
+
--primary: #006600;
81
81
82
82
/* RGB list of the color */
83
83
--ion-color-primary-rgb: 0,102,0;
84
84
85
85
/* Black or white, depending on which color gives more contrast */
86
-
--ion-color-primary-contrast: #ffffff;
86
+
--primary-contrast: #ffffff;
87
87
88
88
/* RGB version of the contrast color */
89
89
--ion-color-primary-contrast-rgb: 255,255,255;
90
90
91
91
/* Slightly darker color. (mix 12% of black) */
92
-
--ion-color-primary-shade: #005a00;
92
+
--primary-shade: #005a00;
93
93
94
94
/* Slightly lighter color. (mix 10% of white) */
95
-
--ion-color-primary-tint: #1a751a;
95
+
--primary-tint: #1a751a;
96
96
}
97
97
```
98
98
@@ -101,7 +101,7 @@ html {
101
101
Other than the basic and semantic colors, other components and pages define their own variables that you can override. You can look at the source code to find more, but these are some of the most relevant:
102
102
103
103
```css
104
-
html {
104
+
:root {
105
105
/* Page background */
106
106
--background-color: white;
107
107
--ion-background-color-rgb: 255, 255, 255;
@@ -120,27 +120,27 @@ html {
120
120
121
121
### Targeting different environments
122
122
123
-
The `html` element contains classes that indicate the environment the app is running on.
123
+
The `:root` element contains classes that indicate the environment the app is running on.
124
124
125
125
#### Platform
126
126
127
-
You can specify styles that will only apply to iOS by prepending them with `html.ios`, or `html.md` for Android:
127
+
You can specify styles that will only apply to iOS by prepending them with `:root.ios`, or `:root.md` for Android:
128
128
129
129
```css
130
130
/* Red toolbar in iOS */
131
-
html.ios {
131
+
:root.ios {
132
132
--core-header-toolbar-background: red;
133
133
}
134
134
135
135
/* Green toolbar in Android */
136
-
html.md {
136
+
:root.md {
137
137
--core-header-toolbar-background: green;
138
138
}
139
139
```
140
140
141
141
#### Moodle App and Moodle site versions
142
142
143
-
You can restrict CSS rules to a specific version using one of these classes. For example, when accessing a 3.11.2 site using the 3.9.5 app the following classes will be present in the `html` element:
143
+
You can restrict CSS rules to a specific version using one of these classes. For example, when accessing a 3.11.2 site using the 3.9.5 app the following classes will be present in the `:root` element:
144
144
145
145
-`version-3`
146
146
-`version-3-11`
@@ -153,12 +153,12 @@ And here's how to use them:
153
153
154
154
```css
155
155
/* Red toolbar for Moodle App version 4.1.X */
156
-
html.moodleapp-4-1 {
156
+
:root.moodleapp-4-1 {
157
157
--core-header-toolbar-background: red;
158
158
}
159
159
160
160
/* Green toolbar for all other versions */
161
-
html {
161
+
:root {
162
162
--core-header-toolbar-background: green;
163
163
}
164
164
```
@@ -170,16 +170,16 @@ Starting on Moodle App 4.4 you can restrict CSS rules to a specific site theme.
170
170
171
171
#### Application theme
172
172
173
-
The application uses a light theme by default, but it adds the `dark` class to the `html` element when it is using a dark theme:
173
+
The application uses a light theme by default, but it adds the `dark` class to the `:root` element when it is using a dark theme:
174
174
175
175
```css
176
176
/* Red toolbar for the Light Theme */
177
-
html {
177
+
:root {
178
178
--core-header-toolbar-background: red;
179
179
}
180
180
181
181
/* Green toolbar for the Dark Theme */
182
-
html.dark {
182
+
:root.dark {
183
183
--core-header-toolbar-background: green;
184
184
}
185
185
```
@@ -193,7 +193,7 @@ Of course, you can combine any of these classes to create more granular styles.
193
193
Let's say you want to have a red toolbar only in iOS, with the Dark Theme, for a Moodle site running 3.11.X:
194
194
195
195
```css
196
-
html.ios.version-3-11.dark {
196
+
:root.ios.version-3-11.dark {
197
197
--core-header-toolbar-background: red;
198
198
}
199
199
```
@@ -305,7 +305,7 @@ core-tabs, core-tabs-outlet {
305
305
### Items
306
306
307
307
```css
308
-
html {
308
+
:root {
309
309
/* Background */
310
310
--ion-item-background: green;
311
311
@@ -354,7 +354,7 @@ page-core-mainmenu-more {
354
354
You can personalise some colors in the Login page, but keep in mind that this only includes the credentials page (the one after you select the site).
0 commit comments