2016-09-09 06:48:17 +02:00
---
layout: docs
title: Colors
2017-05-28 20:25:59 +02:00
description: Convey meaning through color with a handful of color utility classes. Includes support for styling links with hover states, too.
2016-09-09 06:48:17 +02:00
group: utilities
2017-05-28 20:25:59 +02:00
toc: true
2016-09-09 06:48:17 +02:00
---
{% example html %}
2017-06-18 11:57:16 +02:00
{% for color in site.data.theme-colors %}
< p class = "text-{{ color.name }}" > .text-{{ color.name }}< / p > {% endfor %}
2017-10-03 03:58:33 +02:00
< p class = "text-muted" > .text-muted< / p >
< p class = "text-white bg-dark p-2" > .text-white< / p >
2016-09-09 06:48:17 +02:00
{% endexample %}
2016-09-09 07:18:40 +02:00
Contextual text classes also work well on anchors with the provided hover and focus states. **Note that the `.text-white` class has no link styling.**
2016-09-09 06:48:17 +02:00
{% example html %}
2017-06-18 11:57:16 +02:00
{% for color in site.data.theme-colors %}
2017-06-26 03:16:37 +02:00
< p > < a href = "#" class = "text-{{ color.name }}{% if color.name == " light " % } bg-gray { % endif % } " > {{ color.name | capitalize }} link< / a > < / p > {% endfor %}
2017-10-03 03:58:33 +02:00
< p > < a href = "#" class = "text-muted" > Muted link< / a > < / p >
< p class = "bg-dark p-2" > < a href = "#" class = "text-white" > White link< / a > < / p >
2016-09-09 06:48:17 +02:00
{% endexample %}
2016-09-09 07:18:40 +02:00
Similar to the contextual text color classes, easily set the background of an element to any contextual class. Anchor components will darken on hover, just like the text classes. Background utilities **do not set `color`** , so in some cases you'll want to use `.text-*` utilities.
2016-09-09 06:48:17 +02:00
{% example html %}
2017-06-18 11:57:16 +02:00
{% for color in site.data.theme-colors %}
2017-06-26 03:16:37 +02:00
< div class = "p-3 mb-2 bg-{{ color.name }} {% if color.name == " light " % } text-gray-dark { % else % } text-white { % endif % } " > .bg-{{ color.name }}< / div > {% endfor %}
2017-08-08 06:35:43 +02:00
< div class = "p-3 mb-2 bg-white text-gray-dark" > .bg-white< / div >
2016-09-09 06:48:17 +02:00
{% endexample %}
{% callout info %}
#### Dealing with specificity
Sometimes contextual classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element's content in a `<div>` with the class.
{% endcallout %}
{% capture callout-include %}{% include callout-warning-color-assistive-technologies.md %}{% endcapture %}
{{ callout-include | markdownify }}