8000 feat: apply SVG prefers-color-scheme styles by theme by micahhausler · Pull Request #41 · qu8n/mddog · GitHub
[go: up one dir, main page]

Skip to content
< 10BC8 h1 class="lh-condensed inlineTitle__2vo_uR prc-Heading-Heading-MtWFE" data-component="Heading">feat: apply SVG prefers-color-scheme styles by theme - #41
Merged
qu8n merged 1 commit into
qu8n:mainfrom
micahhausler:svg-color-scheme
Dec 2, 2026
Merged

qu8n merged 1 commit into
qu8n:mainfrom
micahhausler:svg-color-scheme

Conversation

@micahhausler
@micahhausler micahhausler commented Dec 2, 2026 •
Copy link
Copy Markdown
Contributor

An SVG image with @media (prefers-color-scheme: …) styles now draws the palette that matches the theme's color-scheme, as a browser does. Closes #38. Builds on #40, so until that merges this PR also shows its commit.

  • A matching block's rules apply and a block for the other scheme is dropped. <style media="…"> is read the same way.
  • Other media queries, @supports, light-dark() and the color-scheme property stay skipped, as before.
  • Changing the theme draws the SVG again.
  • fixtures/color-scheme/logo.svg is one SVG with both palettes.

@micahhausler
micahhausler force-pushed the svg-color-scheme branch 3 times, most recently from 9561cac to e74a70d Compare December 2, 2026 06:50
@micahhausler
micahhausler marked this pull request as ready for review December 2, 2026 06:50
An SVG image's @media (prefers-color-scheme: dark) and (light) blocks
now apply when they match the theme's color-scheme, and a block for
the other scheme is dropped, so one SVG with both palettes draws the
right one. A <style media="..."> attribute is read the same way. Other
media queries stay skipped, as before.
@qu8n
qu8n force-pushed the svg-color-scheme branch from e74a70d to d0a075a Compare December 2, 2026 10:52
@qu8n
qu8n merged commit 80c4552 into qu8n:main Dec 2, 2026
5 checks passed
@micahhausler
micahhausler deleted the svg-color-scheme branch December 3, 2026 00:19
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.

Follow the terminal for light/dark, and pick the matching image variant

2 participants

0