Skip to content

Switch SVG colors automatically in light/dark modes #7717

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

You must be logged in to vote

Hello @esynr3z,
as you've pointed out in the edit, to support the fill: currentColor for the SVG, they need to be included via the HTML <svg> tag.
SVGs are plain text files and you should be able to include them using the macros plugin.

But as you're working with simple shapes and only want to match the light/dark mode you can do so using CSS and the filter: invert setting to change the color from the default black to white.

This is used in the emoji search box in the docs, you can check the web tools.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@esynr3z
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by esynr3z
Comment options

You must be logged in to vote
0 replies
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
3 participants