Skip to content

toggle syntax highlighting when dark/light theme button toggled #108

Answered by kevinrpb
salmanhk asked this question in Support
Discussion options

You must be logged in to vote

Hi there! There is an easy way of doing this. In you syntax_darkmode.scss, you can enclose everything with a body.dark selector. That way when the body changes the class that enables dark mode your code highlighting will also change. E.g.:

// syntax_lightmode.scss

/* Background */ .chroma { background-color: #f8f8f8 }
/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
/* ... */
// syntax_darkmode.scss

body.dark {
  /* Background */ .chroma { color: #f8f8f2; background-color: #282a36 }
  /* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; }
}
/* ... */

Beware that you might need to tweak other things in dark mod…

Replies: 1 comment 3 replies

Comment options

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

@kevinrpb
Comment options

@salmanhk
Comment options

Answer selected by salmanhk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants