Answer the question
In order to leave comments, you need to log in
Switching styles on a button?
Good afternoon!
The site on Bitrix, I would like to implement a dark mode on the site, with saving the mode in cookies, so that when the page is reloaded, when moving to another directory, the style does not change.
This one turned out to be the most successful for me https://github.com/sandoche/Darkmode.js
But as I didn’t crawl, I couldn’t set the body color stubbornly puts #000000 in dody and that’s it, forcibly not mix-blend-mode: difference; not background-color: #222222 !important; they don't help, hands down..
It is convenient because in your style.css you can write like this
.darkmode--activated h3 {
color: #222222;
}
And it will be triggered by onclick="darkmode.toggle();" on the button.
Maybe someone who used it can help or maybe there is a more elegant similar method?
Answer the question
In order to leave comments, you need to log in
Well, you're just like helpless children, the right word.
We open the sources (there are only two files) and almost from the first lines we see how everything is arranged there. The variable you need is mixColor
.
But it’s not black there, but even white at all, because in fact there is not a color change body
, but an overlay div
with a class darkmode-layer
on top of everything in the mode: .
Here you yourself select the desired color with the desired blending mode. mix-blend-mode: difference;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question