Skip to content

Commit d464714

Browse files
committed
Rudimentary palette icons
1 parent 7d089bb commit d464714

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

docs/_includes/svgs/palette.njk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{% set paletteId = page.fileSlug %}
2+
{% set tints = [80, 60, 40, 20] %}
3+
{% set width = 20 %}
4+
{% set height = 13 %}
5+
{% set gap_x = 3 %}
6+
{% set gap_y = 3 %}
7+
8+
<svg viewBox="0 0 {{ (width + gap_x) * hues|length }} {{ (height + gap_y) * tints|length }}" fill="none" xmlns="http://www.w3.org/2000/svg" class="wa-palette-{{ paletteId }} palette-icon">
9+
<style>
10+
@import url('/dist/styles/color/{{ paletteId }}.css') layer(palette.{{ paletteId }});
11+
.palette-icon {
12+
height: 8ch;
13+
}
14+
</style>
15+
16+
{% for hue in hues -%}
17+
{% set hueIndex = loop.index0 %}
18+
{% for tint in tints -%}
19+
<rect x="{{ hueIndex * (width + gap_x) }}" y="{{ loop.index0 * (height + gap_y) }}"
20+
width="{{ width }}" height="{{ height }}"
21+
fill="var(--wa-color-{{ hue }}-{{ tint }})" rx="4" />
22+
{%- endfor %}
23+
{% endfor %}
24+
</svg>

docs/_layouts/palette.njk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
{% block afterContent %}
1010
<style>@import url('/dist/styles/color/{{ paletteId }}.css') layer(palette.{{ paletteId }});</style>
1111

12-
{% set hues = ["red", "yellow", "green", "teal", "blue", "indigo", "violet", "gray"] %}
1312
{% set tints = ["95", "90", "80", "70", "60", "50", "40", "30", "20", "10", "05"] %}
1413

1514
<table class="colors wa-palette-{{ paletteId }}">

docs/docs/palettes/palettes.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"layout": "palette.njk",
33
"tags": ["palettes", "palette"],
4+
"hues": ["red", "yellow", "green", "teal", "blue", "indigo", "violet", "gray"],
45
"eleventyComputed": {
5-
"snippet": ".wa-palette-{{ page.fileSlug }}"
6+
"snippet": ".wa-palette-{{ page.fileSlug }}",
7+
"icon": "palette"
68
}
79
}

0 commit comments

Comments
 (0)