Pixilab
Home › Companies › Show HN launch › A Dark Mode Toggle Without JavaScript

A Dark Mode Toggle Without JavaScript

Show HN: A Dark Mode Toggle Without JavaScript

A Dark Mode Toggle Without JavaScript operates in show hn launch.

Profile

Today I scratched my itch of implementing a dark mode toggle without JacaScript. The implementations I saw typically revolved about adding a 'dark' class to body via JS and then controlling it with JS handlers.Thanks to `:has()` selector [0], that passed 90% browser compatibility [1], it is possible to avoid JS.My implementation uses CSS variables combined with a checkbox, `:checked`, and `:has()`. It is simple, yet supports color scheme preference and updates toggle's label based on active mode.[0]: https://developer.mozilla.org/en-US/docs/Web/CSS/:has[1]: https://caniuse.com/css-has

As a business in show hn launch, A Dark Mode Toggle Without JavaScript is listed here with the public details available about it.

The company is listed at the Show HN launch stage of development.

SectorShow HN launch
StageShow HN launch

Website: tymekdev.github.io/no-js-dark-mode-toggle

Browse related

Emails and contact routes are reserved for registered members.
Create a free account