Let a bot take any colour

A bot's identity was one of seven hues, and the hue picked both its colour
and its stone shape. Now its colour is free and its stone is its own:

- `bots.color` holds any `#rrggbb`, `bots.stone` the flat-cut shape it's
  drawn on. `bots.hue` stays as the palette column they replaced, read only
  as a fallback; `src/scripts/move-bot-colour-to-owners.ts` backfills an
  install from it (safe to rerun).
- `src/utils/bot-color.ts` is the only place a colour is validated or
  resolved (`resolveBotColor`/`resolveBotStone` carry the old hue forward,
  `botColorNeedsPaperFace` flips the eyes to paper on a very dark body), and
  `src/utils/bot-stone-props.ts` gives every row its props, so a row saved
  before this still renders as it did.
- `BotStone` takes the colour as the body's SVG `fill`, the one documented
  exception to the token rule: an arbitrary hex has no token to point at.
  `UnreadDot` follows it.
- The picker keeps the palette tiles (still shape and colour together) and
  adds a native swatch and a hex field, so a custom colour keeps its stone.
  Same place as before: the header avatar's modal and Settings > Bots, for
  crew managers. The coordinator stays hue-less.
- A recolour reaches other open tabs through `pushBotUpdated`.
This commit is contained in:
2026-10-22 11:55:36 +01:00
parent 2eccfe9e13
commit 1a6249afd3
59 changed files with 877 additions and 237 deletions
+52 -2
View File
@@ -1,40 +1,90 @@
/**
* Bot identity hues. A bot keeps its hue for life; a hue never means state.
* The coordinator has no hue.
* The palette a bot starts from: a suggested colour and the stone shape that
* goes with it. A bot's colour is free (any `#rrggbb`), so these are only
* the tiles the picker offers and the colours a new bot is given. Shape is
* stored separately (`bots.stone`), so a custom colour keeps its stone.
*/
export const BotHues = [
{
title: "Ember",
value: "ember",
color: "#e4572e",
},
{
title: "Amber",
value: "amber",
color: "#e9a23b",
},
{
title: "Moss",
value: "moss",
color: "#7fae3c",
},
{
title: "Teal",
value: "teal",
color: "#16a394",
},
{
title: "Cobalt",
value: "cobalt",
color: "#3b7dd8",
},
{
title: "Violet",
value: "violet",
color: "#7c5cd6",
},
{
title: "Rose",
value: "rose",
color: "#d6538c",
},
] as const;
/**
* Historical palette name. Kept for `bots.hue`, which is only read as a
* fallback for a bot saved before `color` and `stone` existed.
*/
export type BotHue = (typeof BotHues)[number]["value"];
/**
* The stone shapes. One flat cut each, from the handoff icon set. Shape is
* the bot's own, independent of its colour.
*/
export const BotStoneShapes = [
{
title: "Ember stone",
value: "ember",
},
{
title: "Amber stone",
value: "amber",
},
{
title: "Moss stone",
value: "moss",
},
{
title: "Teal stone",
value: "teal",
},
{
title: "Cobalt stone",
value: "cobalt",
},
{
title: "Violet stone",
value: "violet",
},
{
title: "Rose stone",
value: "rose",
},
] as const;
export type BotStoneShape = (typeof BotStoneShapes)[number]["value"];
export const BotKinds = [
{
title: "Worker",