Skip to content

add GitHub themes, document single card theming, light/dark cards in docs - #457

Open
martin-mfg wants to merge 8 commits into
masterfrom
light-dark-themes
Open

add GitHub themes, document single card theming, light/dark cards in docs#457
martin-mfg wants to merge 8 commits into
masterfrom
light-dark-themes

Conversation

@martin-mfg

Copy link
Copy Markdown
Member
  • add new themes light_github, dark_github, light_github_repocard, dark_github_repocard which exactly match GitHub's colors
    (I wonder why the existing themes don't match GitHub's colors. They also didn't back when they were added.)
  • add documentation for the new themes and for the support light & dark mode in one card PR
  • use dynamic light/dark cards in the docs

Note

Even after approval this PR should only be merged shortly before creating a new release. This avoid documenting a non-released feature, and also the usage of the new themes in our docs before they actually work. After the release I should check that the theming then works correctly in our docs.

@vercel

vercel Bot commented Aug 7, 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 9, 2026 2:47pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
github-stats-extended-frontend Ignored Ignored Aug 9, 2026 2:47pm

Request Review

@martin-mfg

Copy link
Copy Markdown
Member Author

Backend E2E test fails because of the problem described in #459.

@marcalexiei marcalexiei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened #462 with few fixes and improvements

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.
@martin-mfg

Copy link
Copy Markdown
Member Author

I have merged your suggestions unchanged, then added 1 commit on top with new changes from me.

@marcalexiei marcalexiei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Opened #464
    • replace isRepoCard boolean with a CardCategory type
    • refined return type of getDefaultTheme using the new ThemeName type

…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`.
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