Skip to content

Commit bdc3036

Browse files
committedFeb 24, 2020
Make SideBySide stripe background aligned across lines
"background-attachment: fixed;" seems to distract people when scrolling. Signed-off-by: Jack Cherng <[email protected]>
1 parent 2abb0d1 commit bdc3036

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed
 

‎example/diff-table.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
.diff-wrapper.diff.diff-html .change.change-eq .new {
7777
background: #fff;
7878
}
79-
.diff-wrapper.diff.diff-html .change.change-ins .old, .diff-wrapper.diff.diff-html .change.change-del .new {
79+
.diff-wrapper.diff.diff-html .change.change-ins .old, .diff-wrapper.diff.diff-html .change.change-del .new, .diff-wrapper.diff.diff-html .change.change-rep .old:empty, .diff-wrapper.diff.diff-html .change.change-rep .new:empty {
8080
cursor: not-allowed;
81-
background: repeating-linear-gradient(-45deg, #ebebeb, #ebebeb 5px, #e0e0e0 5px, #e0e0e0 10px);
81+
background: repeating-linear-gradient(-45deg, whitesmoke, whitesmoke 0.5em, #e8e8e8 0.5em, #e8e8e8 0.9em);
8282
}
8383
.diff-wrapper.diff.diff-html .change .old {
8484
background: #fbe1e1;

‎example/diff-table.scss

+9-6
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
// color for the nonexistent block
3030
// for example, there are a deleted line that has no corresponding one
31-
$bg-color-nonexistent-block: mix($bg-color, $table-sidebar-color, 60%);
32-
$bg-color-nonexistent-block-alternative: mix($bg-color, $table-sidebar-color, 40%);
31+
$bg-color-nonexistent-block: mix($bg-color, $table-sidebar-color, 80%);
32+
$bg-color-nonexistent-block-alternative: mix($bg-color, $table-sidebar-color, 55%);
3333

3434
background-color: $bg-color;
3535
border-collapse: collapse;
@@ -120,15 +120,18 @@
120120
}
121121

122122
&.change-ins .old,
123-
&.change-del .new {
123+
&.change-del .new,
124+
&.change-rep .old:empty,
125+
&.change-rep .new:empty {
124126
cursor: not-allowed;
125127
background: repeating-linear-gradient(
126128
-45deg,
127129
$bg-color-nonexistent-block,
128-
$bg-color-nonexistent-block 5px,
129-
$bg-color-nonexistent-block-alternative 5px,
130-
$bg-color-nonexistent-block-alternative 10px,
130+
$bg-color-nonexistent-block 0.5em,
131+
$bg-color-nonexistent-block-alternative 0.5em,
132+
$bg-color-nonexistent-block-alternative 0.9em,
131133
);
134+
// background-attachment: fixed;
132135
}
133136

134137
.old {

0 commit comments

Comments
 (0)
Please sign in to comment.