--- title: Functions layout: documentation doc-tab: utilities doc-subtab: functions breadcrumb: - home - documentation - utilities - utilities-functions ---

Bulma has custom Sass functions to help find related colors dynamically:

Bulma also has a few utility functions to calculate useful values:

{% include elements/anchor.html name="The findColorInvert() function" %}

The findColorInvert($color) function takes a color as an input, and outputs either transparent black rgba(#000, 0.7) or white #fff:

Its purpose is to guarantee a readable shade for the text when the input color is used as the background.

color color luminance findColorInvert() result
#00d1b2 0.52831 #fff Button
#3273dc 0.23119 #fff Button
#23d160 0.51067 #fff Button
#ffdd57 0.76863 rgba(0, 0, 0, 0.7) Button
#ff3860 0.27313 #fff Button
#ffb3b3 0.61796 rgba(0,0,0,0.7) Button
#ffbc6b 0.63053 rgba(0,0,0,0.7) Button
hsl(294, 71%, 79%) 0.5529 rgba(0,0,0,0.7) Button

For colors that have a luminance close to the 0.55 threshold, it can be useful to override the findColorInvert() function, and rather set the invert color manually.
For example, this shade of purple has a color luminance of 0.5529. It can be preferable to set a color invert of white instead of transparent black:

with findColorInvert() $purple-invert: findColorInvert($purple) rgba(0,0,0,0.7) Button
with manual setting $purple-invert: #fff #fff Button
{% include elements/anchor.html name="The findLightColor() and findDarkColor() functions" %}

The findLightColor($color) and findDarkColor($color) functions take a color as an input, and output that color's light and dark versions respectively:

color findLightColor findDarkColor
{% include elements/color-square.html value="hsl(171deg, 100%, 41%)" %} {% include elements/color-square.html value="hsl(171deg, 100%, 96%)" %} {% include elements/color-square.html value="hsl(171deg, 100%, 29%)" %}
{% include elements/color-square.html value="hsl(229deg 53% 53%)" %} {% include elements/color-square.html value="hsl(229deg 52% 96%)" %} {% include elements/color-square.html value="hsl(229deg 53% 47%)" %}
{% include elements/color-square.html value="hsl(153deg 53% 53%)" %} {% include elements/color-square.html value="hsl(153deg 52% 96%)" %} {% include elements/color-square.html value="hsl(153deg 53% 31%)" %}
{% include elements/color-square.html value="hsl(44deg 100% 77%)" %} {% include elements/color-square.html value="hsl(45deg 100% 96%)" %} {% include elements/color-square.html value="hsl(44deg 100% 29%)" %}
{% include elements/color-square.html value="hsl(348deg 86% 61%)" %} {% include elements/color-square.html value="hsl(347deg 90% 96%)" %} {% include elements/color-square.html value="hsl(348deg 86% 43%)" %}