use background property and custom vars for code block#1352
Conversation
…r blend mode and border
There was a problem hiding this comment.
Pull request overview
This PR updates the .line-highlight styling in Instructions.scss to use CSS custom properties for greater customization of code block line highlights. It also changes background-color to the background shorthand to remove color gradients, and applies minor formatting cleanups (hex color casing, spacing).
Changes:
- Replaces
background-colorwithbackgroundshorthand and makesmix-blend-modeconfigurable via--code-block-blend-modecustom property - Adds two new CSS custom properties (
--code-block-line-highlight-borderand--code-block-line-highlight-border-color) for customizing the inline-start border on highlighted lines - Minor formatting: lowercases hex colors and adds a space in a selector
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| mix-blend-mode: var(--code-block-blend-mode, difference); | ||
| min-inline-size: 100%; | ||
| border-inline-start: var(--code-block-line-highlight-border, none); | ||
| border-color: var(--code-block-line-highlight-border-color, none); |
There was a problem hiding this comment.
border-color: none is not valid CSS — the border-color property does not accept none as a value. When the browser encounters this, it will silently ignore the declaration. The fallback should be transparent instead of none.
Additionally, border-color is a physical shorthand that sets all four sides' colors (border-top-color, border-right-color, etc.), but it does not reliably override the color component of the logical border-inline-start property above it. To correctly override the inline-start border color, use border-inline-start-color instead of border-color.
| border-color: var(--code-block-line-highlight-border-color, none); | |
| border-inline-start-color: var(--code-block-line-highlight-border-color, transparent); |
uses the following vars for custom styling:
--code-block-blend-mode: set custom blend mode for highlighted lines of code in code blocks, defaults to
difference--code-block-line-highlight-border: allows setting border value for border-inline-start on code blocks. Used to add a bar to the start of a highlighted line, defaults to none
--code-block-line-highlight-border-color: sets the color of the border, defaults to none
Also uses the
backgroundproperty instead ofbackground-colorto remove colour gradient from code block highlightExample of this in use in cc projects
