Skip to content

Changing image based on light and dark scheme selected #7078

Answered by kamilkrzyskow
glennlea1525 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @glennlea1525,
please provide a zip file with a more complete minimal reproduction. I tried to follow along with your explanation but I found myself guessing too much things.

I am aware of this requirement as I have custom colors (see below) but I do not know how to add it to the scheme:

So your custom scheme is green not custom-light. Also the provided custom scheme CSS is almost all white colors, so everything is white, and users can't see the buttons.

Here is an example with working images exclusion:

[data-md-color-scheme="green"] img[src$="#only-dark"],
[data-md-color-scheme="green"] img[src$="#gh-dark-mode-only"] {
  display: none; /* Hide dark images in light mode */
}

light…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@glennlea1525
Comment options

@kamilkrzyskow
Comment options

@glennlea1525
Comment options

Answer selected by glennlea1525
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants