aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Déramond <[email protected]>2022-12-28 09:57:40 +0100
committerMark Otto <[email protected]>2022-12-28 22:17:16 -0800
commitbaf5d4c4c110c9ab86ea32381714fdba995c75d1 (patch)
treeeb0ef7224ece00340898b9c1a685addbd47efa22
parent7d9aa9d71602ff6856c02ee9b9d2bacf2ee3d2f4 (diff)
downloadbootstrap-baf5d4c4c110c9ab86ea32381714fdba995c75d1.tar.xz
bootstrap-baf5d4c4c110c9ab86ea32381714fdba995c75d1.zip
Fix CSS variables mentioned in our docs
-rw-r--r--site/content/docs/5.3/customize/css-variables.md17
1 files changed, 16 insertions, 1 deletions
diff --git a/site/content/docs/5.3/customize/css-variables.md b/site/content/docs/5.3/customize/css-variables.md
index 05c77df57..838a1abf7 100644
--- a/site/content/docs/5.3/customize/css-variables.md
+++ b/site/content/docs/5.3/customize/css-variables.md
@@ -21,7 +21,7 @@ These CSS variables are available everywhere, regardless of color mode.
```css
{{< root.inline >}}
{{- $css := readFile "dist/css/bootstrap.css" -}}
-{{- $match := findRE ":root {([^}]*)}" $css 1 -}}
+{{- $match := findRE `:root,\n\[data-bs-theme=light\] {([^}]*)}` $css 1 -}}
{{- if (eq (len $match) 0) -}}
{{- errorf "Got no matches for :root in %q!" $.Page.Path -}}
@@ -32,6 +32,21 @@ These CSS variables are available everywhere, regardless of color mode.
{{< /root.inline >}}
```
+### Dark mode
+
+These variables are scoped to our built-in dark mode.
+
+```css
+{{< root.inline >}}
+{{- $css := readFile "dist/css/bootstrap.css" -}}
+{{- $match := findRE `\[data-bs-theme=dark\] {([^}]*)}` $css 1 -}}
+{{- if (eq (len $match) 0) -}}
+{{- errorf "Got no matches for [data-bs-theme=dark] in %q!" $.Page.Path -}}
+{{- end -}}
+{{- index $match 0 -}}
+{{< /root.inline >}}
+```
+
## Component variables
Bootstrap 5 is increasingly making use of custom properties as local variables for various components. This way we reduce our compiled CSS, ensure styles aren't inherited in places like nested tables, and allow some basic restyling and extending of Bootstrap components after Sass compilation.