ensolabs/designsystemet-elm/1.0.0

Designsystemet.Color

The colors behind data-color. Use them with Designsystemet.color.

Your theme decides which colors exist. A theme built at theme.designsystemet.no has neutral, usually accent, your brand colors and the four severity colors, so custom takes any name. Keep those names in one module so a typo can only happen once:

module Theme exposing (brand, highlight)


import Designsystemet.Color as Color exposing (Color)


brand : Color
brand =
    Color.custom "brand1"

Theme colors

type Color

A color name from your theme.

The main color of the default theme.

Grey tones. Every theme has them.

custom : String -> Color

Any color your theme defines, like "brand1" or "hospital".

Severity colors

Some components, such as Alert, only make sense in a severity color. They take a Severity instead of a Color, so they can't get a color the CSS doesn't style.

= Info
| Success
| Warning
| Danger

The four severities every theme has.

A severity as a color, for components that take any color.

fromSeverity Info: Neutral information.

fromSeverity Success: Something went well.

fromSeverity Warning: Something needs attention.

fromSeverity Danger: Something went wrong, or can't be undone.

Conversion

toString : Color -> String

The value written to data-color.