update-default-theme
Skill527 starsChanged 4 months agoMITView on GitHub
Update the app's default theme colors (accent, background, primary, highlights) consistently across every place a default is hardcoded. Use when changing the default accent/background/highlight colors so no surface (portaled modals, emails, presets, CSS fallbacks) drifts out of sync.
In this repository12 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- blueprint-generateSkill
- blueprintSkill
- domain-settingsSkill
- leaflet-ai-apiSkill
- lexiconsSkill
- mirror-editor-block-stylesSkill
- notificationsSkill
- publication-settingsSkill
- specSkill
- tests-postsSkill
- tests-subscribeSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 25
Treat these two files as the source of truth.
- Distinctive: line 33
Keep these two in agreement with each other first, then propagate outward.
- Distinctive: line 71
Leave these alone — they are intentional, context-specific, not the global default:
- Very specific: line 84
Verify nothing stale remains — grep for the *old* values across --include *.css/*.ts/*.tsx (excluding node_modules and .next) to catch any …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Update Default Theme
The default theme (currently green accent #57822B on off-white #FDFCFA) is
hardcoded in several disconnected places. There is no single constant that all of
them import, so changing one leaves the others stale. The classic symptom: a
portaled surface (a Radix Dialog modal like DiscussionModal) escapes the
local BaseThemeProvider wrapper and falls back to the :root CSS defaults —
if those weren't updated, the modal shows the old colors while everything else
shows the new ones.
When to use
The user wants to change what the default theme looks like — the default accent, background, primary text, or highlighter colors — and wants it applied everywhere. Also use it as a consistency audit after any theme-default edit.
The canonical values
Treat these two files as the source of truth. Everything else must match them:
components/ThemeManager/themeDefaults.ts—PubThemeDefaults(hex) andPubThemeDefaultsRGB(parsed RGB). Used by publication records andcreatePublication.ts.components/ThemeManager/themeUtils.ts—ThemeDefaults(labeled "the color defaults for everything"). Used by leaflet/useColorAttributefallbacks.
Keep these two in agreement with each other first, then propagate outward.
Current default: accent-background/accent-contrast #57822B (rgb 87, 130, 43),
accent-text #FFFFFF, background #FDFCFA (rgb 253, 252, 250), primary
#272727 (rgb 39, 39, 39), highlight-2 #EDD280 (rgb 237, 210, 128),
highlight-3 #FFCDC3 (rgb 255, 205, 195). Highlight-1 has no fixed value — its
default is a computed tint: color-mix(in oklab, rgb(var(--accent-contrast)),
rgb(var(--bg-page)) 75%).
Every place to update (the checklist)
Work through all of these. Each stores the same defaults in a different format,
so convert accordingly (hex ↔ r, g, b triple ↔ rgb(r, g, b) string).
components/ThemeManager/themeDefaults.ts—PubThemeDefaults(hex) andPubThemeDefaultsRGB({ r, g, b }). Keep both in sync with each other.components/ThemeManager/themeUtils.ts—ThemeDefaultsmap (theme/page-background,theme/card-background,theme/primary,theme/accent-background,theme/accent-text,theme/accent-contrast,theme/highlight-1..3).app/globals.css— the@layer base { :root { ... } }block. This is the fallback for anything rendered outside aBaseThemeProvider(portaled modals/overlays). Values are barer, g, btriples:--bg-leaflet,--bg-page,--primary,--accent-1,--accent-2,--accent-contrast,--highlight-2,--highlight-3.--highlight-1is thecolor-mix(...)expression, not a triple — matchBaseThemeProvider's runtime fallback. Note--bg-leaflet= outer/page background (#FDFCFA),--bg-page= card (#FFFFFF).emails/shared.tsx—defaultEmailTheme(hex strings) and the@react-emailtailwindcolorsblock lower in the same file. Gmail stripscolor-mix(), sohighlight-1here must be a literal rgb resolved via the same mathmixRgb/defaultHighlightBackgrounduses:mixRgb(accent, pageBackground, 75)— a simple sRGB lerp (accent*0.25 + bg*0.75). For#57822Bon white that isrgb(213, 224, 202).components/ThemeManager/PubPickers/PubPresetPicker.tsx— the preset named"Default"(hex). Itsaccent1/bgLeaflet/bgPagemust equal the canonical default (watch for near-miss values like#57821Evs#57822B).
Leave these alone — they are intentional, context-specific, not the global default:
StandalonePageBackground = "#FFFFFF"inPublicationThemeProvider.tsx(standalone-doc page bg, mirrors the editor default).- Other named presets in
PubPresetPicker.tsx(Minimal, Bookish, Colorful, …).
Process
- Decide the new canonical values with the user (accent, background, primary, highlights). Express each as hex first.
- Edit files 1 and 2 (the source of truth). Convert hex → RGB triples for the
RGB/CSS variants. - Propagate to files 3–5, converting to each file's format.
- Verify nothing stale remains — grep for the old values across
--include*.css/*.ts/*.tsx(excludingnode_modulesand.next) to catch any leftover copies:grep -rn "OLD_HEX\|OLD_R, *OLD_G, *OLD_B\|rgb(OLD_R, OLD_G, OLD_B)" \ --include="*.css" --include="*.ts" --include="*.tsx" . \ | grep -vE "node_modules|\.next" - Sanity-check the CSS parses:
node -e "const l=require('lightningcss'),fs=require('fs');l.transform({filename:'app/globals.css',code:fs.readFileSync('app/globals.css'),minify:false});console.log('css ok')" - Report the full list of files changed so the user can confirm coverage.
Why this is fragile (context for the reader)
The runtime theme system reads the source-of-truth constants and writes CSS
variables onto the BaseThemeProvider wrapper (local mode) or :root
(non-local). Portals, emails, and presets each re-declare the defaults in their
own format because they render outside that runtime path. There is no shared
import binding them, so the only guard against drift is updating every entry in
the checklist together.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

