Skip to content

Line highlight color against background color does not meet WCAG (3:1) #36

@gabalafou

Description

@gabalafou

I think this might be an issue for all of the themes under this repo but this is definitely an issue for a11y-light.

Between the background color of the code block and the background color of a highlighted line, WCAG guidelines require that the contrast ratio between those two to be 3:1, but it's much less.

I suspect that it's not possible (or very hard) to find a color palette that meets the following three criteria:

  • 8 different text colors that contrast at least 4.5:1 against the background color
  • Those same colors contrast 4.5:1 against the line highlight color
  • The line highlight color contrasts 3:1 against the background color

Eric Bailey's solution was to put a top and bottom border on highlighted lines. We could do the same thing but we would have to modify the CSS that we get back from Pygments, which we already do in the generate_css() function in utils.py.

Originally posted by @gabalafou in #33 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions