d2phap / d2phap/ImageGlass

Feature Request: Support for Theme-Adaptive / Dynamic SVGs

Open
#2,163 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

🎯 feature
Dominant language
C#
Stars
14.4k
Forks
752
Avg merge
10d 14h
Merged PRs (30d)
1

Description

Windows OS version

Windows 11 24H2

ImageGlass version

ImageGlass 9.3.2.520 (Hotfix 2)

ImageGlass release

Classic

1️⃣ Describe the feature

ImageGlass currently supports viewing static SVG files, but it does not correctly render dynamic SVGs that use CSS or media queries to adapt to the system theme (e.g., light/dark mode). These SVGs often rely on prefers-color-scheme, currentColor, or embedded <style> blocks with CSS logic.

Problem:
When opening a theme-adaptive SVG in ImageGlass, the image is either rendered incorrectly or appears blank because dynamic CSS rules or theme-based styling is not applied. These types of SVGs are becoming more common on the web (e.g., PWA icons, logos, and design assets).

Example use cases:

  • SVGs using prefers-color-scheme: dark to switch colors
  • Logos that follow system accent color via currentColor
  • CSS-based animations or responsive design inside SVG

Proposal:
Improve the SVG rendering engine or pipeline in ImageGlass to support:

  • CSS styles within <style> tags
  • Media queries like prefers-color-scheme
  • Support for currentColor inheritance from the viewer background or user-defined setting

Alternatively, ImageGlass could optionally use a headless Chromium or web-rendering engine to render such SVGs as they appear in browsers.

Benefit:
This will allow ImageGlass to properly display modern, theme-aware SVGs and ensure compatibility with evolving design standards in both web and UI assets.

ChatGPT

Light

Image

Dark

Image

2️⃣ How to use feature

No response

3️⃣ Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the attached light and dark SVG examples and compare ImageGlass with browser rendering. Inspect the existing SVG rendering pipeline, then define how CSS styles, prefers-color-scheme, and currentColor should behave before choosing an implementation approach. Done means theme-adaptive SVGs render correctly without appearing blank.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.