You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make /gh-range-diff/... coloring more similar to git range-diff coloring
Start using the same coloring strategy as `git range-diff`, except we
don't color unchanged diff lines. See corresponding PR discussion for
the details.
Copy file name to clipboardExpand all lines: src/gh_range_diff.rs
+35-24Lines changed: 35 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -242,18 +242,24 @@ fn process_old_new(
242
242
overflow-x: auto;
243
243
}}
244
244
.removed-block {{
245
-
background-color: rgb(255, 206, 203);
245
+
background-color: rgba(255, 150, 150, 1);
246
246
white-space: pre;
247
247
}}
248
248
.added-block {{
249
-
background-color: rgb(172, 238, 187);
249
+
background-color: rgba(150, 255, 150, 1);
250
250
white-space: pre;
251
251
}}
252
-
.removed-line {{
253
-
color: #DE0000;
252
+
.removed-line-after {{
253
+
color: rgb(220, 0, 0)
254
254
}}
255
-
.added-line {{
256
-
color: #2F6500;
255
+
.added-line-after {{
256
+
color: rgb(0, 73, 0)
257
+
}}
258
+
.removed-line-before {{
259
+
color: rgb(192, 78, 76)
260
+
}}
261
+
.added-line-before {{
262
+
color: rgb(63, 128, 94)
257
263
}}
258
264
@media (prefers-color-scheme: dark) {{
259
265
body {{
@@ -264,23 +270,31 @@ fn process_old_new(
264
270
color: #41a6ff;
265
271
}}
266
272
.removed-block {{
267
-
background-color: rgba(248, 81, 73, 0.1);
273
+
background-color: rgba(80, 45, 45, 1);
274
+
white-space: pre;
268
275
}}
269
276
.added-block {{
270
-
background-color: rgba(46, 160, 67, 0.15);
277
+
background-color: rgba(70, 120, 70, 1);
278
+
white-space: pre;
279
+
}}
280
+
.removed-line-after {{
281
+
color: rgba(255, 0, 0, 1);
282
+
}}
283
+
.added-line-after {{
284
+
color: rgba(0, 255, 0, 1);
271
285
}}
272
-
.removed-line {{
273
-
color: #F34848;
286
+
.removed-line-before {{
287
+
color: rgba(100, 0, 0, 1);
274
288
}}
275
-
.added-line {{
276
-
color: #86D03C;
289
+
.added-line-before {{
290
+
color: rgba(0, 100, 0, 1);
277
291
}}
278
292
}}
279
293
</style>
280
294
</head>
281
295
<body>
282
296
<h3>range-diff of {oldbase}<wbr>...{oldhead} {newbase}<wbr>...{newhead}</h3>
283
-
<p>Bookmarklet: <a href="{bookmarklet}" title="Drag-and-drop me on the bookmarks bar, and use me on GitHub compare page.">range-diff</a> <span title="This javascript bookmark can be used to access this page with the right URL. To use it drag-on-drop the range-diff link to your bookmarks bar and click on it when you are on GitHub's compare page to use range-diff compare.">🛈</span> | {ADDED_BLOCK_SIGN} <span class="added-line">+</span> adds a line | {ADDED_BLOCK_SIGN} <span class="removed-line">-</span> removes a line | {REMOVED_BLOCK_SIGN} <span class="removed-line">+</span> removes the added line | {REMOVED_BLOCK_SIGN} - cancel the removal</p>
297
+
<p>Bookmarklet: <a href="{bookmarklet}" title="Drag-and-drop me on the bookmarks bar, and use me on GitHub compare page.">range-diff</a> <span title="This javascript bookmark can be used to access this page with the right URL. To use it drag-on-drop the range-diff link to your bookmarks bar and click on it when you are on GitHub's compare page to use range-diff compare.">🛈</span> | {REMOVED_BLOCK_SIGN} before | {ADDED_BLOCK_SIGN} after</p>
284
298
"#
285
299
)?;
286
300
@@ -409,19 +423,16 @@ impl HtmlDiffPrinter<'_> {
409
423
let is_add = token.starts_with('+');
410
424
let is_remove = token.starts_with('-');
411
425
412
-
// Highlight the whole the line only if it has changes it-self, otherwise
413
-
// only highlight the `+`, `-` to avoid distracting users with context
414
-
// changes.
426
+
// Highlight in the same was as `git range-diff` does for diff-lines
427
+
// that changed. (Contrary to `git range-diff` we don't color unchanged
428
+
// diff lines though, since then the coloring distracts from what is
0 commit comments