Skip to content

Is there a "Dark Mode" toggle available? #221

Answered by yhatt
tianfanghan asked this question in Q&A
Discussion options

You must be logged in to vote

In Marp, the dark color scheme, called as invert, is a one of color variants of the built-in theme. So it just works by adding and removing invert class to each <section> elements.

<button onclick="document.querySelectorAll('section').forEach((e) => e.classList.toggle('invert'))">Toggle appearance</button>

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@tianfanghan
Comment options

@tianfanghan
Comment options

@tianfanghan
Comment options

@tianfanghan
Comment options

@yhatt
Comment options

Answer selected by yhatt
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