본문으로 건너뛰기
cccskills
무료GitHub에 공개

color-picker

Use when implementing select colors with visual feedback.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md5.2 KB
  • references/pattern.md24.2 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Color Picker

Select colors with visual feedback

What it solves

A Color Picker is a form input component that allows users to select a color value through visual interaction. It may be implemented as a native browser control (<input type="color">), a custom swatch palette, a hex/RGB/HSL text input, a gradient spectrum canvas, or an eyedropper tool — or any combination of these. Color pickers are used wherever users need to choose or define colors: theme customization, design tools, annotation systems, data visualization category assignment, and product personalization.

When to use

  • Theme and brand customization – Let users choose accent colors for their dashboard or profile.
  • Design and creative tools – Drawing apps, slide editors, diagramming tools.
  • Data visualization – Assigning colors to categories in charts.
  • Product configuration – Choosing product color variants before purchase.
  • Annotation and markup – Highlight or pen color selection in document editors.

When to avoid

  • When colors are fixed options – Use a swatch selector or radio buttons with color swatches instead.
  • When the exact color value doesn't matter to the user – A simpler categorical selector ("Red", "Blue", "Green") reduces cognitive load.
  • In mobile-primary, simple forms – Native <input type="color"> may be sufficient; avoid heavy custom UIs on small screens.
  • When accessibility is paramount – Custom color pickers require significant a11y investment; evaluate whether simpler alternatives meet the need.

Implementation workflow

  1. Confirm the pattern matches the problem and constraints before copying the example.
  2. Start from the anatomy and examples in references/pattern.md, then choose the smallest viable variation.
  3. Apply accessibility, performance, and interaction guardrails before layering visual polish.
  4. Use the testing guidance to verify behavior across keyboard, screen reader, responsive, and failure scenarios.

Accessibility guardrails

Keyboard Interaction Pattern

KeyAction
Enter / SpaceOpens or closes the color picker panel when on the trigger
TabMoves focus through picker controls in order
Shift + TabMoves focus in reverse through picker controls
Arrow KeysNavigates through swatch grid (roving tabindex)
Arrow KeysAdjusts hue/saturation slider values by 1 step
Home / EndJumps to first/last swatch in a palette row
EscapeCloses the picker panel and returns focus to the trigger

Performance guardrails

  • Panel open time: < 100ms from click to visible
  • Swatch render: < 16ms for palette of up to 64 swatches
  • Hex parsing: < 1ms per keystroke
  • Canvas redraw: < 16ms per frame during drag on spectrum
  • Memory usage: < 10KB for swatch palette; < 50KB for full canvas picker

Common mistakes

Relying Solely on Canvas for Color Selection

The Problem: A canvas-only hue/saturation picker is completely inaccessible to keyboard and screen reader users. How to Fix It? Always pair canvas controls with equivalent range inputs or text inputs.

<!-- Good: keyboard-accessible hue control alongside canvas -->
<input
  type="range"
  min="0"
  max="360"
  value="217"
  aria-label="Hue"
  class="color-picker__hue-slider"
/>

Not Displaying the Selected Color Value

The Problem: Showing only a colored swatch without a hex/name label forces users to remember what they chose and breaks copy-paste workflows.

How to Fix It? Always display the current value as text.

<!-- Good -->
<button class="color-picker__trigger" style="background: #3b82f6" aria-label="Current color: #3b82f6">
</button>
<output class="color-picker__value" aria-live="polite">#3b82f6</output>

Not Handling Partial Hex Input

The Problem: Validating hex input on every keystroke while the user is typing causes premature error messages (e.g., error shown for #3b8 which is just incomplete).

How to Fix It? Validate only on blur or when the input matches the expected length.

hexInput.addEventListener('blur', () => {
  const isValid = /^#[0-9A-Fa-f]{6}$/.test(hexInput.value);
  hexInput.setAttribute('aria-invalid', String(!isValid));
});

Related patterns


For full implementation detail, examples, and testing notes, see references/pattern.md.

Pattern page: https://uxpatterns.dev/patterns/forms/color-picker

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

accordion

무료

Use when implementing expand and collapse content sections.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

Use when implementing user account configuration and preferences.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

Use when implementing social activity and updates stream.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

ai-chat

무료

Use when implementing conversational AI chat interfaces.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

Use when implementing handling AI-specific errors.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

Use when implementing loading states for AI operations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

thedaviddias/ux-patterns-for-developers2662026년 10월 5일 업데이트

thedaviddias의 스킬 모두 보기

이 스킬의 문제 신고