Whipped this up real quick... keeps the spirit of HN I think, and is pretty minimal. Not my best CSS but tables/current CSS make some selectors a little tricky and after all, it's less than 1kb added, no markup or stack changes needed, and this is 'Hacker News' right? :D
@media (prefers-color-scheme: dark) {
body { background-color: #1F2430; }
For those who want something more traditional I've modified to have a slight orange tint on the title bar, and higher contrast for text. Seems to be better for a11y too.
Please don't. Strong contrast helps readability; grey-on-color is lower contrast than white-on-color.
Most HN threads linking to a site that has light-grey-on-dark-grey or dark-grey-on-light-grey text have at least one (off-topic) complaint about site style. Let's not make HN one of those sites.
For me strong contrasts, especially on dark backgrounds, give me retina burns and eyestrain. I find pastel shades more comfortable. That said the grey text on white fad that happened a few years ago was a very silly idea.
I guess everyone's mileages vary depending on their eyesight, my eye's are 53 years old now and aren't as spritely as they used to be.
Great point. Our environmental factors are so easy to forget. I do use a very high contrast monitor and definitely prefer pastel colors at night, so my eyes dont hurt, but now I can clearly see how someone with low contrast wont' see a damn thing.
There is a solution, but it's a bit more complicated and requires introducing additional user preferences. Supply two color options in the css, and allow user to choose high/low brightness.
HN already has some profile filters, so adding one more might not be a problem, but I can also see how it becomes a slipper-slope of new features.
Most modern monitors (and operating systems for that matter) have functions for day and night colour temperature schemes. I use it a lot since I love reading in bed but don't want to give night blindness to my other half.
If the OS has it, you can set it to gradually phase in and out of the temperature change at a particular time. The Radeon drivers go one step further by understanding that as the year progresses, "night" and "day" happen at different times.
I have three Dell 24" panels dating from 2005/7 ( 1 x 2405FPW and 2 x 2407FPW). They're not really what you'd call "high contrast" these days given their age.
HN is currently "black on very light background". The equivalent dark mode would be "white on very dark background". I hope we end up with either that, or even better, white on a black background (because that would be great for devices with OLED screens, including many phones).
I agree, that level of white usually gives me eye strain after several minutes, even in a well lit room. The readability mode of Firefox for example uses #eeeeee for the text and #333333 for the background [1], I'd suggest using the same tones which are still very high contrast but don't cause nearly as much strain.
to preview, folks can live edit this page in inspector and paste these styles into a style tag.
in firefox, F12 to open inspector, hit '+' in the style pane to insert a <style> tag (but don't add a rule), then right click the inserted tag in the inspector pane and "edit as html" to edit the html, and finally paste these styles inside the tag and click out of it.
Yes there is much better way.
Install Stylus plugin and copy and paste the same script (except meta tag) with rule on domain.
And it just works fine across all instances of domain.
I tweaked and combined two existing Stylus entries called "Hacker News Readable" and "Hacker News Readable Dark" to make a layout that changes from light to dark mode with the system settings. https://jsfiddle.net/DHepworth/e4kwpr9j/2/
I just right clicked a few pages -> Save page as (static HTML/CSS/etc) then hack on the end of the news.css file. You can just append my css to that and you'll see exactly what I saw :)
Whipped this up real quick... keeps the spirit of HN I think, and is pretty minimal. Not my best CSS but tables/current CSS make some selectors a little tricky and after all, it's less than 1kb added, no markup or stack changes needed, and this is 'Hacker News' right? :D
@media (prefers-color-scheme: dark) { body { background-color: #1F2430; }
}Edit: missed a few on other pages! Added arrow CSS patch, added screenshot from imgur, added text input colors for profile and replies.