Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement proposal: Theme-Specific Image Display #521

Open
martyanovandrey opened this issue Sep 23, 2024 · 0 comments
Open

Enhancement proposal: Theme-Specific Image Display #521

martyanovandrey opened this issue Sep 23, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@martyanovandrey
Copy link
Contributor

Problem

The current YFM syntax does not support the capability to display different images based on the user's selected theme (light or dark). This proposal introduces an enhancement to the YFM syntax, enabling content creators to specify distinct images for light and dark themes. This will enhance the user experience by ensuring images are appropriately visible and contextually suitable based on the selected theme.

Existing Implementation Reference

GitHub has implemented a similar feature, as detailed in the GitHub Blog Changelog.

Proposed Syntax and Implementation

CSS Styling

To facilitate this feature, specific CSS rules will be required to handle the visibility of images based on the data-theme attribute.

[data-theme='light'] img[src$='#dark-mode-only'],
[data-theme='dark'] img[src$='#light-mode-only'] {
  display: none;
}

YFM Syntax

![Themed image](/_assets/image.svg#light-mode-only)![Themed image](/_assets/image.svg#dark-mode-only)
@martyanovandrey martyanovandrey changed the title Proposal for YFM Syntax Enhancement: Theme-Specific Image Display Enhancement proposal: Theme-Specific Image Display Sep 23, 2024
@martyanovandrey martyanovandrey added easy enhancement New feature or request labels Sep 23, 2024
@martyanovandrey martyanovandrey moved this to Todo in Help wanted Oct 2, 2024
@martyanovandrey martyanovandrey added the good first issue Good for newcomers label Oct 16, 2024
@martyanovandrey martyanovandrey moved this from Todo to In progress in Help wanted Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: In progress
Development

No branches or pull requests

1 participant