| 1 |
// You can compile this with https://www.sassmeister.com |
| 2 |
|
| 3 |
$diff-bg-color: #fff !default; |
| 4 |
$diff-text-color: invert($diff-bg-color) !default; |
| 5 |
|
| 6 |
$diff-bg-color-ins-base: #8e8 !default; |
| 7 |
$diff-bg-color-del-base: #e88 !default; |
| 8 |
$diff-bg-color-rep-base: #fbdb65 !default; |
| 9 |
|
| 10 |
$diff-op-highlight-ratio: 90% !default; |
| 11 |
$diff-op-normal-ratio: 25% !default; |
| 12 |
|
| 13 |
// emphasized colors for detailed inline difference |
| 14 |
$diff-bg-color-ins-highlight: mix($diff-bg-color-ins-base, $diff-bg-color, $diff-op-highlight-ratio) !default; |
| 15 |
$diff-bg-color-del-highlight: mix($diff-bg-color-del-base, $diff-bg-color, $diff-op-highlight-ratio) !default; |
| 16 |
|
| 17 |
// colors for operation rows |
| 18 |
$diff-bg-color-ins: mix($diff-bg-color-ins-base, $diff-bg-color, $diff-op-normal-ratio) !default; |
| 19 |
$diff-bg-color-del: mix($diff-bg-color-del-base, $diff-bg-color, $diff-op-normal-ratio) !default; |
| 20 |
$diff-bg-color-rep: mix($diff-bg-color-rep-base, $diff-bg-color, $diff-op-normal-ratio) !default; |
| 21 |
|
| 22 |
$diff-table-head-color: mix($diff-bg-color, $diff-text-color, 65%) !default; |
| 23 |
$diff-table-sidebar-color: mix($diff-bg-color, $diff-text-color, 80%) !default; |
| 24 |
$diff-border-color: $diff-text-color !default; |
| 25 |
|
| 26 |
// color for the nonexistent block |
| 27 |
// for example, there are a deleted line that has no corresponding one |
| 28 |
$diff-bg-color-none-block: mix($diff-bg-color, $diff-table-sidebar-color, 80%) !default; |
| 29 |
$diff-bg-color-none-block-alternative: mix($diff-bg-color, $diff-table-sidebar-color, 55%) !default; |
| 30 |
|
| 31 |
// symbol images |
| 32 |
$img-space: 'data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M4.5 11C4.5 10.1716 5.17157 9.5 6 9.5C6.82843 9.5 7.5 10.1716 7.5 11C7.5 11.8284 6.82843 12.5 6 12.5C5.17157 12.5 4.5 11.8284 4.5 11Z" fill="rgba%2860, 60, 60, 50%25%29"/%3E%3C/svg%3E' !default; |
| 33 |
$img-tab: 'data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M9.5 10.44L6.62 8.12L7.32 7.26L12.04 11V11.44L7.28 14.9L6.62 13.9L9.48 11.78H0V10.44H9.5Z" fill="rgba%2860, 60, 60, 50%25%29"/%3E%3C/svg%3E' !default; |
| 34 |
|
| 35 |
.diff-wrapper.diff { |
| 36 |
--tab-size: 4; |
| 37 |
|
| 38 |
background: repeating-linear-gradient( |
| 39 |
-45deg, |
| 40 |
$diff-bg-color-none-block, |
| 41 |
$diff-bg-color-none-block 0.5em, |
| 42 |
$diff-bg-color-none-block-alternative 0.5em, |
| 43 |
$diff-bg-color-none-block-alternative 1em |
| 44 |
); |
| 45 |
border-collapse: collapse; |
| 46 |
border-spacing: 0; |
| 47 |
border: 1px solid $diff-border-color; |
| 48 |
color: $diff-text-color; |
| 49 |
empty-cells: show; |
| 50 |
font-family: monospace; |
| 51 |
font-size: 13px; |
| 52 |
width: 100%; |
| 53 |
word-break: break-all; |
| 54 |
|
| 55 |
th { |
| 56 |
font-weight: 700; |
| 57 |
cursor: default; |
| 58 |
-webkit-user-select: none; |
| 59 |
user-select: none; |
| 60 |
} |
| 61 |
|
| 62 |
td { |
| 63 |
vertical-align: baseline; |
| 64 |
} |
| 65 |
|
| 66 |
td, |
| 67 |
th { |
| 68 |
border-collapse: separate; |
| 69 |
border: none; |
| 70 |
padding: 1px 2px; |
| 71 |
background: $diff-bg-color; |
| 72 |
|
| 73 |
// make empty cell has height |
| 74 |
&:empty:after { |
| 75 |
content: ' '; |
| 76 |
visibility: hidden; |
| 77 |
} |
| 78 |
|
| 79 |
a { |
| 80 |
color: #000; |
| 81 |
cursor: inherit; |
| 82 |
pointer-events: none; |
| 83 |
} |
| 84 |
} |
| 85 |
|
| 86 |
thead th { |
| 87 |
background: $diff-table-head-color; |
| 88 |
border-bottom: 1px solid $diff-border-color; |
| 89 |
padding: 4px; |
| 90 |
text-align: left; |
| 91 |
} |
| 92 |
|
| 93 |
tbody { |
| 94 |
&.skipped { |
| 95 |
border-top: 1px solid $diff-border-color; |
| 96 |
|
| 97 |
td, |
| 98 |
th { |
| 99 |
display: none; |
| 100 |
} |
| 101 |
} |
| 102 |
|
| 103 |
th { |
| 104 |
background: $diff-table-sidebar-color; |
| 105 |
border-right: 1px solid $diff-border-color; |
| 106 |
text-align: right; |
| 107 |
vertical-align: top; |
| 108 |
width: 4em; |
| 109 |
|
| 110 |
&.sign { |
| 111 |
background: $diff-bg-color; |
| 112 |
border-right: none; |
| 113 |
padding: 1px 0; |
| 114 |
text-align: center; |
| 115 |
width: 1em; |
| 116 |
|
| 117 |
&.del { |
| 118 |
background: $diff-bg-color-del; |
| 119 |
} |
| 120 |
|
| 121 |
&.ins { |
| 122 |
background: $diff-bg-color-ins; |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
} |
| 127 |
|
| 128 |
&.diff-html { |
| 129 |
white-space: pre-wrap; |
| 130 |
tab-size: var(--tab-size); |
| 131 |
|
| 132 |
.ch { |
| 133 |
line-height: 1em; |
| 134 |
background-clip: border-box; |
| 135 |
background-repeat: repeat-x; |
| 136 |
background-position: left center; |
| 137 |
|
| 138 |
&.sp { |
| 139 |
background-image: url($img-space); |
| 140 |
background-size: 1ch 1.25em; |
| 141 |
} |
| 142 |
&.tab { |
| 143 |
background-image: url($img-tab); |
| 144 |
background-size: calc(var(--tab-size) * 1ch) 1.25em; |
| 145 |
background-position: 2px center; |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
.change { |
| 150 |
&.change-eq { |
| 151 |
.old, |
| 152 |
.new { |
| 153 |
background: $diff-bg-color; |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
.old { |
| 158 |
background: $diff-bg-color-del; |
| 159 |
} |
| 160 |
|
| 161 |
.new { |
| 162 |
background: $diff-bg-color-ins; |
| 163 |
} |
| 164 |
|
| 165 |
.rep { |
| 166 |
background: $diff-bg-color-rep; |
| 167 |
} |
| 168 |
|
| 169 |
.old, |
| 170 |
.new, |
| 171 |
.rep { |
| 172 |
&.none { |
| 173 |
background: transparent; |
| 174 |
cursor: not-allowed; |
| 175 |
} |
| 176 |
} |
| 177 |
|
| 178 |
ins, |
| 179 |
del { |
| 180 |
font-weight: bold; |
| 181 |
text-decoration: none; |
| 182 |
} |
| 183 |
|
| 184 |
ins { |
| 185 |
background: $diff-bg-color-ins-highlight; |
| 186 |
} |
| 187 |
|
| 188 |
del { |
| 189 |
background: $diff-bg-color-del-highlight; |
| 190 |
} |
| 191 |
} |
| 192 |
} |
| 193 |
} |