Feature request: color field type (native color picker)
Maintainers usually reply within 1 day
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#RRGGBBAAwhenalpha: true),requiredsupport,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.tsand addcolorto 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hunvreus/pagescms
-
Media browser returns "Not found" for repositories using the SHA-256 object formatPossibly taken @adamchodera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Hosted 3.0.1: email code sign-in fails for an invited collaborator ("code could not be verified")Open
Difficulty 3/5 1-2 days Newbie friendliness 52/100
hunvreus/pagescms#483 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
Maintainers usually reply within 1 day
All issues in hunvreus/pagescms
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Make the "%" unit spacing the same in the web and in A10Possibly taken @kragent66-glitch claimed this today. Openbug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
nextcloud-libraries/nextcloud-dialogs#2772 ·
Maintainers usually reply within 1 day
-
Editor: leave an uploaded or inserted image's alt text empty, so the preview asks for a descriptionOpen
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
sveltejs/svelte.dev#2417 ·
Maintainers usually reply within 1 day