Feature request: color field type (native color picker)

Open
#445 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@mael50 is already working on this.

Since Oct 6, 2026.

  • #446 by @mael50 — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
html, typescript
Domain
frontend

Research direction

Read the existing field modules under fields/core/ and the registry in fields/registry.ts to understand how scalar fields are defined and registered. Then inspect the config schema and documentation entry points. Done means the color type supports the requested validation, editor, collection view, presets, and config documentation, with existing hex-string content remaining usable.

Written by the indexing model from the issue text.

Description

Summary

Add a color field type that renders the browser's native color picker, so editors can pick a color instead of typing a hex code into a string field.

Use case

Many static sites expose a few theme colors to non-technical editors (brand color, accent, section background…). Today the only option is a string field with a pattern, which means the editor has to know and type a hex code. A native color picker makes this much friendlier, and optional presets would keep editors within the brand palette.

Proposed config

- name: primaryColor
  label: Primary color
  type: color
  required: true
  options:
    alpha: false          # optional, default false: accept #RRGGBB only; true also accepts #RRGGBBAA
    presets:              # optional: swatches shown next to the picker
      - "#F47D42"
      - "#156082"

Values are stored as hex strings (e.g. "#F47D42"), normalized to lowercase or uppercase consistently, so existing string fields holding hex codes can be switched to type: color without migrating content.

Proposed implementation

Following the existing field module structure in fields/core/:

  • fields/core/color/index.tsx: Zod schema validating #RRGGBB (or #RRGGBBAA when alpha: true), required support, label.
  • fields/core/color/edit-component.tsx: native <input type="color"> next to a text input bound to the same value (to paste a hex code), plus optional preset swatches.
  • fields/core/color/view-component.tsx: small color swatch + hex code in collection views.
  • Register it in fields/registry.ts and add color to the config schema / docs.

No new dependency needed. list: true would work like other scalar fields.

Question

Would you accept a PR for this? I'm happy to implement it against development following CONTRIBUTING.md.

Dominant language
TypeScript
Stars
4.1k
Forks
564
Avg merge
8m
Merged PRs (30d)
5

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hunvreus/pagescms

All issues in hunvreus/pagescms

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.