Repository navigation
fix(theme-classic): improve code block Copy/word-wrap button contrast (#10821) - #12279
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 meta#10821
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Gentle bump on this one. It's a small theme-classic fix to the code-block Copy and word-wrap buttons, still mergeable. The only red check is the Lighthouse budget, which is threshold-based rather than a regression from this change. Happy to rebase if it's drifted; flagging it's ready for a look whenever a maintainer has a moment. |
|
Friendly bump on this. The Copy and word-wrap buttons on code blocks render at |
|
Gentle ping on this one — it's been open a few months without a review yet. It's a small, self-contained |
|
Bumping this gently — it's sat a few weeks without a review. It's a small theme-classic fix for the code-block Copy button behaviour. The one red check is the Lighthouse report flake, unrelated to the change. Glad to rebase if it's drifted since. |
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