sahin.io

All skills and agents

theme-system

The investor theme system on sahin.io/angel-investments — theme colors and ids in InvestorThemeContext, the --investor-* CSS variables (themeVars.ts, theme bootstrap script, themed public-page CSS), full-page hub views in client/src/components/views/*View.tsx, theme copy in content/themes/*.yaml, the gallery in ThemeSwitcher, and the no-VC-firm-logo rule. Use when adding, changing or removing a theme or hub view, touching theme colors, or styling chrome that must follow the active theme.

Source file
.claude/skills/theme-system/SKILL.md

Theme system

What it is

A visitor picks a design ("Change Design" gallery). The choice is a theme id, read from ?theme={id}, then localStorage["investor-theme"], else default. A theme has two parts: a six-color palette that recolors every page (hub, chrome, static and React pages) and, for some ids, a full-page hub view that replaces the default hub layout.

client/src/contexts/ThemeContext.tsx is a separate light/dark provider (ThemeProvider, useTheme, localStorage["theme"] when switchable); it is not the investor theme.

Files

File Role
client/src/contexts/InvestorThemeContext.tsx investorThemes (id → { id, name, description, emoji, colors: { background, foreground, primary, accent, card, border } }), InvestorThemeId, InvestorThemeProvider (deferStoredTheme on SSR), useInvestorTheme(), getThemeLogoUrl(); sets data-theme on <html> (removed for default)
content/shared/themes.yaml gallery copy, gallery groups (VC firm themes, Design Concepts, Classic), every theme's name + description by id, thumbnail previews → client/src/generated/copy/shared/themes.ts
content/themes/<theme>.yaml every word inside one hub view (e.g. a16z.yaml: heading, status map Live/Public/Acquired/Failed → the firm's words, filters) → client/src/generated/copy/themes/<theme>.ts; shared.ts and view-modes.ts are also generated there
client/src/components/views/*View.tsx hub views; props ViewProps (views/types.ts: companies, navigateToCompany, formatCurrency, statusColor, fg/bg/primary/card/border); shared parts in publicThemePrimitives.tsx. Default company order is always by valuation (owner, 2026-10-12): order lists with sortCompaniesByMarketCap from client/src/data/portfolioData.ts; alphabetical only behind an explicit sort control (sort === 'name' ? ... : rows). server/portfolio-default-order.test.ts fails on a default name sort. Rule text: standing-rules skill.
client/src/pages/Home.tsx THEME_VIEWS map (theme id → lazy view); THEME_VIEWS[themeId] replaces the default layout; only CardGridView ships in the hub bundle
client/src/components/ThemeSwitcher.tsx gallery modal (portal to document.body, MiniPreview thumbnails)
client/src/lib/companyBackdrops.ts companyPhoto(slug): the company's backdrop photograph from client/src/data/discovery-images.json, or undefined while it is a flat placeholder (placeholders). Real photographs come from pnpm backgrounds:render (scripts/render-company-backdrops.mjs, motifs in data/company-backdrop-prompts.yaml; steps in airtable-manus-sync → Additions)
client/src/lib/themeVars.ts tv(key) = var(--investor-<key>), tvMix(key, pct) = color-mix(...); all React chrome colors use these
server/publicReactDocument.ts themeBootstrapScript() (inline head script: applies stored/URL theme palette as --investor-* and data-theme, plus data-sidebar, before first paint), themedPublicPageCss() / buildThemedCssAsset() (static page CSS rescoped under :root[data-theme] .public-page, written as assets/public-page-theme-<hash>.css), themedColor()
client/src/contexts/ViewModeContext.tsx human vs agent view (useViewMode().isAgent)

Rules

  • No VC firm logos (owner rule): a firm theme copies the firm's layout, type and imagery style, never its logo or its name as a wordmark; Sahin's own mark goes in that slot. LOGO_URLS in InvestorThemeContext holds portfolio-company logos only. server/vc-theme-management.test.ts fails if a firm view renders the firm name as text.
  • Copy only in content/themes/*.yaml / themes.yaml (page-content-yaml); ids are code keys — rename in YAML name, never the id.
  • Views show only public fields: no private timing, stage or deal data, no portfolio-total widgets, no fabricated social metrics, no letter-avatar logo fallbacks (private-data-boundary; enforced in vc-theme-management.test.ts). Counts via summarizePortfolioStatus (portfolio-counts-single-source). First-person voice ("my portfolio").
  • One portfolio list per theme (owner, 2026-11-01: the plain list under a themed view is a "duplicate ... old design"). A full-page view that renders every public company goes in FULL_PORTFOLIO_THEMES (shared/fullPortfolioThemes.ts); the hub CSS then hides the whole #public-index block on that theme (headline, intro, company list, category, sub-category and investor chips; owner 2026-11-02: "remove Angel investor in 234 startups ... the part" from every theme). It stays in the HTML for crawlers; the default hub (cardGrid) keeps it. Such a view opens on its full list (Featured or Spotlight modes are a second click) and carries its own search/status/category filters in the theme's type. Since 2026-11-02 (owner: "remove the bottom design and improve the portfolio view in the top design") every hub theme view is on the list: a subset view keeps its featured strip and adds the full list below it. The filter row is the hub's own URL-backed state (filters in ViewProps), rendered by HubFilterRow (views/HubFilterRow.tsx) in the theme's skin; its words are filters in content/themes/shared.yaml, overridable per theme. No view keeps a private second filter state.
  • Every filter shows faceted counts (owner, 2026-11-04: "add counts in the dropdown items in parentheses (X); if there is a current selection, the rest of the selections should be dynamic"). Each option reads "Name (X)" (filters.optionCount in content/themes/shared.yaml), where X counts the companies the OTHER active filters, search included, leave. An option with none left drops out; the selected one stays at 0. Build a view's filters as FacetTests and its options with facetOptions / facetStatusOptions over facetRows(rows, tests, skip) (views/facets.ts); the hub does the same for HubFilters. server/filter-counts.test.ts guards. server/full-portfolio-themes.test.ts fails if a listed view slices its main list.
  • Chrome and public-page CSS must read --investor-* variables, never the visitor's stored theme at render time, so server HTML hydrates identically.
  • A theme follows the visitor across pages. The bootstrap script (themeBootstrapScript in server/publicReactDocument.ts) applies a valid ?theme= and stores it as investor-theme, so every link from a themed page opens themed (owner bug 2026-11-04: links from ?theme=sequoia lost the theme). server/public-react-document.test.ts runs the script to guard it.

Add a theme

  1. Add the entry to investorThemes (id, ...THEME_TEXT.<id>, emoji, six colors).
  2. Add name/description and its gallery group (and preview words) in content/shared/themes.yaml.
  3. For a full-page view: write content/themes/<id>.yaml, run node scripts/sync-site-copy-module.mjs, create client/src/components/views/<Name>View.tsx (accept ViewProps, import @/generated/copy/themes/<id>), register in THEME_VIEWS in Home.tsx.
  4. Add a gallery preview in ThemeSwitcher.tsx if it has a distinct layout. Every view lists every company: render <HubFilterRow filters={filters} shown={rows.length} …/> above the list and add the id to FULL_PORTFOLIO_THEMES.
  5. deploy-gate → ui-before-after (hub with ?theme=<id>, desktop and mobile) → ship-to-production.

Rebuild from scratch

  1. Palette registry + provider (InvestorThemeContext.tsx), themeVars.ts.
  2. Bootstrap script and themed CSS asset in server/publicReactDocument.ts; the build writes the asset and injects the script into every page (astro/layouts/Document.astro via preparePublicDocument()). Islands read the theme from the document (useInvestorTheme() without a provider: <html data-theme> + the investor-theme event; setDocumentTheme() changes it everywhere). astro/scripts/chrome.ts fetches the active theme's fonts on load.
  3. Gallery (ThemeSwitcher.tsx) + themes.yaml.
  4. Hub views + THEME_VIEWS, each with its content/themes/*.yaml.
  5. Gate, before/after screenshots, ship.

The angel-investor bar

Owner, 2026-11-01: the "#1 Most Active Angel Investor" bar (HubRecognitionBanner.tsx, shared by every theme) is one row from lg up, badge left and Lenny's quote right; it stacks only on narrow screens. After any change to it, check all themes at about 1100px with before/after screenshots (ui-before-after). A theme's own top menu is a per-theme choice; luxuryFashion has none.

Tests

server/vc-theme-management.test.ts, server/full-portfolio-themes.test.ts, server/shared-content.test.ts (themes.yaml names exactly the defined themes), server/public-react-document.test.ts (bootstrap/themed CSS), server/content-in-yaml.test.ts, server/logo-assets.test.ts.