Laika icon indicating copy to clipboard operation
Laika copied to clipboard

Dark Mode Toggle

Open j-mie6 opened this issue 2 years ago • 5 comments

It would be nice if a toggle button for dark mode could be supported for HTML. As I understand it, the use of dark mode or not is dependent on your operating system or browser configuration, which works great, but it would also be nice if the user can toggle it on and off on a per-case basis: just like in scala3doc!

j-mie6 avatar Mar 09 '23 21:03 j-mie6

How do you see persisting this choice from page to page? Would the site need to use something like a cookie, and would this make a cookie acknowledgement widget necessary?

Sailsman63 avatar Mar 26 '23 04:03 Sailsman63

Taking inspiration from Scala3doc, we should be able to achieve this purely client-side with localStorage!

roccojiang avatar Mar 26 '23 19:03 roccojiang

That still leaves the question about whether user notification/acknowledgement is required. While localStorage is technically not a cookie, so-called "cookie laws" generally use language like "Store or retrieve data from a user's device". Not sure if this would count as "necessary to provide a requested service", which is commonly listed as an exception to the notice requirements.

Sailsman63 avatar Mar 26 '23 20:03 Sailsman63

Does scala3doc ask for permission?

j-mie6 avatar Mar 26 '23 20:03 j-mie6

Scala3doc doesn't ask for permission. There's some good discussion on the matter at https://github.com/themesberg/flowbite-react/issues/546, and while they removed the use of localStorage in the end, it seems that the general consensus was that it's not a GDPR violation, given that it is required for the website to function (i.e. keep colour preference while browsing) and stores no user-identifiable data. Thoughts?

roccojiang avatar Mar 26 '23 20:03 roccojiang