Skip to content

Commit

Permalink
feat: color tokens (#7)
Browse files Browse the repository at this point in the history
* WIP

* ci: configure Utrecht CSS prefix

* brand + design tokens

* feat: example design tokens

* Update colours.md

* kleur vars toegevoegd

* Update design-tokens.css

* aanpassingen kleurnamen brand css

* Toevoegingen aan kleuren en stylen

* Update design-tokens.css

Stukje van den Haag over genomen

* Last

* Update style.css

* Link naar Utrecht

* Hex to HSL

* hex to hls

* feat: color demo component

* chore: move brand colors to proprietary directory

* docs: add color examples

Co-authored-by: JeroenduC <j.du.chatinier@utrecht.nl>
Co-authored-by: Olling <48805670+Ollie-nl@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 17, 2021
1 parent b963963 commit c40aef4
Show file tree
Hide file tree
Showing 11 changed files with 304 additions and 37 deletions.
1 change: 1 addition & 0 deletions .storybook/preview-head.html
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<link href="/brand.css" type="text/css" rel="stylesheet" />
<link href="/storybook.css" type="text/css" rel="stylesheet" />
6 changes: 3 additions & 3 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"rules": {
"custom-property-pattern": "(example|demo)-[a-z0-9-]+",
"selector-class-pattern": "(example|demo)-[a-z0-9-]+",
"keyframes-name-pattern": "(example|demo)-[a-z0-9-]+",
"custom-property-pattern": "(example|utrecht)-[a-z0-9-]+",
"selector-class-pattern": "(example|utrecht)-[a-z0-9-]+",
"keyframes-name-pattern": "(example|utrecht)-[a-z0-9-]+",
"at-rule-no-unknown": [true],
"block-no-empty": [true],
"color-no-invalid-hex": [true],
Expand Down
59 changes: 38 additions & 21 deletions __docs__/colours.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# Kleur
<!-- markdownlint-disable MD033 -->

# Kleuren huisstijl

Copyright (c) 2021 Gemeente Utrecht. Voor gebruik van de huisstijl is toestemming nodig.

---

De website gebruikt op hoofdlijnen de kleuren rood, geel, blauw, zwart, wit en grijs.

## Rood

Rood wordt gebruikt als basiskleur in het ontwerp. Het is de dominante huisstijlkleur van de website.

| Hex code | Gebruik | Content |
|----------|------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| #CC0000 | Footer, Menu, Zoek, Footer. Toptaak buttons op projectsites. | Gebruikt wit (#fff) als tekstkleur op rood. Ook voor tekstlinks. |
| #D94E51 | Bij hover/focus state van rode links/knoppen verandert de kleur #CC0000 van knoppen en links in deze kleur | Gebruikt wit (#fff) als tekstkleur op rood. Ook voor tekstlinks. |
| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| ------------------------------------------------------------------------------------------- | ----------------- | -------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-rood-donker)"></div> | Rood / donker | #D94E51 | `var(--utrecht-rood-donker)` | Bij hover/focus state van rode links/knoppen verandert de kleur #CC0000 van knoppen en links in deze kleur. Gebruikt wit (#fff) als tekstkleur op rood. Ook voor tekstlinks. |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-rood-basis)"></div> | Rood / basis | #CC0000 | `var(--utrecht-rood-basis)` | Footer, Menu, Zoek, Footer. Toptaak buttons op projectsites. Gebruikt wit (#fff) als tekstkleur op rood. Ook voor tekstlinks. |

### Inzichten uit onderzoek

Expand All @@ -19,28 +25,39 @@ Uit onderzoek blijkt dat laaggeletterden afschrikken van de kleur rood. Deze dus

Donkerblauw wordt gebruikt als basiskleur voor links en knoppen. Licht en ijsblauw wordt gebruikt voor blokken.

| Hex code | Gebruik | Contrastrichtlijn |
|----------|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|
| #FFCC00 | Huisstijlkleur geel Geel accent | Gebruikt zwart (#000) als tekstkleur op geel. Ook voor tekstlinks. |
| #FFE44D | Signaalkleur om iets te benadrukken ::selected | Gebruikt zwart (#000) als tekstkleur op geel. Ook voor tekstlinks. |
| #FFEEBB | Content uitlichten (Spotlight) | Gebruikt zwart (#000) als tekstkleur op geel. Gebruik voor tekstlinks het standaard donkerblauw (#2A5587). |
| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| ------------------------------------------------------------------------------------------------- | ------------------- | -------- | ---------------------------------- | ------- |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-blauw-donker)"></div> | Blauw / donker | | `var(--utrecht-blauw-donker)` | |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-blauw-basis)"></div> | Blauw / basis | | `var(--utrecht-blauw-basis)` | |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-blauw-licht)"></div> | Blauw / licht | #3669A5 | `var(--utrecht-blauw-licht)` | |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-blauw-super-licht)"></div> | Blauw / super licht | | `var(--utrecht-blauw-super-licht)` | |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-blauw-ultra-licht)"></div> | Blauw / ultra licht | | `var(--utrecht-blauw-ultra-licht)` | |

## Geel

| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| ------------------------------------------------------------------------------------------------ | ----------------- | -------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-geel-donker)"></div> | Geel / donker | #FFCC00 | `var(--utrecht-geel-donker)` | Huisstijlkleur geel Geel accent. Gebruikt zwart (#000) als tekstkleur op geel. Ook voor tekstlinks. |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-geel-basis)"></div> | Geel / basis | #FFE44D | `var(--utrecht-geel-basis)` | Signaalkleur om iets te benadrukken. Gebruikt zwart (#000) als tekstkleur op geel. Ook voor tekstlinks. |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-geel-licht)"></div> | Geel / basis | #FFE44D | `var(--utrecht-geel-licht)` | Signaalkleur voor `::selected`. Gebruikt zwart (#000) als tekstkleur op geel. Ook voor tekstlinks. |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-geel-super-licht)"></div> | Geel / licht | FFEEBB | `var(--utrecht-geel-super-licht)` | Content uitlichten (Spotlight). Gebruikt zwart als tekstkleur op geel. Gebruik voor tekstlinks het standaard donkerblauw. |

## Grijs

| Hex code | Gebruik | Contrastrichtlijn |
|-------------------------|-------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| Donkergrijs #727272 | Formulier input elementen | Gebruikt wit (#fff)als tekstkleur op dit donker grijs. |
| Lichtgrijs #E5E5E5 | Break out op ladingpagina’s, kruimelpad, en diverse content elementen (spotlight, tabel, accordeon) | Gebruikt zwart (#000) als tekstkleur op dit grijs. Gebruik voor links het standaard donkerblauw (#2A5587). |
| Zeer lichtgrijs #F2F2F2 | Basiskleur achtergrond kleur van de body, diverse elementen in contentpagina (scheidingslijn, subnav border, accordeon) | Gebruikt zwart (#000) als tekstkleur op dit lichte grijs. Gebruik voor tekstlinks het standaard donkerblauw (#2A5587). |
| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| -------------------------------------------------------------------------------------------- | ----------------- | -------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-grijs-donker)"></div> | Donkergrijs | #727272 | `var(--utrecht-grijs-donker)` | Formulier input elementen. Gebruikt wit (#fff)als tekstkleur op dit donker grijs. |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-grijs-basis)"></div> | Lichtgrijs | #E5E5E5 | `var(--utrecht-grijs-basis)` | Break out op ladingpagina’s, kruimelpad, en diverse content elementen (spotlight, tabel, accordeon). Gebruikt zwart (#000) als tekstkleur op dit grijs. Gebruik voor links het standaard donkerblauw (#2A5587). |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-grijs-licht)"></div> | Zeer lichtgrijs | #F2F2F2 | `var(--utrecht-grijs-superlicht)` | Basiskleur achtergrond kleur van de body, diverse elementen in contentpagina (scheidingslijn, subnav border, accordeon). Gebruikt zwart (#000) als tekstkleur op dit lichte grijs. Gebruik voor tekstlinks het standaard donkerblauw (#2A5587). |

## Zwart

| Hex code | Gebruik | Contrastrichtlijn |
|----------|------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| #000000 | Tekstkleur | Gebruik zwart als tekstkleur op de lichtere kleuren: Blauw: #99CAEF, #DBEAF6 Geel: #FFCC00, #FFE44D, #FFEEBB Grijs: #E5E5E5, #F2F2F2 |
| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| ------------------------------------------------------------------------------------- | ----------------- | -------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-zwart)"></div> | Zwart | #000000 | `var(--utrecht-zwart)` | Gebruik zwart als tekstkleur op de lichtere kleuren: Blauw: #99CAEF, #DBEAF6 Geel: #FFCC00, #FFE44D, #FFEEBB Grijs: #E5E5E5, #F2F2F2 |

## Wit

| Hex code | Gebruik | Contrastrichtlijn |
|----------|------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| #000000 | Tekstkleur | Gebruik zwart als tekstkleur op de lichtere kleuren: Blauw: #99CAEF, #DBEAF6 Geel: #FFCC00, #FFE44D, #FFEEBB Grijs: #E5E5E5, #F2F2F2 |
| Demo | Design Token naam | Hex code | CSS variable | Gebruik |
| ----------------------------------------------------------------------------------- | ----------------- | -------- | -------------------- | ------------------------------------------------ |
| <div class="utrecht-color-demo" style="background-color: var(--utrecht-wit)"></div> | Wit | #FFFFFF | `var(--utrecht-wit)` | Gebruik wit als tekstkleur op de donkere kleuren |
4 changes: 2 additions & 2 deletions __stories__/2-colours.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import { Description, Meta } from "@storybook/addon-docs/blocks";
import document from "../__docs__/colours.md";
import { MDXEmbedProvider } from "mdx-embed";

<Meta title={getTitle("Kleur")} parameters={getParams()} />
<Meta title={getTitle("Kleuren huisstijl")} parameters={getParams()} />

<Description>{document}</Description>
<Description>{document}</Description>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"lint-fix:js": "eslint --fix '**/*.{js,jsx,ts,tsx}'",
"lint-fix:md": "markdownlint --fix '**/*.md'",
"prettier": "prettier --write .",
"storybook": "start-storybook -p 6006 -s src/static/",
"storybook": "start-storybook -p 6006 -s src/static/,src/proprietary/static/",
"start": "node_modules/http-server/bin/http-server dist/storybook/",
"test": "exit 0"
},
Expand Down
6 changes: 3 additions & 3 deletions src/demo-link-component/style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.demo-link {
.utrecht-link {
color: var(--demo-link-color, blue);
text-decoration: none;
}

.demo-link__text {
.utrecht-link__text {
margin-inline-start: 1ch;
}

.demo-link:hover .demo-link__text {
.utrecht-link:hover .utrecht-link__text {
border-bottom: 1px solid currentColor;
}
7 changes: 7 additions & 0 deletions src/proprietary/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# License

Copyright (c) 2021 Gemeente Utrecht. All rights reserved.

The open source license does NOT apply to files in this directory.

These are properietary assets to Gemeente Utrecht.
67 changes: 67 additions & 0 deletions src/proprietary/static/brand.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* @license SEE LICENSE.md
* Copyright (c) 2021 Gemeente Utrecht
* All rights reserved
*/

/* stylelint-disable no-duplicate-selectors */

/*
* Comments in this file are automatically processed by a Storybook plugin.
* Documentation for the Storybook Design Token plugin:
* https://storybook.js.org/addons/storybook-design-token
*/

/**
* @tokens Utrecht / Color
* @presenter Color
*/
:root {
--utrecht-rood-donker: hsl(0 100% 20%); /* donker rood */
--utrecht-rood-basis: hsl(0 100% 40%); /* basis rood #cc0000 */
--utrecht-rood-licht: hsl(0 100% 30%); /* hover rood */

--utrecht-blauw-donker: hsl(211 60% 20%); /* basis donkerblauw */
--utrecht-blauw-basis: hsl(211 60% 30%); /* basis link en knoppen CTA donkerblauw */
--utrecht-blauw-licht: hsl(211 60% 40%); /* blauw variant bij hover/focus #3669a5 */
--utrecht-blauw-super-licht: hsl(211 60% 80%); /* licht blauw voor achtergrond */
--utrecht-blauw-ultra-licht: hsl(211 60% 90%); /* ijsblauw variant achtergrond, spotlight en uitgelicht */

--utrecht-zwart: hsl(0 0% 0%); /* basis zwart */

--utrecht-grijs-donker: hsl(0 0% 30%); /* Border grijs #888 */
--utrecht-grijs-basis: hsl(0 0% 40%); /* basis grijs #727272 */
--utrecht-grijs-licht: hsl(0 0% 80%); /* grijs variant voor achtergrond content #e5e5e5 */
--utrecht-grijs-super-licht: hsl(0 0% 90%); /* grijs variant voor achtergrond templates #f2f2f2 */

--utrecht-geel-donker: hsl(48 100% 40%); /* donker geel :( */
--utrecht-geel-basis: hsl(48 100% 50%); /* basis geel #ffcc00 */
--utrecht-geel-licht: hsl(48 100% 60%); /* seleceteer geel */
--utrecht-geel-super-licht: hsl(48 100% 80%); /* spotlight en uitgelicht */

--utrecht-wit: hsl(0 0% 100%); /* basis wit */
}

/**
* @tokens Utrecht / Font
* @presenter FontFamily
*/
:root {
--utrecht-font-family-sans-serif: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Verdana, sans-serif;
}

/**
* @tokens Utrecht / Font size
* @presenter FontSize
*/
:root {
--utrecht-font-size: 1.4em;
}

/**
* @tokens Utrecht / Font weight
* @presenter FontWeight
*/
:root {
--utrecht-font-weight: 400;
}
Loading

0 comments on commit c40aef4

Please sign in to comment.