Skip to content

Commit 95862a9

Browse files
committed
Tidy up color-mode.md
Also hit up static-resources.md for style
1 parent a65d322 commit 95862a9

File tree

2 files changed

+63
-30
lines changed

2 files changed

+63
-30
lines changed

docs/classic-ui/static-resources.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ myst:
44
"description": "Static resources in Plone 6"
55
"property=og:description": "Static resources in Plone 6"
66
"property=og:title": "Static resources in Plone 6"
7-
"keywords": "Plone, static, resources"
7+
"keywords": "Plone, static, resources, JavaScript, CSS"
88
---
99

1010
(classic-ui-static-resources-label)=
@@ -16,12 +16,13 @@ For this, we need to register static resources.
1616

1717

1818
(classic-ui-static-resources-registering-label)=
19-
## Registering javascript and css
19+
20+
## Registering JavaScript and CSS
2021

2122
To register a static resource in Plone 6, we need to use the `plone.base.interfaces.resources.IBundleRegistry` interface.
2223

23-
The following example registers a Javascript resource in `browser/profiles/default/registry` of your Plone 6 project.
24-
The js files have to be in the `browser/static` folder of your Plone 6 project.
24+
The following example registers a JavaScript resource in `browser/profiles/default/registry` of your Plone 6 project.
25+
The JavaScript files have to be in the `browser/static` folder of your Plone 6 project.
2526

2627
```xml
2728
<registry>
@@ -47,7 +48,7 @@ You can register a CSS resource in the same way.
4748
</registry>
4849
```
4950

50-
Registering a js file and a css file in the same bundle is also possible.
51+
Registering a JavaScript file and a CSS file in the same bundle is also possible.
5152

5253
```xml
5354
<registry>
@@ -62,33 +63,37 @@ Registering a js file and a css file in the same bundle is also possible.
6263
</registry>
6364
```
6465

66+
6567
(classic-ui-static-resources-available-attributeslabel)=
6668

6769
## Available attributes
6870

6971
The following attributes are available for registering a static resource:
7072

7173
`enabled`
72-
: Whether the bundle is enabled or not. If it is disabled, the bundle will not be loaded.
74+
: Whether the bundle is enabled or not.
75+
If it is disabled, the bundle will not be loaded.
7376

7477
`jscompilation`
75-
: The path to the compiled js file.
78+
: The path to the compiled JavaScript file.
7679

7780
`csscompilation`
78-
: The path to the compiled css file.
81+
: The path to the compiled CSS file.
7982

8083
`depends`
81-
: A list of bundles that this bundle depends on.
84+
: A list of bundles that this bundle depends on.
8285

8386
`load_async`
84-
: Whether the bundle should be loaded asynchronously or not. *Only JS*
87+
: Whether the bundle should be loaded asynchronously or not.
88+
*Only JavaScript*
8589

8690
`load_defer`
87-
: Whether the bundle should be loaded deferred or not. *Only JS*
91+
: Whether the bundle should be loaded deferred or not.
92+
*Only JavaScript*
8893

8994

9095
(classic-ui-static-resources-loading-order-label)=
9196

9297
## Loading order of resources
9398

94-
`depends` is used to define the loading order of resources, by specifying the name of the depending bundle.
99+
`depends` is used to define the loading order of resources, by specifying the name of the depending bundle.

docs/classic-ui/theming/color-mode.md

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff 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+
214
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+
417

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

1027
```js
1128
(() => {
@@ -26,11 +43,14 @@ See [Registering Javascript and CSS](classic-ui-static-resources-registering-lab
2643
})()
2744
```
2845

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

3555
```html
3656
<div class="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
4363
</div>
4464
```
4565

46-
## Registering the Toggle Button
4766

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.
4972
The following code snippet is based on the [Bootstrap 5.3 documentation](https://getbootstrap.com/docs/5.3/customize/color-modes/#javascript).
5073

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

5478
```js
5579
(() => {
@@ -104,10 +128,14 @@ See [Registering Javascript and CSS](classic-ui-static-resources-registering-lab
104128
})()
105129
```
106130

131+
132+
(customize-single-elements-label)=
133+
107134
## Customize single elements
135+
108136
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.
138+
See the following example.
111139

112140
```html
113141
<form data-bs-theme='light'>
@@ -117,4 +145,4 @@ For example:
117145
</div>
118146
<button type="submit" class="btn btn-primary">Submit</button>
119147
</form>
120-
```
148+
```

0 commit comments

Comments
 (0)