Why the syntax highlighting is not properly working when (legacy) night mode is turned on?

I am using this night mode addon and this syntax highlighting addon, it is not properly highlighting the code. Below is a screenshot of the same issue.

This happens on built-in night mode for me, too. I made it readable by darkening the background in dark mode in my card templates, like this:

.nightMode .highlight {
  background: #222222 !important;

(The !important is needed because the background color is hard-coded in a style attribute in the text of the cards, so otherwise that takes precedence over the CSS rule.)

Not sure if there is an equivalent to .nightMode in this legacy dark-mode add-on.


Thank you @sobjornstad it worked for me