Valo Source code

Colors

Valo defines a set of CSS custom properties you can use to apply a consistent color palette across your application.

Import color.html to use them.

Accessibility

The default color palette is WCAG 2.0 AA level compliant unless otherwise noted.

Base

The base color is used as the main background color for the system. The grayscale colors are designed to be used on top of it, and the text colors are designed to have proper contrast with it.

Primary

The most prominent color in the system. It is used to bring attention to certain elements in the interface. Accompanying text and contrast colors are also defined.

Error

Usually a red color, used for error indicators, error messages and buttons that can cause permanent data loss. Accompanying text and contrast colors are also defined.

Success

Usually a green color, used for success messages and buttons that complete a certain task. Accompanying text and contrast colors are also defined.

The --valo-success-color does not have enough contrast by default to meet WCAG 2.0 AA level requirements (3:1). Use hsl(144, 82%, 38%) for compliant contrast.

The --valo-success-text-color is compliant by default.

Grayscale

These colors form the foundation for your application colors. The grayscale colors consist of 11 different shades of “black” and “white”, each with a degree of transparency.

The tint and shade colors not always pure grayscale by default, but tinted slightly with the primary color.

The grayscale colors are useful for dividing pages into sections with different backgrounds and borders, or used as text colors, for example.

Ensure proper contrast

The default text colors are tested to have enough contrast on top of the Base color and “Base + 5–20% Contrast color”. Avoid using a a higher Contrast color as a background color for any important content.

Tint

Shade

Contrast

The contrast colors work automatically for both light and dark variations. For the light palette the shade colors are used, and for the dark palette the tint colors are used.

Text

The following text colors have the desired contrast with the Base color.

Note, that --valo-primary-text-color is not necessarily the same as --valo-primary-color. Use the main color for backgrounds and the “text” version for text.

The same applies for the “error” and “success” colors as well.

The “tertiary” and “disabled” text colors do not have enough contrast by default to meet WCAG 2.0 AA level requirements (3:1). Only use them for text which is not crucial for the end user to see.


Light and dark palette

The system has a dark color variation available out of the box.

Each color has two variations: the default variation which is used for the light palette, and another variation used for the dark palette.

You need to import and include the “valo-color” style module before you can use the dark palette. It needs to be imported in the same style scope where you want to apply the dark colors.

1. Import and include the style module

2.a. Applying the dark palette for global scope

Apply the theme="dark" attribute on the HTML element:

<html theme="dark"> <!-- The whole page/app will use the dark palette colors --> </html>

2.b. Applying the dark palette for a single element scope

You can apply the theme="dark" attribute on any element inside the style scope where you include the style module:

Browser compatibility

The above example doesn’t work in Internet Explorer 11 or Edge 14. Read the compatibility instructions how to make the dark colors, scoped inside an element, work in all supported browsers.

Dark background color

The following elements, when you apply the theme="dark" attribute for them, will also set their background color to the dark palette Base color.


Custom properties

Light palette

Base color
--valo-base-color
Primary
--valo-primary-color-10pct
--valo-primary-color-50pct
--valo-primary-color
--valo-primary-contrast-color
Tint
--valo-tint-5pct
--valo-tint-20pct
--valo-tint-30pct
--valo-tint-40pct
--valo-tint-50pct
--valo-tint-60pct
--valo-tint-70pct
--valo-tint-80pct
--valo-tint-90pct
--valo-tint
Shade
--valo-shade-5pct
--valo-shade-20pct
--valo-shade-30pct
--valo-shade-40pct
--valo-shade-50pct
--valo-shade-60pct
--valo-shade-70pct
--valo-shade-80pct
--valo-shade-90pct
--valo-shade
Contrast
--valo-contrast-5pct
--valo-contrast-20pct
--valo-contrast-30pct
--valo-contrast-40pct
--valo-contrast-50pct
--valo-contrast-60pct
--valo-contrast-70pct
--valo-contrast-80pct
--valo-contrast-90pct
--valo-contrast
Error
--valo-error-color-10pct
--valo-error-color-50pct
--valo-error-color
--valo-error-contrast-color
Success
--valo-success-color-10pct
--valo-success-color-50pct
--valo-success-color
--valo-success-contrast-color
Text
--valo-header-text-color
--valo-body-text-color
--valo-secondary-text-color
--valo-tertiary-text-color
--valo-disabled-text-color
--valo-primary-text-color
--valo-error-text-color
--valo-success-text-color
--valo-link-color: var(--valo-primary-text-color)

Dark palette

You will see the light palette colors here on Internet Explorer 11 and Edge 14. See Browser compatibility for more info.

Base color
--valo-base-color
Primary
--valo-primary-color-10pct
--valo-primary-color-50pct
--valo-primary-color
--valo-primary-contrast-color
Tint
--valo-tint-5pct
--valo-tint-20pct
--valo-tint-30pct
--valo-tint-40pct
--valo-tint-50pct
--valo-tint-60pct
--valo-tint-70pct
--valo-tint-80pct
--valo-tint-90pct
--valo-tint
Shade
--valo-shade-5pct
--valo-shade-20pct
--valo-shade-30pct
--valo-shade-40pct
--valo-shade-50pct
--valo-shade-60pct
--valo-shade-70pct
--valo-shade-80pct
--valo-shade-90pct
--valo-shade
Contrast
--valo-contrast-5pct
--valo-contrast-20pct
--valo-contrast-30pct
--valo-contrast-40pct
--valo-contrast-50pct
--valo-contrast-60pct
--valo-contrast-70pct
--valo-contrast-80pct
--valo-contrast-90pct
--valo-contrast
Error
--valo-error-color-10pct
--valo-error-color-50pct
--valo-error-color
--valo-error-contrast-color
Success
--valo-success-color-10pct
--valo-success-color-50pct
--valo-success-color
--valo-success-contrast-color
Text
--valo-header-text-color
--valo-body-text-color
--valo-secondary-text-color
--valo-tertiary-text-color
--valo-disabled-text-color
--valo-primary-text-color
--valo-error-text-color
--valo-success-text-color
--valo-link-color: var(--valo-primary-text-color)