Skip to content

Commit f4e2d63

Browse files
use background property and custom vars for code block (#1352)
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 <img width="547" height="150" alt="image" src="https://github.com/user-attachments/assets/2002f08f-18cc-410d-9904-87cceca2a835" /> Co-authored-by: HJ <cocomarine@users.noreply.github.com>
1 parent 7ea9e57 commit f4e2d63

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

src/assets/stylesheets/Instructions.scss

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@
7272
}
7373

7474
// Steps in CCP style
75-
[id^="step-"]{
75+
[id^="step-"] {
7676
@include typography.style-1(bold);
7777

78-
background: #ECF8EE;
78+
background: #ecf8ee;
7979
border-radius: $space-0-5;
80-
color: #276D32;
80+
color: #276d32;
8181
display: inline-block;
8282
margin: $space-1-5 0 0 0;
8383
padding: $space-0-25 $space-0-5;
@@ -100,7 +100,7 @@
100100
block-size: $space-2;
101101
inline-size: $space-2;
102102
border-radius: $space-0-5;
103-
background-color: #ECF8EE;
103+
background-color: #ecf8ee;
104104
background-image: url("../play_filled.svg");
105105
background-repeat: no-repeat;
106106
background-position: center;
@@ -149,9 +149,11 @@
149149

150150
.line-highlight {
151151
margin-block-start: 0.5rem;
152-
background-color: var(--code-block-line-highlight-color, #{$rpf-white});
153-
mix-blend-mode: difference;
152+
background: var(--code-block-line-highlight-color, #{$rpf-white});
153+
mix-blend-mode: var(--code-block-blend-mode, difference);
154154
min-inline-size: 100%;
155+
border-inline-start: var(--code-block-line-highlight-border, none);
156+
border-color: var(--code-block-line-highlight-border-color, none);
155157
}
156158

157159
.language-python {

0 commit comments

Comments
 (0)