Skip to content

Commit 6954243

Browse files
authored
Merge pull request #1684 from junpataleta/MDL-68037-dark-mode
Document the Boost theme colour modes
2 parents 9c0da43 + ad62a9f commit 6954243

6 files changed

Lines changed: 331 additions & 0 deletions

File tree

‎docs/apis/_files/styles-css.mdx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ Plugins may define a '/styles.css' to provide plugin-specific styling. See the f
99
Rather than writing custom CSS for your plugin, where possible apply Bootstrap classes to the DOM elements in your output. These will be easier to maintain and will adopt most colour, branding, and other customisations applied to a theme.
1010

1111
:::
12+
13+
:::warning[Check both colour modes]
14+
15+
Boost can render a site in a light or a dark colour mode, and a stylesheet which hardcodes a colour will keep that colour in both. See [Colour modes](../../guides/colourmodes/index.md) for how to take your colours from the theme instead.
16+
17+
:::

‎docs/apis/plugintypes/theme/styles.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ As theme designers, only the first method of introducing CSS will be used: addin
2121

2222
:::
2323

24+
:::info[Colour modes]
25+
26+
Boost can render a site in a light or a dark colour mode. Any colour written as a literal keeps its value in both, so a theme or a plugin has to take its colours from the theme's custom properties in order to follow the mode. See [Colour modes](../../../guides/colourmodes/index.md).
27+
28+
:::
29+
2430
## CSS pre-processors {/* #css-pre-processors */}
2531

2632
Browsers understand CSS well, but it is hard to write and maintain. The language does not support inheritance and reuse. [Support for variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_variables) exists in more modern browsers only. This is why CSS pre-processors were invented. Moodle supports SASS, which is recommended by far.

‎docs/devupdate.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,13 @@ API routes can now declare the scopes required to call them, using the `#[scopes
3838
Every API route **must** now declare its scope requirements, either with one or more `#[scopeset]` attributes, or by explicitly opting out with `#[unscoped_resource]`. This is enforced by a core PHPUnit test that scans all routes in the `route\api` namespace, so any new route which omits this declaration will fail the test suite.
3939

4040
For details on declaring scopes on a route, and on defining new scope classes for a subsystem, see [Scopes](./apis/subsystems/routing/scopes.md) and [Defining Scopes](./apis/subsystems/routing/defining-scopes.md).
41+
42+
## Light and dark colour modes in Boost
43+
44+
<Since version="5.3" issueNumber="MDL-68037" />
45+
46+
The Boost theme can now render a site in either a light or a dark colour mode, built on the Bootstrap 5.3 colour modes API. The mode in use is written to the `data-bs-theme` attribute of the `html` tag. The feature is experimental, so it is off until a site turns on **Enable colour modes** on the new **Experimental settings** tab of the Boost settings, and the default mode is `Light` while it is experimental.
47+
48+
**A plugin only follows the mode if its own styles take their colours from the theme.** A literal colour in a plugin's `styles.css` keeps its value in both modes, so use the Moodle Design System tokens or the Bootstrap utility classes instead. The Behat `init.php` and `util.php --enable` commands also take a `--colourmode` option, so that a whole run can be exercised in one mode.
49+
50+
See the [Colour modes guide](./guides/colourmodes/index.md) for what to check in your plugin and how to test it in both modes.

‎docs/guides.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Learn about key Moodle features for developers through our Developer Guides. The
1212
- Introduction to [JavaScript](./guides/javascript/index.md) in Moodle
1313
- Learn about how Moodle uses [Templates](./guides/templates/index.md) to render content
1414
- Distribute and install Moodle plugins using [Composer](./guides/composer/index.md)
15+
- Make your plugin render correctly in both [Colour modes](./guides/colourmodes/index.md)

0 commit comments

Comments
 (0)