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 %}
< p class = "text-muted" > Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.< / p >
< p class = "text-primary" > Nullam id dolor id nibh ultricies vehicula ut id elit.< / p >
< p class = "text-success" > Duis mollis, est non commodo luctus, nisi erat porttitor ligula.< / p >
< p class = "text-info" > Maecenas sed diam eget risus varius blandit sit amet non magna.< / p >
< p class = "text-warning" > Etiam porta sem malesuada magna mollis euismod.< / p >
< p class = "text-danger" > Donec ullamcorper nulla non metus auctor fringilla.< / p >
2017-03-28 18:35:39 +02:00
< p class = "text-gray-dark" > Eget risus varius blandit sit ultricies vehicula amet non magna.< / p >
2016-09-09 07:18:40 +02:00
< p class = "text-white" > Etiam porta sem malesuada ultricies vehicula.< / 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 %}
< a href = "#" class = "text-muted" > Muted link< / a >
< a href = "#" class = "text-primary" > Primary link< / a >
< a href = "#" class = "text-success" > Success link< / a >
< a href = "#" class = "text-info" > Info link< / a >
< a href = "#" class = "text-warning" > Warning link< / a >
< a href = "#" class = "text-danger" > Danger link< / a >
{% 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 %}
2016-09-09 07:18:40 +02:00
< div class = "bg-primary text-white" > Nullam id dolor id nibh ultricies vehicula ut id elit.< / div >
< div class = "bg-success text-white" > Duis mollis, est non commodo luctus, nisi erat porttitor ligula.< / div >
< div class = "bg-info text-white" > Maecenas sed diam eget risus varius blandit sit amet non magna.< / div >
< div class = "bg-warning text-white" > Etiam porta sem malesuada magna mollis euismod.< / div >
< div class = "bg-danger text-white" > Donec ullamcorper nulla non metus auctor fringilla.< / div >
< div class = "bg-inverse text-white" > Cras mattis consectetur purus sit amet fermentum.< / div >
2016-10-10 01:35:16 +02:00
< div class = "bg-faded" > Cras mattis consectetur purus sit amet fermentum.< / 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 }}