Skip to content

Commit cd8f8c5

Browse files
albertgassetcrazyserver
authored andcommitted
Fix app remote theme examples
1 parent 4bcac02 commit cd8f8c5

1 file changed

Lines changed: 26 additions & 30 deletions

File tree

general/app/customisation/remote-themes.md

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Once you have everything ready, you can configure your theme by going to "Site a
2323
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:
2424

2525
```css
26-
html {
26+
:root {
2727
--core-header-toolbar-background: red;
2828
}
2929
```
@@ -76,23 +76,23 @@ Each of these also define other variants: `rgb`, `contrast`, `contrast-rgb`, `sh
7676
For example, if you want to override the primary color, you'll need to override the following variables:
7777

7878
```css
79-
html {
80-
--ion-color-primary: #006600;
79+
:root {
80+
--primary: #006600;
8181

8282
/* RGB list of the color */
8383
--ion-color-primary-rgb: 0,102,0;
8484

8585
/* Black or white, depending on which color gives more contrast */
86-
--ion-color-primary-contrast: #ffffff;
86+
--primary-contrast: #ffffff;
8787

8888
/* RGB version of the contrast color */
8989
--ion-color-primary-contrast-rgb: 255,255,255;
9090

9191
/* Slightly darker color. (mix 12% of black) */
92-
--ion-color-primary-shade: #005a00;
92+
--primary-shade: #005a00;
9393

9494
/* Slightly lighter color. (mix 10% of white) */
95-
--ion-color-primary-tint: #1a751a;
95+
--primary-tint: #1a751a;
9696
}
9797
```
9898

@@ -101,7 +101,7 @@ html {
101101
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:
102102

103103
```css
104-
html {
104+
:root {
105105
/* Page background */
106106
--background-color: white;
107107
--ion-background-color-rgb: 255, 255, 255;
@@ -120,27 +120,27 @@ html {
120120

121121
### Targeting different environments
122122

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.
124124

125125
#### Platform
126126

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:
128128

129129
```css
130130
/* Red toolbar in iOS */
131-
html.ios {
131+
:root.ios {
132132
--core-header-toolbar-background: red;
133133
}
134134

135135
/* Green toolbar in Android */
136-
html.md {
136+
:root.md {
137137
--core-header-toolbar-background: green;
138138
}
139139
```
140140

141141
#### Moodle App and Moodle site versions
142142

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:
144144

145145
- `version-3`
146146
- `version-3-11`
@@ -153,12 +153,12 @@ And here's how to use them:
153153

154154
```css
155155
/* Red toolbar for Moodle App version 4.1.X */
156-
html.moodleapp-4-1 {
156+
:root.moodleapp-4-1 {
157157
--core-header-toolbar-background: red;
158158
}
159159

160160
/* Green toolbar for all other versions */
161-
html {
161+
:root {
162162
--core-header-toolbar-background: green;
163163
}
164164
```
@@ -170,16 +170,16 @@ Starting on Moodle App 4.4 you can restrict CSS rules to a specific site theme.
170170

171171
#### Application theme
172172

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:
174174

175175
```css
176176
/* Red toolbar for the Light Theme */
177-
html {
177+
:root {
178178
--core-header-toolbar-background: red;
179179
}
180180

181181
/* Green toolbar for the Dark Theme */
182-
html.dark {
182+
:root.dark {
183183
--core-header-toolbar-background: green;
184184
}
185185
```
@@ -193,7 +193,7 @@ Of course, you can combine any of these classes to create more granular styles.
193193
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:
194194

195195
```css
196-
html.ios.version-3-11.dark {
196+
:root.ios.version-3-11.dark {
197197
--core-header-toolbar-background: red;
198198
}
199199
```
@@ -305,7 +305,7 @@ core-tabs, core-tabs-outlet {
305305
### Items
306306

307307
```css
308-
html {
308+
:root {
309309
/* Background */
310310
--ion-item-background: green;
311311

@@ -354,7 +354,7 @@ page-core-mainmenu-more {
354354
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).
355355

356356
```css
357-
html {
357+
:root {
358358
--core-login-background: red;
359359
--core-login-text-color: blue;
360360
--core-login-input-background: green;
@@ -365,16 +365,12 @@ html {
365365
### Messages page
366366

367367
```css
368-
html {
369-
--addon-messages-message-bg: white;
370-
--addon-messages-message-activated-bg: gray-light;
371-
--addon-messages-message-note-text: gray-dark;
372-
--addon-messages-message-mine-bg: gray-light;
373-
--addon-messages-message-mine-activated-bg: gray;
374-
--addon-messages-discussion-badge: orange;
375-
--addon-messages-discussion-badge-text: white;
376-
--core-send-message-input-background: gray-light;
377-
--core-send-message-input-color: black;
368+
:root {
369+
--core-messages-message-bg: white;
370+
--core-messages-message-activated-bg: gray-light;
371+
--core-messages-message-note-text: gray-dark;
372+
--core-messages-message-mine-bg: gray-light;
373+
--core-messages-message-mine-activated-bg: gray;
378374
}
379375
```
380376

0 commit comments

Comments
 (0)