fix(theme-classic): improve code block Copy/word-wrap button contrast (#10821)#12279
Open
gunjanjaswal wants to merge 1 commit into
Open
fix(theme-classic): improve code block Copy/word-wrap button contrast (#10821)#12279gunjanjaswal wants to merge 1 commit into
gunjanjaswal wants to merge 1 commit into
Conversation
…n hover The copy and word-wrap buttons on code blocks used a semi-transparent background (opacity 0.4) tinted with the code area's own color, so on hover the code behind them showed through and the icons were barely visible. Give the buttons an opaque neutral background and a slightly stronger border, and show them fully opaque on hover, so they read clearly in both light and dark themes. Closes facebook#10821
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
The "Copy" and "Toggle word wrap" buttons on code blocks are hard to see in the default classic theme. On hover they render at
opacity: 0.4over a background that matches the code area, so the code behind them shows through and the icons nearly vanish, especially over busy lines. That's #10821, where the low contrast was confirmed and an opaque background was suggested.Fix
In
CodeBlock/Buttons/styles.module.css:--ifm-color-emphasis-200) instead of the semi-transparent code-area color, so they read as a distinct chip instead of blending in.--ifm-color-emphasis-400) for a clearer edge.opacity: 1) instead of0.4, so the code no longer shows through them.--ifm-color-emphasis-300for clearer feedback.It all uses existing Infima tokens, so it adapts to light and dark themes and to custom theme colors without any hardcoded values. The buttons are still hidden at rest and only appear when you hover the code block, so nothing changes except that they are now legible.
Closes #10821