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/classic-ui/theming/color-mode.md
+46-18Lines changed: 46 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,28 @@
1
-
# Color Modes
1
+
---
2
+
myst:
3
+
html_meta:
4
+
"description": "Color modes in Plone Classic UI"
5
+
"property=og:description": "Color modes in Plone Classic UI"
6
+
"property=og:title": "Color modes in Plone Classic UI"
7
+
"keywords": "Plone, Classic UI, theming, color modes, Bootstrap, Twitter"
8
+
---
9
+
10
+
(color-modes-label)=
11
+
12
+
# Color modes
13
+
2
14
Bootstrap 5.3 has introduced [Color Modes](https://getbootstrap.com/docs/5.3/customize/color-modes/).
3
-
Here is a small guide how to implement color themes in Plone 6.
15
+
This chapter is a guide for how to implement color themes in Plone 6.
16
+
4
17
5
-
## Preferred Color Modes
6
-
You will need to add some Javascript functionality to set the Bootstrap theme to the user's preferred color scheme.
7
-
Add the Javascript file to the `browser/static` folder of your Plone 6 project and register it in the `browser/profiles/default/registry` of your Plone 6 project.
8
-
See [Registering Javascript and CSS](classic-ui-static-resources-registering-label) for more information.
18
+
(preferred-color-modes-label)=
19
+
20
+
## Preferred color modes
21
+
22
+
You will need to add some JavaScript functionality to set the Bootstrap theme to the user's preferred color scheme.
23
+
Add the JavaScript file to the `browser/static` folder of your Plone 6 project.
24
+
Register it in the `browser/profiles/default/registry` of your Plone 6 project.
25
+
See {ref}`classic-ui-static-resources-registering-label` for more information.
9
26
10
27
```js
11
28
(() => {
@@ -26,11 +43,14 @@ See [Registering Javascript and CSS](classic-ui-static-resources-registering-lab
26
43
})()
27
44
```
28
45
29
-
## Toggle Button
30
-
In order to switch color themes, corresponding elements with `data-bs-theme-value`
31
-
attributes must be added to the DOM.
32
-
Default Bootstrap 5.3 color themes include `light`, `dark` and `auto`.
33
-
If you want to add a theme toggler to your site, you can use the following example:
46
+
47
+
(toggle-button-label)=
48
+
49
+
## Toggle button
50
+
51
+
To switch color themes, corresponding elements with `data-bs-theme-value` attributes must be added to the DOM.
52
+
Default Bootstrap 5.3 color themes include `light`, `dark`, and `auto`.
53
+
If you want to add a theme toggler to your site, you can use the following example.
34
54
35
55
```html
36
56
<divclass="btn-group btn-group-sm">
@@ -43,13 +63,17 @@ If you want to add a theme toggler to your site, you can use the following examp
43
63
</div>
44
64
```
45
65
46
-
## Registering the Toggle Button
47
66
48
-
You will need to add some Javascript functionality to the toggler.
67
+
(register-the-toggle-button-label)=
68
+
69
+
## Register the toggle button
70
+
71
+
You will need to add some JavaScript functionality to the toggler.
49
72
The following code snippet is based on the [Bootstrap 5.3 documentation](https://getbootstrap.com/docs/5.3/customize/color-modes/#javascript).
50
73
51
-
Add the Javascript file to the `browser/static` folder of your Plone 6 project and register it in the `browser/profiles/default/registry` of your Plone 6 project.
52
-
See [Registering Javascript and CSS](classic-ui-static-resources-registering-label) for more information.
74
+
Add the JavaScript file to the `browser/static` folder of your Plone 6 project.
75
+
Register it in the `browser/profiles/default/registry` of your Plone 6 project.
76
+
See {ref}`classic-ui-static-resources-registering-label` for more information.
53
77
54
78
```js
55
79
(() => {
@@ -104,10 +128,14 @@ See [Registering Javascript and CSS](classic-ui-static-resources-registering-lab
104
128
})()
105
129
```
106
130
131
+
132
+
(customize-single-elements-label)=
133
+
107
134
## Customize single elements
135
+
108
136
Elements can be assigned a static theme using the `data-bs-theme` attribute.
109
-
When set to a value the element will be rendered in the given theme, despite the global theme.
110
-
For example:
137
+
When set to a value, the element will be rendered in the given theme, overriding the global theme.
0 commit comments