feat: card cover colours (Phase 1 of #155)
Card cover colours (Phase 1 of #155)
Adds an optional cover colour to cards, rendered as a bar across the top of the card on both private and public boards. Set it from the card context menu → Set cover colour (palette swatches from @kan/shared), or clear back to none.
This is the lightweight, palette-based first phase of the theme-customisation request in #155 — no upload infrastructure needed. It deliberately complements @knom's #513 (board backgrounds): different field, different surface, no overlap. (Coordination on the issue: https://github.com/kanbn/kan/issues/155#issuecomment-4629076532)
What's in it
- db: nullable
card.coverColourCode(varchar(7)) + generated migration - api:
coverColourCodethreaded throughcard.updateinput → repo →cardDetail/boardDetailCardoutput schemas → board query selection - web: cover bar on
Card; newCardContextCoverColourModal(palette + clear) wired into the card context menu; optimistic update via the existinginvalidateCardpattern
Design notes
- Stores the palette hex (
#0d9488…) for consistency with how labels storecolourCode. - Bidirectional-safe:
nullclears,undefinedleaves untouched (mirrors the existingdueDatehandling incard.update). - Validation (
/^#[0-9a-fA-F]{6}$/) lives at the router boundary.
Verification
- ✅
@kan/db,@kan/apitypecheck clean;@kan/webintroduces zero new type errors vsmain(diffed against baseline). - ⏳ Not yet runtime-verified by me against a live instance — opening as draft for exactly that reason. Happy to add a screenshot / screen-recording and any UX adjustments. Feedback on the picker UX welcome.
Closes part of #155 (Phase 1; cover images and board-level options tracked separately).
Verified locally against a running instance (Next dev + Postgres):
- Render path: cards with a
coverColourCodeshow the colour bar across the top on the board (seeded a teal card directly in the DB → rendered correctly). - Setter path: right-click card → Set cover colour → picked Orange from the palette → the
card.updatemutation persisted#ea580cand the bar re-rendered immediately. - Picker is the palette-swatch UX from
@kan/shared(clear/none option + the 8 shared colours).
Screenshots to follow. Will flip out of draft once they're attached.
Hey @nickmeinhold, I love the work you're doing here!
Why not move to the general of concept of a settings menu and a popup dialog. Like I also did for board, same would make sense for card!
A central place for item related configuration like also color..
What's your thoughts on that?
Screenshots from the local verification run:
Thanks @knom, really appreciate the enthusiasm, and I think you're onto something for the longer term.
Before either of us invests more, I think this is worth a maintainer steer so we build to the project's convention.
Cards already have two config surfaces today: the per-action context-menu items (Manage members, Add / edit label, Set due date), each opening a focused modal, plus the full card detail view where description, labels, members and due date are edited. So unlike boards (which had no config hub, which is exactly why your board settings dialog made sense there), cards already have a "central place".
That makes the cover-colour placement a genuine convention question:
- A: keep it as a focused context action alongside the existing card-context items (what #515 does now)
- B: a unified card settings dialog mirroring board settings, with colour as one section
- C: fold card visual settings into the existing card detail view rather than a new dialog
@hjball, do you have a preference for how card-level configuration should be organised? Happy to shape #515 to match whatever direction you want, and it'd keep knom's #513 and this PR consistent with each other.
And @knom, separately from all the design back-and-forth: it's genuinely great to be collaborating on this with you. Two complementary PRs landing side by side, feedback flowing both ways, this is open source at its best. Looking forward to seeing where it goes.
Same here! This is fun 😉