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: Thu, 23 Aug 2018 07:52:15 +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: Thu, 23 Aug 2018 05:52:17 -0000 (UTC) Injection-Info: csiph.com; posting-host="208-71-239-109.cust.centrio.cz:109.239.71.208"; logging-data="34437"; 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:35543 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. > 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 am working on https://www.aslint.org/. The code is not public yet, but I have a plan to publish it. -- Cezary Tomczyk http://www.ctomczyk.pl/