Skip to content

add GitHub themes - #480

Merged
martin-mfg merged 10 commits into
masterfrom
light-dark-themes-code
Aug 14, 2026
Merged

add GitHub themes#480
martin-mfg merged 10 commits into
masterfrom
light-dark-themes-code

Conversation

@martin-mfg

Copy link
Copy Markdown
Member

This is only the code part of #457.
Documentation from that PR will be merged later, as explained there.

martin-mfg and others added 10 commits August 5, 2026 22:22
Found while reviewing #457.

1. Dark themes rendered a near-white border.
`dark_github` / `dark_github_repocard` had no `border_color` and fell
back to the default theme's `e4e2e2`.
Set GitHub's borders on all four new themes: `d1d9e0` light, `3d444d`
dark.

2. Excluding `default` / `default_repocard` broke the theme picker.
`Home.tsx` initializes to one of them and treats it as "emit no `theme=`
param", so stage 3 opened with nothing selected and the theme-less URL
became unreachable.

3. Paired themes were shown for the wrong card type.
The picker now takes `isRepoCard` and lists only the matching variant,
hiding duplicates while keeping each card type's `default` visible.

4. Theme README generator only knew the `default` pair, so the new
themes would land in the wrong tables.

5. 3 and 4 share a rule, kept duplicated on purpose: which themes to
advertise per card type is presentation, not rendering, so it stays out
of core's API.
   Both copies carry `Keep in sync` comments pointing at each other.

6. Dead docs anchor left by the `Responsive Card Theme` ➡️ `Light and
Dark Mode` rename.

7. Core gains one export: the `ThemeName` type, replacing the private
duplicate `ThemeNames` in `cards/types.ts` and the `keyof typeof themes`
casts in `color.ts` and the picker.
…gory (#464)

Two places independently hardcoded the same "is this a repo or gist
card?" check:

- `Home.tsx`: which theme variant to default to
- `Customize.tsx`: whether to offer "Show Owner?"

Both now derive it from one map in `models/CardType.ts`:

```ts
export const CardCategory = { REPO: "repo", USER: "user" } as const;

export const CATEGORY_BY_CARD_TYPE: Record<CardType, CardCategory> = { ... };
```

A new card type won't compile until it's categorised, instead of
silently falling into the non-repo branch like the boolean did.
It also leaves room for another category, if we ever need one that
changes the data a card requires.

Also:

- `ThemeStage` takes `category` instead of `isRepoCard`.
- `getDefaultTheme` / `onThemeChange` use core's `ThemeName` instead of
`string`.
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
github-stats-extended-backend Ready Ready Preview Aug 14, 2026 9:24pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
github-stats-extended-frontend Ignored Ignored Aug 14, 2026 9:24pm

Request Review

@martin-mfg
martin-mfg merged commit 480c26b into master Aug 14, 2026
12 checks passed
@martin-mfg
martin-mfg deleted the light-dark-themes-code branch August 14, 2026 21:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants