Skip to content

Figure out what is wrong with our SASS contrastRatio() function in dark mode #2916

@cchaos

Description

@cchaos

When the second parameter (background color) is darker than the first color, the function seems to calculate the wrong contrast ratio.

Example:

@debug(contrastRatio(#1BA9F5, #1D1E24));

returns

DEBUG: 3.91853

However, every other method of testing contrast says that it is 6.4:

Screen Shot 2020-02-24 at 18 06 50 PM

Screen Shot 2020-02-24 at 18 07 02 PM

Screen Shot 2020-02-24 at 18 10 41 PM

Screen Shot 2020-02-24 at 18 18 43 PM

https://snook.ca/technical/colour_contrast/colour.html#fg=1BA9F5,bg=1D1E24

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions