Overview
During design and development, colors should be referenced by name. Using named colors has a few important benefits:
- More meaningful than hex values in mockups and code
- Encourages consistency and accessibility across the application
- Support for alternate themes
Some examples of named colors in the Kolibri Design System include:
tokens.textpalette.grey.v_900tokens.errorpalette.red.v_800tokens.primarybrand.primary.v_400brand.primary.v_900#4b2e4dbrand.secondary.v_200#8dc5b6palette.grey.v_400#bdbdbdCare must be taken as we adjust the colors in the application. There are a number of considerations to take into account, including:
- Branding, aesthetics, and color harmony
- Sufficient contrast between foreground and background colors
- Accommodation of color blind users
- Maintainability and consistency of the application and code
- Amenability to theming by using tokens correctly
Usage
Computed styles
For technical reasons relating to supporting dynamic themes colors must be set using Javascript. Adding Vue.use(KThemePlugin) makes all colors available on every Vue component in your application under the following objects:
$themeBrandcontains colors related to the aesthetic color scheme$themeTokenscontains colors with special meanings in Kolibri$themePalettecontains a wide range of additional compatible colors
For example, to color text using $themeTokens.error you use can a computed style to write:
<div :style="{ color: $themeTokens.error }">
This is an error
</div>
This will display:
Move style definitions from the template to computed props if the style gets complex.
Computed classes
We also attach a special helper function $computedClass which can be used to dynamically create new classes. This is useful for specifying colors in pseudo-elements such as :hover or :focus. For example:
<input :class="$computedClass({ '::placeholder': { color: $themeTokens.annotation } })">
This is usually not necessary, and using style is preferred for simplicity when possible.
Notation
In the references below we use the following shorthand:
brandrefers to$themeBrandtokensrefers to$themeTokenspaletterefers to$themePalette
Tokens
Color tokens are the most important set of named colors because they have a specific, well-defined usage within the application. Over time, our set of tokens should grow and shrink as necessary to fit the needs of the application.
Color tokens are by themselves abstract and defined by a purpose, not a color value. A theme makes them concrete by mapping them to specific brand colors and palette colors .
When using tokens, it's very important to choose them based on their semantic purpose, not because of their color values. This ensures that new themes can be created effectively.
Brand shortcuts
tokens.primarybrand.primary.v_400Default primary brand color. Commonly used for interactive elements
tokens.primaryDarkbrand.primary.v_700Default dark variant of the primary brand color. Commonly used for the hover state of interactive elements
UI Colors
tokens.textpalette.grey.v_900
Normal text color. (Typically used on top of the $themeTokens.surface color)
tokens.annotationpalette.grey.v_700
Text color with lower visual weight. (Typically used on top of the $themeTokens.surface color)
tokens.textDisabledpalette.grey.v_300
Text color with lowest visual weight. (Typically used on top of the $themeTokens.surface color)
tokens.textInvertedpalette.white
Text color for creating sufficient contrast when used on dark backgrounds (such as $themeTokens.primary)
tokens.successpalette.green.v_700Indicates the successful completion of an action in the application
Learner activity
User-related labels
Content-related labels
tokens.exercisepalette.cyan.v_600tokens.videopalette.indigo.v_700tokens.audiopalette.pink.v_400tokens.documentpalette.deeporange.v_600tokens.html5palette.yellow.v_800tokens.topicpalette.grey.v_800Scales
A color scale – sometimes called a color ramp – is an evenly-spaced ramp of shades for a particular color hue. In the Kolibri Design System, we follow Google's Material convention and segment colors into ten brightness levels, named v_50, v_100, v_20, … v_800, v_900:
palette.blue.v_50#e3f2fdpalette.blue.v_100#bbdefbpalette.blue.v_200#90caf9…
palette.blue.v_800#1565c0palette.blue.v_900#0d47a1Due to the inconsistent way that humans perceive color and light, computing these scales is both art and science. It should not be done by simply sliding a "brightness" setting. We used materialpalettes.com to generate the scales for our primary and secondary brand colors. The same should be done for new themes.
Brand colors
Brand colors are chosen to reflect the mood, identity, or trademark of an application or an organization. The design system defines primary (dominant) and secondary (accent) branded color hues.
The Kolibri Design System has what we call "Kolibri Purple" as its primary and "Kolibri Teal" as its secondary, available across the full brightness scale:
brand.primary.v_50#f0e7edbrand.primary.v_100#dbc3d4brand.primary.v_200#c59db9brand.primary.v_300#ac799dbrand.primary.v_400#996189brand.primary.v_500#874e77brand.primary.v_600#7c4870brand.primary.v_700#6e4167brand.primary.v_800#5f3b5cbrand.primary.v_900#4b2e4dbrand.secondary.v_50#e3f0edbrand.secondary.v_100#badbd2brand.secondary.v_200#8dc5b6brand.secondary.v_300#62af9abrand.secondary.v_400#479e86brand.secondary.v_500#368d74brand.secondary.v_600#328168brand.secondary.v_700#2c715abrand.secondary.v_800#26614dbrand.secondary.v_900#1b4634Palette
A color palette is a set of generic base colors that cover a wide range of the color spectrum. We use the 2014 Material Design color palette, which has many colors to choose from.
In our design system, colors from the palette have names like pink, grey, and amber.
With the exception of grey values, choosing arbitrary colors from the palette is only slightly better than choosing arbitrary hex values from the full color spectrum. No consistency or meaning is ensured, and they should generally be avoided in favor of specific color tokens and brand colors.
Grey values
A scale of standard greys
palette.white#ffffffpalette.black#000000palette.grey.v_50#fafafapalette.grey.v_100#f5f5f5palette.grey.v_200#eeeeeepalette.grey.v_300#e0e0e0palette.grey.v_400#bdbdbdpalette.grey.v_500#9e9e9epalette.grey.v_600#757575palette.grey.v_700#616161palette.grey.v_800#424242palette.grey.v_900#212121Full palette
The complete set of colors available in the palette
palette.red.v_50#ffebeepalette.red.v_100#ffcdd2palette.red.v_200#ef9a9apalette.red.v_300#e57373palette.red.v_400#ef5350palette.red.v_500#f44336palette.red.v_600#e53935palette.red.v_700#d32f2fpalette.red.v_800#c62828palette.red.v_900#b71c1cpalette.red.v_a100#ff8a80palette.red.v_a200#ff5252palette.red.v_a400#ff1744palette.red.v_a700#d50000palette.pink.v_50#fce4ecpalette.pink.v_100#f8bbd0palette.pink.v_200#f48fb1palette.pink.v_300#f06292palette.pink.v_400#ec407apalette.pink.v_500#e91e63palette.pink.v_600#d81b60palette.pink.v_700#c2185bpalette.pink.v_800#ad1457palette.pink.v_900#880e4fpalette.pink.v_a100#ff80abpalette.pink.v_a200#ff4081palette.pink.v_a400#f50057palette.pink.v_a700#c51162palette.purple.v_50#f3e5f5palette.purple.v_100#e1bee7palette.purple.v_200#ce93d8palette.purple.v_300#ba68c8palette.purple.v_400#ab47bcpalette.purple.v_500#9c27b0palette.purple.v_600#8e24aapalette.purple.v_700#7b1fa2palette.purple.v_800#6a1b9apalette.purple.v_900#4a148cpalette.purple.v_a100#ea80fcpalette.purple.v_a200#e040fbpalette.purple.v_a400#d500f9palette.purple.v_a700#aa00ffpalette.deeppurple.v_50#ede7f6palette.deeppurple.v_100#d1c4e9palette.deeppurple.v_200#b39ddbpalette.deeppurple.v_300#9575cdpalette.deeppurple.v_400#7e57c2palette.deeppurple.v_500#673ab7palette.deeppurple.v_600#5e35b1palette.deeppurple.v_700#512da8palette.deeppurple.v_800#4527a0palette.deeppurple.v_900#311b92palette.deeppurple.v_a100#b388ffpalette.deeppurple.v_a200#7c4dffpalette.deeppurple.v_a400#651fffpalette.deeppurple.v_a700#6200eapalette.indigo.v_50#e8eaf6palette.indigo.v_100#c5cae9palette.indigo.v_200#9fa8dapalette.indigo.v_300#7986cbpalette.indigo.v_400#5c6bc0palette.indigo.v_500#3f51b5palette.indigo.v_600#3949abpalette.indigo.v_700#303f9fpalette.indigo.v_800#283593palette.indigo.v_900#1a237epalette.indigo.v_a100#8c9effpalette.indigo.v_a200#536dfepalette.indigo.v_a400#3d5afepalette.indigo.v_a700#304ffepalette.blue.v_50#e3f2fdpalette.blue.v_100#bbdefbpalette.blue.v_200#90caf9palette.blue.v_300#64b5f6palette.blue.v_400#42a5f5palette.blue.v_500#2196f3palette.blue.v_600#1e88e5palette.blue.v_700#1976d2palette.blue.v_800#1565c0palette.blue.v_900#0d47a1palette.blue.v_a100#82b1ffpalette.blue.v_a200#448affpalette.blue.v_a400#2979ffpalette.blue.v_a700#2962ffpalette.lightblue.v_50#e1f5fepalette.lightblue.v_100#b3e5fcpalette.lightblue.v_200#81d4fapalette.lightblue.v_300#4fc3f7palette.lightblue.v_400#29b6f6palette.lightblue.v_500#03a9f4palette.lightblue.v_600#039be5palette.lightblue.v_700#0288d1palette.lightblue.v_800#0277bdpalette.lightblue.v_900#01579bpalette.lightblue.v_a100#80d8ffpalette.lightblue.v_a200#40c4ffpalette.lightblue.v_a400#00b0ffpalette.lightblue.v_a700#0091eapalette.cyan.v_50#e0f7fapalette.cyan.v_100#b2ebf2palette.cyan.v_200#80deeapalette.cyan.v_300#4dd0e1palette.cyan.v_400#26c6dapalette.cyan.v_500#00bcd4palette.cyan.v_600#00acc1palette.cyan.v_700#0097a7palette.cyan.v_800#00838fpalette.cyan.v_900#006064palette.cyan.v_a100#84ffffpalette.cyan.v_a200#18ffffpalette.cyan.v_a400#00e5ffpalette.cyan.v_a700#00b8d4palette.teal.v_50#e0f2f1palette.teal.v_100#b2dfdbpalette.teal.v_200#80cbc4palette.teal.v_300#4db6acpalette.teal.v_400#26a69apalette.teal.v_500#009688palette.teal.v_600#00897bpalette.teal.v_700#00796bpalette.teal.v_800#00695cpalette.teal.v_900#004d40palette.teal.v_a100#a7ffebpalette.teal.v_a200#64ffdapalette.teal.v_a400#1de9b6palette.teal.v_a700#00bfa5palette.green.v_50#e8f5e9palette.green.v_100#c8e6c9palette.green.v_200#a5d6a7palette.green.v_300#81c784palette.green.v_400#66bb6apalette.green.v_500#4caf50palette.green.v_600#43a047palette.green.v_700#388e3cpalette.green.v_800#2e7d32palette.green.v_900#1b5e20palette.green.v_a100#b9f6capalette.green.v_a200#69f0aepalette.green.v_a400#00e676palette.green.v_a700#00c853palette.lightgreen.v_50#f1f8e9palette.lightgreen.v_100#dcedc8palette.lightgreen.v_200#c5e1a5palette.lightgreen.v_300#aed581palette.lightgreen.v_400#9ccc65palette.lightgreen.v_500#8bc34apalette.lightgreen.v_600#7cb342palette.lightgreen.v_700#689f38palette.lightgreen.v_800#558b2fpalette.lightgreen.v_900#33691epalette.lightgreen.v_a100#ccff90palette.lightgreen.v_a200#b2ff59palette.lightgreen.v_a400#76ff03palette.lightgreen.v_a700#64dd17palette.lime.v_50#f9fbe7palette.lime.v_100#f0f4c3palette.lime.v_200#e6ee9cpalette.lime.v_300#dce775palette.lime.v_400#d4e157palette.lime.v_500#cddc39palette.lime.v_600#c0ca33palette.lime.v_700#afb42bpalette.lime.v_800#9e9d24palette.lime.v_900#827717palette.lime.v_a100#f4ff81palette.lime.v_a200#eeff41palette.lime.v_a400#c6ff00palette.lime.v_a700#aeea00palette.yellow.v_50#fffde7palette.yellow.v_100#fff9c4palette.yellow.v_200#fff59dpalette.yellow.v_300#fff176palette.yellow.v_400#ffee58palette.yellow.v_500#ffeb3bpalette.yellow.v_600#fdd835palette.yellow.v_700#fbc02dpalette.yellow.v_800#f9a825palette.yellow.v_900#f57f17palette.yellow.v_a100#ffff8dpalette.yellow.v_a200#ffff00palette.yellow.v_a400#ffea00palette.yellow.v_a700#ffd600palette.amber.v_50#fff8e1palette.amber.v_100#ffecb3palette.amber.v_200#ffe082palette.amber.v_300#ffd54fpalette.amber.v_400#ffca28palette.amber.v_500#ffc107palette.amber.v_600#ffb300palette.amber.v_700#ffa000palette.amber.v_800#ff8f00palette.amber.v_900#ff6f00palette.amber.v_a100#ffe57fpalette.amber.v_a200#ffd740palette.amber.v_a400#ffc400palette.amber.v_a700#ffab00palette.orange.v_50#fff3e0palette.orange.v_100#ffe0b2palette.orange.v_200#ffcc80palette.orange.v_300#ffb74dpalette.orange.v_400#ffa726palette.orange.v_500#ff9800palette.orange.v_600#fb8c00palette.orange.v_700#f57c00palette.orange.v_800#ef6c00palette.orange.v_900#e65100palette.orange.v_a100#ffd180palette.orange.v_a200#ffab40palette.orange.v_a400#ff9100palette.orange.v_a700#ff6d00palette.deeporange.v_50#fbe9e7palette.deeporange.v_100#ffccbcpalette.deeporange.v_200#ffab91palette.deeporange.v_300#ff8a65palette.deeporange.v_400#ff7043palette.deeporange.v_500#ff5722palette.deeporange.v_600#f4511epalette.deeporange.v_700#e64a19palette.deeporange.v_800#d84315palette.deeporange.v_900#bf360cpalette.deeporange.v_a100#ff9e80palette.deeporange.v_a200#ff6e40palette.deeporange.v_a400#ff3d00palette.deeporange.v_a700#dd2c00palette.brown.v_50#efebe9palette.brown.v_100#d7ccc8palette.brown.v_200#bcaaa4palette.brown.v_300#a1887fpalette.brown.v_400#8d6e63palette.brown.v_500#795548palette.brown.v_600#6d4c41palette.brown.v_700#5d4037palette.brown.v_800#4e342epalette.brown.v_900#3e2723palette.bluegrey.v_50#eceff1palette.bluegrey.v_100#cfd8dcpalette.bluegrey.v_200#b0bec5palette.bluegrey.v_300#90a4aepalette.bluegrey.v_400#78909cpalette.bluegrey.v_500#607d8bpalette.bluegrey.v_600#546e7apalette.bluegrey.v_700#455a64palette.bluegrey.v_800#37474fpalette.bluegrey.v_900#263238