カラーシステム
Caroa UIのカラートークンと使い方
概要
Caroa UIは一貫したカラーシステムを提供しています。すべてのカラーはCSS変数(--caroa-color-*)として定義されており、Tailwind CSSクラスから利用できます。
カラーパレット一覧
Black(黒)
Loading...
White(白)
Loading...
Sand(サンド)
Loading...
Ash(アッシュ)
Loading...
Fog(フォグ)
Loading...
Orange(オレンジ) - ブランドカラー
Loading...
Blue(ブルー)
Loading...
Purple(パープル)
Loading...
Turquoise(ターコイズ)
Loading...
Green(グリーン)
Loading...
Red(レッド)
Loading...
Yellow(イエロー)
Loading...
セマンティックカラー
セマンティックカラーは「意味」に基づいた色の定義です。生のカラートークン(orange-baseなど)を直接使わず、セマンティックカラー(primaryなど)を使うことで、テーマ変更や一括修正が容易になります。
基本原則
背景・テキスト系
ページ全体やコンテナの背景色に使います。
Loading...
アクション系
ボタンやインタラクティブ要素に使います。
Loading...
💡 accent と accent-action について
一般的なデザイン理論では「accent = 目立つ差し色」ですが、Caroa UIでは「温かみのある控えめな背景色」として定義しています。
accent (sand-light)
- 静的な背景色として使用
- ページ全体の背景、セクション背景、カードの背景など
- 落ち着いた雰囲気を演出し、白一色より温かみのある印象を与える
accent-action (sand-base)
- ユーザー操作に反応するインタラクティブな状態で使用
- ホバー時、選択状態、アクティブ状態、フォーカス状態など
- accentより少し濃い色で、操作可能であることや現在の状態を視覚的にフィードバック
状態・フィードバック系
ユーザーへのフィードバックや状態表示に使います。
Loading...
destructive と error の使い分け
destructive と error は同じ色(red-base)ですが、意味的に使い分けることで、コードの意図が明確になります。
| 用途 | 使用するトークン | 例 |
|---|---|---|
| 削除ボタン | destructive | <Button variant="destructive"> |
| 取り消せない操作 | destructive | 「完全に削除」ボタン |
| バリデーションエラー | error | text-error, border-error |
| フォームエラーメッセージ | error | <FieldError>, text-error |
| エラートースト | error | toast.error() |
状態色の使用例
Loading...
ボーダー・入力系
境界線やフォーム要素に使います。
Loading...
リンク・サイドバー系
Loading...
セマンティックカラー一覧(まとめ)
| セマンティック | 実際の色 | Tailwindクラス | 用途 |
|---|---|---|---|
background | white | bg-background | ページ背景 |
foreground | black-base | text-foreground | メインテキスト |
card | white | bg-card | カード背景 |
popover | white | bg-popover | ポップオーバー背景 |
primary | orange-base | bg-primary | ブランド、CTA |
base | black-base | bg-base | 通常のUI |
secondary | sand-base | bg-secondary | サブ要素 |
accent | sand-light | bg-accent | 温かみのある背景色。ページ背景やセクション背景など、落ち着いた雰囲気を演出する |
accent-action | sand-base | bg-accent-action | インタラクティブ状態の背景。ホバー、選択状態、アクティブ状態など、ユーザー操作に反応する要素に使用 |
muted | ash-light | bg-muted | 無効、補足 |
destructive | red-base | bg-destructive | 破壊的アクション(削除ボタンなど) |
error | red-base | text-error | エラー状態(destructiveのエイリアス) |
success | green-base | bg-success | 成功、完了 |
warning | yellow-base | bg-warning | 警告、注意 |
info | blue-base | bg-info | 情報、ヒント |
border | ash-light | border-border | ボーダー |
border-muted | ash-light / 0.8 | border-border-muted | 薄めのボーダー |
input | ash-light | border-input | 入力ボーダー |
ring | fog-dark | ring-ring | フォーカスリング |
link | blue-dark | text-link | リンク |
sidebar | white | bg-sidebar | サイドバー背景 |
sidebar-accent | sand-light | bg-sidebar-accent | サイドバーハイライト |
コンポーネントでの使い方
Buttonのカラーバリアント
Loading...
Tailwind CSSでの使い方
CSS変数
すべてのカラートークンは--caroa-color-*形式のCSS変数として利用可能です。
useAutoThemeフック
テーマカラーを動的に変更するためのフックです。