Path: csiph.com!.POSTED.208-71-239-109.cust.centrio.cz!not-for-mail From: Cezary Tomczyk Newsgroups: comp.lang.javascript Subject: Re: Finding a real background color of an element Date: Fri, 24 Aug 2018 19:09:39 +0200 Organization: csiph.com Internet News Service Message-ID: References: <1ubqz126avwqd$.1ba1f0ac07trn$.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 24 Aug 2018 17:09:40 -0000 (UTC) Injection-Info: csiph.com; posting-host="208-71-239-109.cust.centrio.cz:109.239.71.208"; logging-data="29393"; mail-complaints-to="admin@kev009.com" User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.javascript:35545 On 23/08/2018 13:54, Julio Di Egidio wrote: > On Thursday, 23 August 2018 07:52:23 UTC+2, Cezary Tomczyk wrote: >> On 22/08/2018 20:37, Julio Di Egidio wrote: >>> On Wednesday, 22 August 2018 19:01:56 UTC+2, Cezary Tomczyk wrote: >>> >>>> That means to me that there is no reliable way to get a real background >>>> color of the HTML element. :/ >>> >>> Well, if you have control over it, do set a color and background color on >>> the body, that's required for accessibility anyway. When there is no such >>> information and one needs it, rather review your approach and expectations. >> >> The background and foreground color should be defined for the body, but >> mostly is not defined. In reality, I mean. > > Sometimes accessibility really doesn't matter (but then one would not lint for > accessibility anyway). In all other cases, I'd say no competent web programmer > can make that mistake: in our toolbox there is a minimal style just as there is > a minimal html... Yes, I share these thoughts "minimal style just as there is a minimal html...". >>> What is it that you are trying to build? Theming? A self-styling widget? >>> Otherwise what? There are solutions to every well-posed problem, as well as >>> there are ill-posed problems or solutions for no problem at all... >> >> I do calculate a contrast ratio and for that purpose I need background >> and foreground color. Currently, if I can't determine a background color >> for a particular element then I do skip contrast ratio calculation. > > I'd expect an accessibility linter to rather report it as a most basic and > most serious violation. Unfortunately none of known to me are reporting it. >> I am working on https://www.aslint.org/. The code is not public yet, but >> I have a plan to publish it. > > Not an easy one: accessibility requirements for a significant part rely on > subjective evaluation. So, it will be interesting to see what you come up > with... :) I think I'll include that case in the report to draw the attention. I think developers should be aware that if background can not be explicitly determined then they should fix it. :-) -- Cezary Tomczyk http://www.ctomczyk.pl/