Skip to content

Change color function to check for relative luminance

What does this MR do and why?

Changes color function to check for relative luminance. Until now we just calculated the sum of the RGB value and checked if it is higher than a value of 500 which seems not a very safe way in doing so. This MR changes the color function to use the relative luminance calculation from WCAG.

Note it doesn't always lead to a 3:1 contrast ratio. As this method uses relative luminance it should fully comply with APCA, which is set to be used for WCAG 3.0.

Note: We decided to not use APCA at this point, see gitlab-ui!3418 (comment 1370107090) for more information.

Screenshots or screen recordings

Before After
_before after

How to set up and validate locally

  1. Check labels in GDK, e.g.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sascha Eggenberger

Merge request reports

Loading