unsolicited advice to avoid JavaScript, if desired
Hover or focus to reveal
Sensitive
@neineon77@transfem.social you can achieve this with pure CSS, assuming u merely want it use the browser's preference, i.e, instead of:
background: #FFFFFF;you can do:
background: light-dark(#FFFFFF, #000000);first argument to the function is the color to use in light mode, and second is the color to use in dark mode, this works in most modern browsers these days
if ur using CSS variables you can also merely do a media query and adjust them, i.e:
:root {
--background: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
:root {
--background: #000000;
}
}and if it's because you want a manual toggle, you can use CSS queries and simply have an somewhere, and apply the dark colors like so (assuming the input has a dark-mode class on it):
:root:has(.dark-mode:checked) {
--background: #000000;
}though keep in mind the toggle's state isn't remembered between refreshes...
unless absolutely desired, i would recommend merely following what the browser says it wants, as that's what most users expect
1
4
0
Trebetheric
@trebetheric@mastodonapp.uk
Ⓥ∞ = ☮&❤️ he/him I follow vegan leaders and young leaders. 🌱 I don't live with any any rodents. That I know of. I live vicariously through people here who post pics of rats and mice. Thanks! I stand with BLM, LGBTQ+
mastodonapp.uk
0
2
0
🎀 Степан Девятый (Великолепный) 🎀
@mansalia@shitpost.poridge.club
17 лет. Играю в программиста и девопса, хочу заработать много денег и купить частный дом. Балуюсь 3D графикой, лучшие из поделок лежат здесь: https://mansalia.com/3d.html Заядлый сторонник свободного ПО и опенсорса. Последний фанат фнафа в федивёрсе. ну кроме тех что рисуют порнушные арты. Я летаю по миру как птица, Ем огрызки и крошки клюю. И не надо, товарищи, злиться. Я на злость эту вашу плюю! За цифровое медиа не плачу ни копейки.🏴☠ Аминь.
shitpost.poridge.club
@waifu@mai.waifuism.life
is her shirt a #000000?
0
2
0
You've seen all posts