Elektrine lite

← Feed

@kiru@gay.kiru.gay

Post #2269880

2026-05-09 07:15 UTC

@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

Replies (1)

  • @neineon77@transfem.social 2026-05-09 07:18

    @kiru@gay.kiru.gay thank you but I went with a js script anyway so there's a button to toggle, browsers with resist fingerprinting like librewolf set you to a light mode and you can't change that without disabling that feature

    Open ##2270299