diff --git a/site/content/docs/5.3/utilities/background.md b/site/content/docs/5.3/utilities/background.md index 4607aca599..8fa68109fb 100644 --- a/site/content/docs/5.3/utilities/background.md +++ b/site/content/docs/5.3/utilities/background.md @@ -1,7 +1,7 @@ --- layout: docs title: Background -description: Convey meaning through `background-color` and add decoration with gradients. +description: Convey meaning through `background-color`. group: utilities aliases: - "/docs/utilities/background/" @@ -14,57 +14,57 @@ toc: true ## Background color -Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities **do set `color`** to ensure contrasts. +Background utilities like `.bg-*` are generated from our original `$theme-colors` Sass map and respond to color modes. -{{< callout info >}} -Background utilities like `.bg-*` that generated from our original `$theme-colors` Sass map don't yet respond to color modes, however, any `.bg-*-subtle` utility will. This will be resolved in v6. -{{< /callout >}} +Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities **do not set `color`**, so depending on the cases you'll want to use: +* `.text-*` [color utilities]({{< docsref "/utilities/colors" >}}) when the background color remains the same in light and dark mode +* `.text-bg-*` [color & background helper]({{< docsref "/helpers/color-background" >}}) from our [theme colors]({{< docsref "/customize/color-theme#theming" >}}) +* `[data-bs-theme]` [color mode attribute]({{< docsref "/customize/color-modes#example" >}}) when the element using a background utility contains complex sub-elements such as components that need to respond to color modes -{{< callout info >}} -In case you need to write over one of these background, prefer using our [color & background helper]({{< docsref "/helpers/color-background" >}}) when it exists. -{{< /callout >}} +{{< example >}} +{{< colors.inline >}} +{{- range (index $.Site.Data "theme-colors") }} +
.bg-{{ .name }}
+{{- end -}} +{{< /colors.inline >}} +
.bg-body-secondary
+
.bg-body
+
.bg-black
+
.bg-white
+
.bg-transparent
+{{< /example >}} + +Supporting background utilities are generated from our [supporting colors]({{< docsref "/customize/color-theme#supporting" >}}). Please note that their color value stays the same between light and dark mode. - {{< example >}} -
.bg-primary
-
.bg-secondary
-
.bg-success
-
.bg-danger
-
.bg-warning
-
.bg-info
.bg-supporting-green
.bg-supporting-purple
.bg-supporting-yellow
.bg-supporting-blue
.bg-supporting-pink
.bg-supporting-orange
-
.bg-light
-
.bg-dark
-
.bg-body-secondary
-
.bg-body-tertiary
-
.bg-body
-
.bg-black
-
.bg-white
-
.bg-transparent
{{< /example >}} -{{< callout info >}} -For each `.background-*` there is a matching `.background-*-subtle` utility. In Boosted, they have exactly the same value so we decided not to display them in the example above so that you don't hesitate on which class to use. +
+ See list of Bootstrap-specific background color utilities +
-Here is a list of these extra classes: -{{< background-subtle.inline >}} -{{- range (index $.Site.Data "theme-colors") }} -- `.bg-{{ .name }}-subtle` -{{- end -}} -{{< /background-subtle.inline >}} -{{< /callout >}} +Another background utility is `.bg-body-tertiary` but doesn't have any matching color in our [grays colors]({{< docsref "/customize/color-theme#grays" >}}) so shouldn't be used for now. -{{< callout >}} -### Color naming +{{< example >}} +

.bg-body-tertiary

+{{< /example >}} -Since [Orange brand distinguishes functional colors from supporting colors]({{< docsref "/customize/color-theme#theming" >}}) and Bootstrap doesn't, naming can be somewhat inconsistent. -Bootstrap's `background-color` utilities are supported in Boosted, but will result in our core `.bg-supporting-*` utilities—making `.bg-danger` inconsistent with `.btn-danger` color, for example. -{{< /callout >}} +In Bootstrap, for each `.bg-*` there is a matching `.bg-*-subtle` utility responding to color modes. In Boosted, subtle colors don't exist so these background utilities have exactly the same value and shouldn't be used. Prefer the regular `.bg-*` utilities instead. + +{{< example >}} +{{< colors.inline >}} +{{- range (index $.Site.Data "theme-colors") }} +
.bg-{{ .name }}-subtle
+{{- end -}} +{{< /colors.inline >}} +{{< /example >}} +