Color tokens
役割を表す名前の変数だけを参照する。ライトとダークは別々に決めており、反転では作らない。
トークンは CSS 変数で、knowidea-tokens/tokens.css を読み込むと使える。コンポーネントは役割を表す名前の変数だけを参照し、素の値は参照しない。変更の方法は Theme と Overriding を参照。
Colors
Light
| Name | OKLCH | HEX |
|---|---|---|
bg | oklch(0.9729 0.0029 264.5) | #f5f6f8 |
surface | oklch(0.9946 0.0026 286.4) | #fdfdff |
surface-2 | oklch(0.9451 0.0034 247.9) | #ebedef |
text | oklch(0.2215 0.0025 247.9) | #1a1b1c |
text-muted | oklch(0.4411 0.0042 247.9) | #515355 |
line | oklch(0.8905 0.0035 247.9) | #d9dbdd |
line-strong | oklch(0.5991 0.0051 258.3) | #7e8083 |
primary | oklch(0.4811 0.0819 194.8) | #016c6c |
primary-hover | oklch(0.4137 0.0703 194.8) | #015757 |
on-primary | oklch(0.9946 0.0026 286.4) | #fdfdff |
focus | oklch(0.4811 0.0819 194.8) | #016c6c |
success | oklch(0.508 0.15 145) | #157a26 |
success-soft | oklch(0.95 0.035 145) | #e1f5e0 |
info | oklch(0.5 0.14 250) | #0465af |
info-soft | oklch(0.95 0.025 250) | #e2f0ff |
warn | oklch(0.4691 0.0998 65.2) | #804d0c |
warn-soft | oklch(0.9558 0.0448 85.9) | #feefcf |
error | oklch(0.491 0.1853 27.1) | #b21a1c |
error-soft | oklch(0.9557 0.0219 21) | #ffebea |
Dark
| Name | OKLCH | HEX |
|---|---|---|
bg | oklch(0.191 0.0043 264.5) | #131416 |
surface | oklch(0.2348 0.0041 264.5) | #1d1e20 |
surface-2 | oklch(0.2756 0.0047 248) | #26282a |
text | oklch(0.9451 0.0034 247.9) | #ebedef |
text-muted | oklch(0.7597 0.0048 258.3) | #afb1b4 |
line | oklch(0.3291 0.0054 271.3) | #343538 |
line-strong | oklch(0.5991 0.0051 258.3) | #7e8083 |
primary | oklch(0.7402 0.1025 195.2) | #4cbfbf |
primary-hover | oklch(0.7992 0.091 195.5) | #70d0d0 |
on-primary | oklch(0.1868 0.0134 196.1) | #0c1515 |
focus | oklch(0.7402 0.1025 195.2) | #4cbfbf |
success | oklch(0.684 0.15 145) | #56b15c |
success-soft | oklch(0.29 0.05 145) | #1a321b |
info | oklch(0.72 0.13 250) | #60aaf3 |
info-soft | oklch(0.29 0.06 250) | #112d48 |
warn | oklch(0.8195 0.1399 80.1) | #f3b94c |
warn-soft | oklch(0.2997 0.0548 73.8) | #3e2909 |
error | oklch(0.76 0.143 24.6) | #ff8a83 |
error-soft | oklch(0.2899 0.0638 26) | #461d1a |
Roles
| Variable | Usage |
|---|---|
--color-bg、--color-surface、--color-surface-2 | 画面の背景、カードや入力欄の背景、ホバー時や無効状態の背景 |
--color-text、--color-text-muted | 本文、補足(どちらもコントラスト比 4.5:1 以上) |
--color-line、--color-line-strong | 区切り線、操作できる要素の枠線(3:1 以上) |
--color-primary、-hover、--color-on-primary | プライマリボタンと現在地。プライマリ面に載せる文字色 |
--color-focus | フォーカスリング(2px) |
--color-info、success、warn、error(と -soft) | 意味を表す色。文字と背景の組になっている。必ずアイコンと文字を添える |
Contrast ratios
本文は 4.5:1 以上、線とフォーカスリングは 3:1 以上。pnpm --filter knowidea-tokens check が同じ計算で判定する。
| Foreground | Background | Required | Light | Dark |
|---|---|---|---|---|
text | bg | 4.5:1 | 15.95 Pass | 15.70 Pass |
text-muted | bg | 4.5:1 | 7.14 Pass | 8.58 Pass |
text | surface | 4.5:1 | 16.98 Pass | 14.21 Pass |
text-muted | surface | 4.5:1 | 7.60 Pass | 7.76 Pass |
text | surface-2 | 4.5:1 | 14.69 Pass | 12.60 Pass |
text-muted | surface-2 | 4.5:1 | 6.58 Pass | 6.88 Pass |
primary | bg | 4.5:1 | 5.78 Pass | 8.35 Pass |
line-strong | bg | 3:1 | 3.66 Pass | 4.65 Pass |
focus | bg | 3:1 | 5.78 Pass | 8.35 Pass |
info | bg | 4.5:1 | 5.55 Pass | 7.47 Pass |
success | bg | 4.5:1 | 5.03 Pass | 6.88 Pass |
warn | bg | 4.5:1 | 6.51 Pass | 10.40 Pass |
error | bg | 4.5:1 | 6.35 Pass | 8.09 Pass |
primary | surface | 4.5:1 | 6.15 Pass | 7.56 Pass |
line-strong | surface | 3:1 | 3.90 Pass | 4.21 Pass |
focus | surface | 3:1 | 6.15 Pass | 7.56 Pass |
info | surface | 4.5:1 | 5.91 Pass | 6.76 Pass |
success | surface | 4.5:1 | 5.35 Pass | 6.23 Pass |
warn | surface | 4.5:1 | 6.93 Pass | 9.42 Pass |
error | surface | 4.5:1 | 6.76 Pass | 7.32 Pass |
info | info-soft | 4.5:1 | 5.20 Pass | 5.71 Pass |
success | success-soft | 4.5:1 | 4.75 Pass | 5.18 Pass |
warn | warn-soft | 4.5:1 | 6.19 Pass | 7.77 Pass |
error | error-soft | 4.5:1 | 5.99 Pass | 6.35 Pass |
on-primary | primary | 4.5:1 | 6.15 Pass | 8.39 Pass |
on-primary | primary-hover | 4.5:1 | 8.26 Pass | 10.25 Pass |
Usage
css
.my-panel { padding: var(--space-4); border: 1px solid var(--color-line); border-radius: var(--radius-3); background: var(--color-surface); color: var(--color-text);}