Skip to content

How to implement dark mode toggle? #1789

Answered by MuhammedKpln
hexdecimal16 asked this question in Q&A
Discussion options

You must be logged in to vote

Using schemes.

You'll need a custom theme colors for each theme

Colors.loadSchemes({
  light: {
    screenBG: 'transparent',
    textColor: Colors.grey10,
    moonOrSun: Colors.yellow30,
    mountainForeground: Colors.green30,
    mountainBackground: Colors.green50
  },
  dark: {
    screenBG: Colors.grey10,
    textColor: Colors.white,
    moonOrSun: Colors.grey80,
    mountainForeground: Colors.violet10,
    mountainBackground: Colors.violet20
  }
});

Then afterwards you can use

Colors.setScheme('dark/light')

For toggling between dark mode

Replies: 1 comment 1 reply

Comment options

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

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