Live data from Hacker News

Dear web developers: set the font color, too

luu.io

51–60 of 151 posts

Re: Dear web developers: set the font color, too

#51
post #41
post #35

I don't understand this article. The author is using something that manipulates the style of inputs to make them dark with light fonts... but only if the input isn't explicitly styled with either background-color or color . If they're going to be doing such hackery, just style both at the same time. Use JavaScript or something to ensure both are styled. This really isn't the developer's concern.

> he author is using something that manipulates the style of inputs to make them dark with light fonts > just style both at the same time That's exactly the point. The system by default sets both colors, though most browsers I've used allow the website to override the colors. In these cases, the websites only override one but not the other.

The system is failing to override the styles. This is an issue with the system not using more explicit selectors or not taking into account that their selectors will be overridden. In other words, the system has failed you.

Re: Dear web developers: set the font color, too

#52
post #4

Sure it's not an issue with whatever is doing that (hacky) dark mode CSS? Looking at the google example, they are setting the font color. It just doesn't look good when dark-mode CSS doesn't take the existing colors into account.

> Looking at the google example, they are setting the font color. It just doesn't look good when dark-mode CSS doesn't take the existing colors into account.

Did you read the accompanying text? What you've said is literally the exact opposite of what is happening.

Google's CSS is not taking the default system colours into account. All of these sites seem to be assuming that the default system colours, implemented by the OS, are black text and white backgrounds. There is no reason to assume this, and indeed this is not the case on a minority of machines. The author's system happens to use white text and black backgrounds. So do I. Others are using low-contrast grey-on-grey themes, still others have a variety of multicoloured themes.

The author is trying to spread awareness that this seemingly common assumption about default colours is wrong. Hopefully this awareness has reached at least one person (yourself) ;)

Re: Dear web developers: set the font color, too

#53

This is a real issue for me at times. I have a dark theme set in Gnome, because I want dark system windows, but lots of sites don't bother setting their colours properly, so if I open the Web UI for my Ubiquiti Router, or one of my switches, and try to select a drop-down, the background of it is dark, like my system theme, and the text is dark, so I can't see what I'm choosing. Other times, like if I'm entering text…

Would be cool, if websites would ask, if you like bright or dark website.

Re: Dear web developers: set the font color, too

#55

Earlier quoted context omitted.

What does that have to do with color and backgroundColor?

How does it not? The article even states: "Don't set the colors at all, let the browser use the system default color". If a developer wants to express some intent maybe utilizing something else other than color would resolve some of these issues. If I can develop without color a user can read without color https://github.com/maio/eink-emacs

The article even states: "Don't set the colors at all, let the browser use the system default color".

That’s just one of three options. Setting “both the background color AND font color” is another.

Also, the third option might give you a hint that the author’s tongue is in their cheek.

Re: Dear web developers: set the font color, too

#56

Earlier quoted context omitted.

Really? I might have to switch then.. I use Firefox and GNOME, and enabling one of the dark themes causes most forms on the web to become unusable because of this very issue.

I just tested Firefox on xfce and it shows the problem. Safari, Firefox, and Chrome on MacOS in dark mode do not have this problem. This appears to just be a Firefox on linux issue.

Firefox is doing what is technically the correct thing in using system colors text color and background when not specified.

Web developers are just not terribly competent. It should be obvious that setting text color but not text background is erroneous. Since expecting basic competence from web developers seems to be a losing battle several things suggest themselves.

- provide a gui option to select the theme/style to use for firefox separate from the gui. This is already possible at the command line.

- Explicitly check for text that is to close to the background wherein only one attribute is set and adjust the smartest solution

- Just ignore the users colors like chrome does.

Personally I have a dark gtk theme but run firefox with a light one because otherwise the web is unusable.

Re: Dear web developers: set the font color, too

#57

This is a real issue for me at times. I have a dark theme set in Gnome, because I want dark system windows, but lots of sites don't bother setting their colours properly, so if I open the Web UI for my Ubiquiti Router, or one of my switches, and try to select a drop-down, the background of it is dark, like my system theme, and the text is dark, so I can't see what I'm choosing. Other times, like if I'm entering text…

Would be cool, if websites would ask, if you like bright or dark website.

Do you want a pop up every time you browse a page?

Re: Dear web developers: set the font color, too

#58
post #4

Sure it's not an issue with whatever is doing that (hacky) dark mode CSS? Looking at the google example, they are setting the font color. It just doesn't look good when dark-mode CSS doesn't take the existing colors into account.

> Looking at the google example, they are setting the font color. It just doesn't look good when dark-mode CSS doesn't take the existing colors into account. Did you read the accompanying text? What you've said is literally the exact opposite of what is happening. Google's CSS is not taking the default system colours into account. All of these sites seem to be assuming that the default system colours, implemented by…

> The author is trying to spread awareness that this seemingly common assumption about default colours is wrong.

I guess I could've made that point more clear in the post. Thanks for your replies in this thread :)

Re: Dear web developers: set the font color, too

#59
post #50

Earlier quoted context omitted.

It is the developer's concern. If one layer of presentation sets either the foreground or background color, it also must set the other. The C in CSS is cascading. Different sets of rules can be applied with differing precedence. There's no spec that I'm aware of the states that black on white is the default user-agent styling. If your site is unusable with inverted colors, it's your site that's broken.

No, it isn't the developer's concern. You use cascading styles for a reason: so they can cascade. If I had to explicitly set the color, background color, font size, font weight, etc. everywhere, this would defeat the purpose of using CSS. It would bloat up stylesheets into giant download-speed-killing blobs.

Your website CSS is inheriting the system default CSS in a sense. If you're going to override one color, you should also override the other--or override neither.

Re: Dear web developers: set the font color, too

#60
post #3

Definitely agree accessibility is important going into 2019. Different users are going to be viewing a site with more screen readers, dark theme, and other alternative viewing options, very much like we saw with mobilegeddon and the advent of responsive design. I've seen the argument that this hurts the "intended web experience", but this can be solved by keeping up with modern CSS practices and crafting the experien…

I agree we need to give accessibility more priority and we likely will once the discrimination lawsuits start rolling in. But this isn't an accessibility issue. Nowhere in WCAG 2 will you find anything that explicitly outlines both color and background color need to defined in stylesheets.

This is for users who prefer dark themes who are overriding styles of websites incorrectly. It is a failing of the user's browser/OS for not explicitly overriding both background and color at the same time or neither. If every developer had to add in a color for the edge case that someone is overriding styles globally, then we'd be bloating stylesheets with extra unnecessary bytes.

Post reply on HN