w3c provides web standards around accessibility. The nature of our rendering issues might be similar to accessibility issues (when using a dark theme in the web browser level for accessibility purposes). We can investigate if there is any sustainable solution/tooling that exists for dark theme rendering issues in the ecosystem that we could re-use.
|Open||None||T286643 [EPIC] Systematic solution on preventing rendering issues on user styles between dark/light themes|
|Resolved||vadim-kovalenko||T290568 [spike] Use w3c accessibility standards to detect readability issues with dark themes|
Theme issues appears because of the wrong contrast ratio value for elements. From wiki:
The contrast ratio (CR) is a property of a display system, defined as the ratio of the luminance of the brightest shade (white) to that of the darkest shade (black) that the system is capable of producing
Contrast ratio calculation algorithm based on this functionality:
- Consider contrast requirements for text with small font size ( <18pt or >=14pt bold ) and big font size ( >=18pt ). Satisfying these requirements is needed to reach AA and AAA level of conformance. 
These requirements based on WCAG ( Web Content Accessibility Guidelines )  
This table represents contrast ratio that need to be achieved:
|Small text ( <18pt or >=14pt bold )||4:5:1||7:1|
|Big text ( >=18pt )||3:1||4:5:1|
Note from :
For CJK languages ( Chinese, Japanese, and Korean ) the "equivalent" sizes would be the minimum large print size used for those languages and the next larger standard large print size.
- Calculate relative luminance for background and foreground using formula: L = 0.2126 * R + 0.7152 * G + 0.0722 
- Calculate contrast ratio using both background/foreground relative luminance: CR = (L1 + 0.05) / (L2 + 0.05) 
- Use CR value as a filter value to notify users about uncomformance design
 - WCAG 2.0 - Conformance requirements ( link )
 - WCAG 2.0 '4:5:1' contrast criteria calculation ( link )
 - WCAG 2.1 Contrast minimum ( link )
 - WCAG 2.1 Large scale (text) ( link )
 - WCAG 2.1 Relative luminance (link)
 - WCAG 2.1 Contrast ration definition ( link )
Also: useful article ( link ).