We're designing a custom code theme which displays line numbers, and we're having some internal debate whether these line numbers need to meet WCAG AA contrast guidelines? They're not the main body text, but neither are they the acceptable exceptions outlined in the guidelines. My guess is that they should meet contrast guidelines, but I've seen many themes where the line numbers are very low contrast.

Could anyone point me to some research/guidelines on this?

  • Note that not every theme needs to meet contrast requirements. You should have a theme (hopefully the default) that meets contrast requirements for the line numbers and the main text but it's ok to have themes that don't meet contrast. There are some users that are distracted by too much contrast so having lower contrast is good for them. As long as you have plenty of themes to choose from and a way to customize them, you're ok. Feb 6, 2022 at 0:21

1 Answer 1


You already pointed at the relevant guidance, text contrast.

As the information is not presentational / incidental (it is essential information in a code editor, not there for decoration) it must comply with colour contrast requirements the same as any other text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.