c4rlo / vimhelp

Google App Engine based project which regularly generates HTML versions of the Vim help files
https://vimhelp.org
MIT License
83 stars 9 forks source link

A basic html/css only dark mode #20

Closed MartinAskestad closed 1 year ago

MartinAskestad commented 1 year ago

I'm not the most frequent user of dark mode, but sometimes it's nice to have.

So I make a very basic dark mode, no JavaScript involved. Older browsers will ignore the dark mode and show the pages as usual. More modern browsers will use dark mode if the user has activated it in preferences.

Since the select2-dropdown doesn't seem to have a dark mode theme, I created a very simple css patch for it. image

c4rlo commented 1 year ago

Thank you for your contribution!

Dark mode is in fact next on my TODO list. But I was thinking of allowing the user to override the theme to either light or dark (with cookies or localStorage for persistence). By default, it would follow the browser/OS preference. This adds some complexity and will require JavaScript (though I'll make sure the site degrades gracefully if JavaScript is disabled, as is the case today).

I'd also like dark mode to be less harsh than pure white on pure black; possibly using an existing Vim dark theme.

So while I won't be merging this, I'll take it as motivation (time permitting) to go ahead with implementing dark mode as explained above.

As a workaround in the meantime, browser extensions like Stylus and Dark Reader may be of use.

c4rlo commented 1 year ago

Dark mode implemented. I based it on the existing "gruvbox" theme.