From 89c0667e9c3e90d11f08461f8443f3dd6e3eca37 Mon Sep 17 00:00:00 2001 From: Lea Verou Date: Tue, 14 Jan 2025 13:25:18 -0500 Subject: [PATCH] Improve maintainability of color docs --- docs/assets/styles/docs.css | 28 +++ docs/docs/tokens/color.md | 463 +++--------------------------------- 2 files changed, 64 insertions(+), 427 deletions(-) diff --git a/docs/assets/styles/docs.css b/docs/assets/styles/docs.css index c68026859..f2c8cfa57 100644 --- a/docs/assets/styles/docs.css +++ b/docs/assets/styles/docs.css @@ -382,6 +382,7 @@ wa-page > main:has(> .index-grid) { /* Swatches */ .swatch { + position: relative; background-color: transparent; border-color: var(--wa-color-neutral-border-normal); border-style: var(--wa-border-style); @@ -391,6 +392,33 @@ wa-page > main:has(> .index-grid) { line-height: 2.5; height: 2.5em; padding-inline: var(--wa-space-xs); + + wa-copy-button { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: block; + --background-color-hover: transparent; + font-family: var(--wa-font-family-code); + + &::part(button) { + display: block; + height: 100%; + width: 100%; + } + + &::part(button):hover { + cursor: copy; + } + + &::part(copy-icon), + &::part(success-icon), + &::part(error-icon) { + opacity: 0 !important; + } + } } /* Layout Examples */ diff --git a/docs/docs/tokens/color.md b/docs/docs/tokens/color.md index 4763300c7..3c9516a78 100644 --- a/docs/docs/tokens/color.md +++ b/docs/docs/tokens/color.md @@ -66,389 +66,17 @@ Lightness values on this scale have a strong correlation to [relative luminance] Web Awesome defines seven literal colors each with 11 lightness values using the format `--wa-color-{hue}-{tint}`. -
Red
+{% for hue in ["red", "yellow", "green", "teal", "blue", "indigo", "violet", "gray"] -%} +
{{ hue | capitalize }}
- -
Yellow
- - -
Green
- - -
Teal
- - -
Blue
- - -
Indigo
- - -
Violet
- - -
Gray
- +{%- endfor %} ## Foundational Colors @@ -532,52 +160,33 @@ Finally, each color is named according to how much attention it draws. Here, we - **Normal** draws some attention - **Loud** draws the most attention -| Custom Property | brand | success | neutral | warning | danger | -| ---------------------------- | ------------------- | --------------------- | --------------------- | --------------------- | ------------------- | -| `--wa-color-*-fill-quiet` |
|
|
|
|
| -| `--wa-color-*-fill-normal` |
|
|
|
|
| -| `--wa-color-*-fill-loud` |
|
|
|
|
| -| `--wa-color-*-border-quiet` |
|
|
|
|
| -| `--wa-color-*-border-normal` |
|
|
|
|
| -| `--wa-color-*-border-loud` |
|
|
|
|
| -| `--wa-color-*-on-quiet` |
AaBb
|
AaBb
|
AaBb
|
AaBb
|
AaBb
| -| `--wa-color-*-on-normal` |
AaBb
|
AaBb
|
AaBb
|
AaBb
|
AaBb
| -| `--wa-color-*-on-loud` |
AaBb
|
AaBb
|
AaBb
|
AaBb
|
AaBb
| - - +{% set variants = ['brand', 'success', 'neutral', 'warning', 'danger'] %} + + + + + {% for variant in variants -%} + + {%- endfor %} + + + {% for type in ['fill', 'border', 'on'] -%} + {% for attention in ['quiet', 'normal', 'loud'] -%} + + + {% for variant in variants -%} + + {%- endfor %} + + {%- endfor %} + {%- endfor %} +
Custom Property{{ variant }}
--wa-color-*-{{ type }}-{{ attention }} + {%- if type == 'border' -%} +
+ {%- else -%} +
{{ 'AaBb' if type == 'on' }}
+ {%- endif %} +