Skip to content

rustdoc: brighten/darken link colors based on background color #93230

Closed
@jsha

Description

@jsha

The readability of text depends in part on its contrast relative to the background. For instance, in the light theme:

image

image

image

You can see that the contrast ratio is different depending on the background. Against a white background it's 4.97. Against a grey background it's 4.56. Not a huge difference, but noticeable. For reference, the WCAG guideline is that text should have a contrast ratio of at least 4.56.

We should pick an alternate link color that maintains the same contrast ratio when placed against the grey backgrounds we use (code highlighting and sidebar).

The same concept applies to the dark theme, in reverse - the link color should be brightened when it is against a lighter background, so it stays equally visible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions