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: site/content/docs/0.0/helpers/color-background.md
+52-1Lines changed: 52 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,4 +8,55 @@ aliases:
8
8
toc: true
9
9
---
10
10
11
-
{{< callout-soon "helper" >}}
11
+
## Overview
12
+
13
+
Color and background helpers combine the power of our [`.text-*` utilities]({{< docsref "/utilities/colors" >}}) and [`.bg-*` utilities]({{< docsref "/utilities/background" >}}) in one class. We determine a contrasting `color` for a particular `background-color`. However, it doesn't change mode at all.
14
+
15
+
{{< callout info >}}
16
+
Please consider using our [color modes]({{< docsref "/customize/color-modes" >}}) directly as explained in our [background utilities]({{< docsref "/utilities/background" >}}) to set nested components in the right mode directly as well.
Color and background helpers combine the power of our [`.text-*` utilities]({{< docsref "/utilities/colors" >}}) and [`.bg-*` utilities]({{< docsref "/utilities/background" >}}) in one class. Using our Sass `color-contrast()` function, we automatically determine a contrasting `color` for a particular `background-color`.
48
+
49
+
{{< callout warning >}}
50
+
**Heads up!** There's currently no support for a CSS-native `color-contrast` function, so we use our own via Sass. This means that customizing our theme colors via CSS variables may cause color contrast issues with these utilities.
51
+
{{< /callout >}}
52
+
53
+
{{< example >}}
54
+
{{< text-bg.inline >}}
55
+
{{- range (index $.Site.Data "theme-colors") }}
56
+
<divclass="text-bg-{{ .name }} p-3">{{ .name | title }} with contrasting color</div>
0 commit comments