Skip to content

use background property and custom vars for code block#1352

Merged
adrian-rpf merged 2 commits intomainfrom
code-block-styling-fix
Mar 5, 2026
Merged

use background property and custom vars for code block#1352
adrian-rpf merged 2 commits intomainfrom
code-block-styling-fix

Conversation

@rammodhvadia
Copy link
Contributor

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 background property instead of background-color to remove colour gradient from code block highlight

Example of this in use in cc projects
image

@rammodhvadia rammodhvadia temporarily deployed to previews/1352/merge March 2, 2026 10:35 — with GitHub Actions Inactive
@rammodhvadia rammodhvadia marked this pull request as ready for review March 5, 2026 11:00
Copilot AI review requested due to automatic review settings March 5, 2026 11:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-color with background shorthand and makes mix-blend-mode configurable via --code-block-blend-mode custom property
  • Adds two new CSS custom properties (--code-block-line-highlight-border and --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);
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
border-color: var(--code-block-line-highlight-border-color, none);
border-inline-start-color: var(--code-block-line-highlight-border-color, transparent);

Copilot uses AI. Check for mistakes.
@adrian-rpf adrian-rpf merged commit f4e2d63 into main Mar 5, 2026
11 checks passed
@adrian-rpf adrian-rpf deleted the code-block-styling-fix branch March 5, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants