fix(theme): hover color for code links inside custom containers #3467
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Custom containers set a different text
color
for<a>
and<code>
elements, depending on the type of container.Currently the
a:hover
doesn't take account of a nestedcode
tag. There's an existing selector for.vp-doc a:hover > code
that setscolor: var(--vp-code-link-hover-color)
, which is ultimately one of the brand colors.Hovered code in a link ends up purple. This screenshot comes from the VitePress docs (the mouse cursor isn't shown):
In practice, this only currently impacts
warning
anddanger
containers, as the other containers use the main brand colors anyway. I've applied the same fix to all containers for consistency.I've used
a:hover > code
in the selectors, as that's what's used elsewhere, though I'm unsure whether the>
is really necessary. These selectors won't work with more complex markdown, such as[***`Example`***](foo)
, but I've tried to remain consistent with the existing selectors, which also don't handle this.