Skip to content

feat(badge): follow the reader's light or dark theme in images by default, on GitHub too - #227

Merged
vite-hub[bot] merged 1 commit into
mainfrom
feat/badge-auto-theme
Oct 26, 2026
Merged

vite-hub[bot] merged 1 commit into
mainfrom
feat/badge-auto-theme

Conversation

@onmax

@onmax onmax commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Image badges were always drawn light unless the URL asked for theme=dark, so the README's badges showed as white pills on GitHub's dark theme.

An image badge now carries both palettes by default (theme=auto): its colors live in a <style> with a prefers-color-scheme: dark block, and the layout is the same in both. Inside an <img>, that media query follows the color-scheme of the page around the image, which GitHub sets from the reader's GitHub theme, not the OS. So one Markdown line follows the theme on GitHub, npm, and the docs, with no <picture>. theme=light and theme=dark still lock a badge to one palette.

  • svg.ts: every color that changes with the theme is a class in one <style>, for all three styles. Status dots use the brighter tones on dark, as before.
  • server.ts: the CSP allows inline styles, so the badge still has its colors when someone opens badge.svg in a tab. GitHub's image proxy already sends style-src 'unsafe-inline'.
  • Builder: Auto is the default theme, and its preview shows the badge on a light half and a dark half.

Checked

  • Chromium and Firefox, with the page's color-scheme set the opposite way from the OS (as when someone forces GitHub dark on a light OS): the image follows the page every time, for http: and data: sources. WebKit wouldn't launch on this machine, so Safari isn't checked yet.
  • Every style × theme on light and dark backgrounds, in both engines.
  • The badges below come from this branch's preview deployment through GitHub's image proxy. Switch your GitHub theme to see them change.

@vite-hub

vite-hub Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Session Status Started Duration
Pending Completed Not started —
View session Last seen running 2026-10-26T19:28:19.837Z 2s

Latest result

Pull request merged.

Final answers

Session

Pull request merged.

Session

Waiting for GitHub merge request f260c046-905f-4da4-908c-8cdae0946f07.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

Session

Waiting for review checks before the next pass.

@pullfrog pullfrog Bot 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.

Important

Safari does not currently inherit an embedding element's color-scheme into an SVG image, so the new default cannot reliably follow a reader's selected GitHub theme there.

Reviewed changes reviewed the complete initial diff for the badge SVG theme default, hosted response policy, builder preview, tests, documentation, and agent reference.

  • Adaptive SVG paint moves theme-dependent colors into SVG-local CSS and adds auto, light, and dark behavior across all image badge styles.
  • Hosted badge policy permits the inline SVG stylesheet while retaining the restrictive default source and sandbox policy.
  • Builder preview makes Auto the default and shows the generated image under separate light and dark embedding contexts.
  • Public contract updates canonical parameters, package documentation, tests, and the Comark UI skill for the new default.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using gpt-5.6-sol | 𝕏

Comment thread packages/badge/docs/index.md Resolved
@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

comark-annotate

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-annotate@227

comark-badge

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-badge@227

comark-cards

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cards@227

comark-carousel

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-carousel@227

comark-cast

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cast@227

comark-charts

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-charts@227

comark-chat

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-chat@227

comark-chips

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-chips@227

comark-cjk

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-cjk@227

comark-code

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-code@227

comark-code-notes

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-code-notes@227

comark-colors

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-colors@227

comark-critic

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-critic@227

comark-deflist

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-deflist@227

comark-details

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-details@227

comark-diagrams

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-diagrams@227

comark-diff

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-diff@227

comark-embed

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-embed@227

comark-fields

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-fields@227

comark-figure

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-figure@227

comark-file-tree

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-file-tree@227

comark-footnotes

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-footnotes@227

comark-github

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-github@227

comark-icon

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-icon@227

comark-include

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-include@227

comark-keys

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-keys@227

comark-links

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-links@227

comark-linter

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-linter@227

comark-mark

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-mark@227

comark-mathml

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-mathml@227

comark-media

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-media@227

comark-metrics

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-metrics@227

comark-outline

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-outline@227

comark-properties

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-properties@227

comark-qr

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-qr@227

comark-quiz

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-quiz@227

comark-reading-time

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-reading-time@227

comark-sources

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-sources@227

comark-steps

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-steps@227

comark-table

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-table@227

comark-tabs

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-tabs@227

comark-tests

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-tests@227

comark-ui

pnpm add https://pkg.pr.new/onmax/comark-ui@227

comark-xref

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-xref@227

comark-zoom

pnpm add https://pkg.pr.new/onmax/comark-ui/comark-zoom@227

commit: 65ae47b

@vite-hub

vite-hub Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Pullfrog’s Safari finding is a valid P2 browser-compatibility documentation gap confirmed by the current SVG media query and open WebKit issue 316640; I’m declining a standalone documentation push under this PR’s repair policy, preserving the adaptive default and explicit light/dark overrides, and resolving the thread as non-blocking.

@vite-hub
vite-hub Bot merged commit 1286ed4 into main Oct 26, 2026
9 checks passed
@vite-hub
vite-hub Bot deleted the feat/badge-auto-theme branch October 26, 2026 19:32
This was referenced Oct 26, 2026
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.

1 participant