Skip to content

feat: Selection Colors / Document Colors パネル#61

Merged
Pregum merged 1 commit intomainfrom
feat/selection-colors
Apr 23, 2026
Merged

feat: Selection Colors / Document Colors パネル#61
Pregum merged 1 commit intomainfrom
feat/selection-colors

Conversation

@Pregum
Copy link
Copy Markdown
Owner

@Pregum Pregum commented Apr 23, 2026

Summary

Figma の Selection colors / Document colors と同等を追加。選択スコープ or ドキュメント全体の色を集計、swatch 一覧で Select / Replace できます。

UX

  • コマンドパレット "🎨 Selection / Document Colors" で起動
  • 選択がある → Selection Colors、無い → Document Colors
  • 各行に swatch + hex + 使用ノード数 + (fill / stroke) ラベル
  • Select ボタン: 同じ色を使う全ノードを一括選択
  • Replace (または swatch クリック) → ColorPicker popover → 一括置換

実装

  • collectSelectionColors / replaceColor は純関数として分離、12 件のユニットテストでカバー
  • 再帰的に frame children まで辿る
  • { type: "color", color: "..." } の object 形式と string 形式両方対応、大文字小文字を無視して match
  • ColorPicker は既存の popover を流用

Test plan

  • コマンドパレットから起動
  • 同じ色の複数 rect を選んで Select で全選択
  • Replace で赤 → 青に変えると全使用箇所で変わる
  • stroke.fill のみの色も検出される
  • ドキュメント全体モード(選択無し)で全色が出る
  • 275 tests pass

🤖 Generated with Claude Code

Figma の Selection colors と同等。選択セットがあればそのスコープ、
なければドキュメント全体の色を集計して一覧表示する。

- src/components/Viewer/SelectionColorsPanel.tsx 新規
  - fill / stroke.fill から色を抽出(ネストした color object も対応)
  - 利用ノード数でソートして表示、使用箇所 (fill / stroke) ラベル付き
  - Select ボタン: 同じ色を使う全ノードを選択
  - Replace ボタン: swatch クリック or Replace クリックで ColorPicker
    popover が開き、選んだ色でドキュメント全体を一括置換
- コマンドパレット "🎨 Selection / Document Colors" から起動
- collectSelectionColors / replaceColor は純関数として export
- 12 テスト追加 (合計 275 pass)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Pregum Pregum merged commit 77a5fea into main Apr 23, 2026
1 check passed
@Pregum Pregum deleted the feat/selection-colors branch April 23, 2026 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant