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

💄 Dark and Light Image Variants #2225

Open
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

hayesall
Copy link

@hayesall hayesall commented Oct 22, 2023

This picks up pull request #1991 but implements a different light/dark mode variant that should be easier in markdown.

Writers can append #only-light or #only-dark to the end of an image path:

![rust logo standard edition](images/rust-logo-blk.svg#only-light)
![rust logo dark mode](images/rust-logo-blk-dark.svg#only-dark)

... which renders:

short-dark-light-mode-variant-demo.mp4

@rustbot rustbot added the S-waiting-on-review Status: waiting on a review label Oct 22, 2023
This had incremental work toward an image variant solution
This reverts commit 3d4721f.

I'm trying to get the diffs smaller. It looks like someone previously
committed code that did not strip extra spaces from the ends of lines
with their editor.
@ehuss
Copy link
Contributor

ehuss commented Nov 29, 2023

Thanks, this looks interesting!

I'm a little concerned about hard-coding the themes, as this won't work if the user adds their own themes. The general.css file should not have any theme values in it. Is it at all possible to make it so that the CSS rules can be based on the color-scheme of the theme? My quick searching didn't turn up anything useful, but perhaps the color-scheme could be exposed as a data attribute on the root tag? That might be a little more complex than this solution since the javascript code would need to update it when it updates the class list. I'm just wondering what kinds of options there are.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: waiting on a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants