bulma/docs/documentation/overview/variables.html

492 lines
14 KiB
HTML
Raw Normal View History

---
layout: documentation
doc-tab: overview
doc-subtab: variables
---
{% include subnav-overview.html %}
<section class="section">
<div class="container">
<h1 class="title">Variables</h1>
<h2 class="subtitle">Easily <strong>customize</strong> Bulma to match your design</h2>
<hr>
<div class="content">
<p>Bulma has 1 variable file divided into <strong>4</strong> sections:</p>
<ul>
<li>
<strong>Initial variables</strong>: where you define variables by <strong>direct value</strong>, like:
<ul>
<li><strong>colors</strong>: <code>$blue: hsl(217, 71%, 53%)</code></li>
<li><strong>font sizes</strong>: <code>$size-1: 3rem</code></li>
2017-01-04 13:05:24 +00:00
<li><strong>other values</strong>: <code>$easing: ease-out</code> or <code>$radius-large: 5px</code></li>
</ul>
</li>
<li>
<strong>Primary colors</strong> derived from the initial variables:
<ul>
<li><code>$primary: $turquoise</code></li>
<li><code>$info: $blue</code></li>
<li><code>$success: $green</code></li>
<li><code>$warning: $yellow</code></li>
<li><code>$danger: $red</code></li>
<li><code>$dark: $grey-darker</code></li>
<li><code>$text: $grey-dark</code></li>
</ul>
</li>
<li>
<strong>Generated variables</strong> where variables are <strong>calculated</strong> from the values set in the previous file. For example, you can have:
<ul>
<li><code>$body-background: $white</code>: the main background color</li>
<li><code>$link: $primary</code>: the links use the primary color</li>
<li><code>$family-primary: $family-sans-serif</code>: the primary font family is the sans-serif one</li>
</ul>
</li>
<li>
<strong>Lists and maps</strong> which are collections so already defined variables:
<ul>
<li><code>$colors: (dark: ($dark, $dark-invert), primary: ($primary, $primary-invert), info: ($info, $info-invert), success: ($success, $success-invert), warning: ($warning, $warning-invert), danger: ($danger, $danger-invert))</code></li>
<li><code>$sizes: $size-1 $size-2 $size-3 $size-4 $size-5 $size-6</code></li>
</ul>
</li>
</ul>
<p>
To <strong>override</strong> any of these variables, just set them <em>before</em> importing Bulma.
</p>
</div>
<hr>
2016-10-03 08:47:36 +00:00
<table class="table is-bordered is-striped">
<tr><th colspan="2">1. Initial variables</th></tr>
<tr><th colspan="2">Colors</th></tr>
<tr>
<td><code>$black</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 4%);"></span>
hsl(0, 0%, 4%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$black-bis</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 7%);"></span>
hsl(0, 0%, 7%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
2017-01-15 21:26:24 +00:00
<tr>
<td><code>$black-ter</code></td>
<td>
<span class="color" style="background: hsl(0, 0%, 14%);"></span>
hsl(0, 0%, 14%)
</td>
</tr>
<tr>
<td><code>$grey-darker</code></td>
<td>
<span class="color" style="background: hsl(0, 0%, 21%);"></span>
hsl(0, 0%, 21%)
</td>
</tr>
2016-10-03 08:47:36 +00:00
<tr>
<td><code>$grey-dark</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 29%);"></span>
hsl(0, 0%, 29%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$grey</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 48%);"></span>
hsl(0, 0%, 48%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$grey-light</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 71%);"></span>
hsl(0, 0%, 71%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$grey-lighter</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 86%);"></span>
hsl(0, 0%, 86%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$white-ter</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 96%);"></span>
hsl(0, 0%, 96%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$white-bis</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 98%);"></span>
hsl(0, 0%, 98%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$white</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(0, 0%, 100%);"></span>
hsl(0, 0%, 100%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$orange</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(14, 100%, 53%);"></span>
hsl(14, 100%, 53%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$yellow</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(48, 100%, 67%);"></span>
hsl(48, 100%, 67%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$green</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(141, 71%, 48%);"></span>
hsl(141, 71%, 48%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$turquoise</code></td>
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(171, 100%, 41%);"></span>
hsl(171, 100%, 41%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
2017-01-15 21:26:24 +00:00
<td><code>$blue</code></td>
<td>
<span class="color" style="background: hsl(217, 71%, 53%);"></span>
hsl(217, 71%, 53%)
</td>
</tr>
<tr>
<td><code>$purple</code></td>
<td>
<span class="color" style="background: hsl(271, 100%, 71%);"></span>
hsl(271, 100%, 71%)
</td>
</tr>
<tr>
<td><code>$red</code></td>
2016-10-03 08:47:36 +00:00
<td>
2017-01-15 21:26:24 +00:00
<span class="color" style="background: hsl(348, 100%, 61%);"></span>
hsl(348, 100%, 61%)
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr><th colspan="2">Typography</th></tr>
<tr>
<td><code>$family-sans-serif</code></td>
<td>-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",<br>"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",<br>"Helvetica Neue", "Helvetica", "Arial", sans-serif</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$family-monospace</code></td>
<td>monospace</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-1</code></td>
<td>3rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-2</code></td>
<td>2.5rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-3</code></td>
2017-01-04 13:05:24 +00:00
<td>2rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-4</code></td>
2017-01-04 13:05:24 +00:00
<td>1.5rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-5</code></td>
2017-01-04 13:05:24 +00:00
<td>1.25rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-6</code></td>
<td>1rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-7</code></td>
2017-01-04 13:05:24 +00:00
<td>0.75rem</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$weight-light</code></td>
<td>300</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$weight-normal</code></td>
<td>400</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$weight-semibold</code></td>
<td>500</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$weight-bold</code></td>
<td>700</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Body</th></tr>
<tr>
<td><code>$body-background</code></td>
<td><code>$white</code></td>
</tr>
<tr>
<td><code>$body-size</code></td>
<td><code>16px</code></td>
</tr>
2016-10-03 08:47:36 +00:00
<tr><th colspan="2">Breakpoints</th></tr>
<tr>
<td><code>$tablet</code></td>
<td>769px</td>
</tr>
<tr>
<td><code>$desktop</code></td>
2017-01-04 13:05:24 +00:00
<td>1000px (960px + 40px container)</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$widescreen</code></td>
2017-01-04 13:05:24 +00:00
<td>1192px (1152px+ 40px container)</td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Miscellaneous</th></tr>
<tr>
<td><code>$easing</code></td>
<td>ease-out</td>
</tr>
<tr>
<td><code>$radius</code></td>
<td>3px</td>
</tr>
<tr>
<td><code>$speed</code></td>
<td>86ms</td>
</tr>
<tr><th colspan="2">2. Primary colors</th></tr>
<tr>
<td><code>$primary</code></td>
<td><code>$turquoise</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$info</code></td>
<td><code>$blue</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$success</code></td>
<td><code>$green</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$warning</code></td>
<td><code>$yellow</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$danger</code></td>
<td><code>$red</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$light</code></td>
<td><code>$white-ter</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$dark</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">3. Generated variables</th></tr>
<tr><th colspan="2">Invert colors</th></tr>
<tr>
<td><code>$primary-invert</code></td>
<td><code>findColorInvert($primary)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$info-invert</code></td>
<td><code>findColorInvert($info)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$success-invert</code></td>
<td><code>findColorInvert($success)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$warning-invert</code></td>
<td><code>findColorInvert($warning)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$danger-invert</code></td>
<td><code>findColorInvert($danger)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$light-invert</code></td>
<td><code>$dark</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$dark-invert</code></td>
<td><code>$light</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">General colors</th></tr>
<tr>
<td><code>$body-background</code></td>
<td><code>$grey-lighter</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$background</code></td>
<td><code>$grey-lighter</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$border</code></td>
<td><code>$grey-light</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$border-hover</code></td>
<td><code>$grey</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Text colors</th></tr>
2017-01-04 13:05:24 +00:00
<tr>
<td><code>$text</code></td>
<td><code>$grey-dark</code></td>
2017-01-04 13:05:24 +00:00
</tr>
2016-10-03 08:47:36 +00:00
<tr>
<td><code>$text-invert</code></td>
<td><code>findColorInvert($text)</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$text-light</code></td>
<td><code>$grey</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$text-strong</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Code colors</th></tr>
<tr>
<td><code>$code</code></td>
<td><code>$red</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$code-background</code></td>
<td><code>$background</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$pre</code></td>
<td><code>$text</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$pre-background</code></td>
<td><code>$background</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Link colors</th></tr>
<tr>
<td><code>$link</code></td>
<td><code>$primary</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$link-invert</code></td>
<td><code>$primary-invert</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$link-visited</code></td>
<td><code>$purple</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$link-hover</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$link-hover-border</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$link-focus</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$link-focus-border</code></td>
<td><code>$primary</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$link-active</code></td>
<td><code>$grey-darker</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
2017-01-04 13:05:24 +00:00
<td><code>$link-active-border</code></td>
<td><code>$grey-dark</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">Typography</th></tr>
<tr>
<td><code>$family-primary</code></td>
<td><code>$family-sans-serif</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$family-code</code></td>
<td><code>$family-monospace</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-small</code></td>
<td><code>$size-7</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-normal</code></td>
<td><code>$size-6</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-medium</code></td>
<td><code>$size-5</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr>
<td><code>$size-large</code></td>
<td><code>$size-4</code></td>
2016-10-03 08:47:36 +00:00
</tr>
<tr><th colspan="2">4. Lists and maps</th></tr>
<tr>
<td><code>$colors</code>
<td>
<pre>
(
white: ($white, $black),
black: ($black, $white),
light: ($light, $light-invert),
dark: ($dark, $dark-invert),
primary: ($primary, $primary-invert),
info: ($info, $info-invert),
success: ($success, $success-invert),
warning: ($warning, $warning-invert),
danger: ($danger, $danger-invert)
)
</pre>
2016-10-03 08:47:36 +00:00
</td>
</tr>
<tr>
<td><code>$sizes</code></td>
<td><code>$size-1 $size-2 $size-3 $size-4 $size-5 $size-6</code></td>
2016-10-03 08:47:36 +00:00
</tr>
</table>
</div>
</section>