Skip to content

Commit e4b0ebb

Browse files
Anant TripathiAnant Tripathi
authored andcommitted
Fix dark mode readability for Side by Side and Unified diff views
1 parent 7feb2d0 commit e4b0ebb

1 file changed

Lines changed: 85 additions & 16 deletions

File tree

src/App.css

Lines changed: 85 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -891,35 +891,69 @@ body {
891891
border-color: #2a2740;
892892
}
893893

894+
/* ── All borders inside diff ── */
895+
[data-theme="dark"] .diff-output * {
896+
border-color: #2a2740 !important;
897+
}
898+
899+
/* ── File wrapper & header ── */
900+
[data-theme="dark"] .diff-output .d2h-file-wrapper {
901+
background: #1a1829 !important;
902+
}
903+
894904
[data-theme="dark"] .diff-output .d2h-file-header {
895-
background: #13112b;
896-
border-bottom-color: #2a2740;
897-
color: #94a3b8;
905+
background: #13112b !important;
906+
color: #94a3b8 !important;
898907
}
899908

900-
[data-theme="dark"] .diff-output .d2h-file-name {
901-
color: #a5b4fc;
909+
[data-theme="dark"] .diff-output .d2h-file-name,
910+
[data-theme="dark"] .diff-output .d2h-file-stats {
911+
color: #a5b4fc !important;
902912
}
903913

904-
[data-theme="dark"] .diff-output .d2h-diff-table {
905-
background: #1a1829;
906-
color: #e2e8f0;
914+
[data-theme="dark"] .diff-output .d2h-tag {
915+
background: #2a2740 !important;
916+
color: #94a3b8 !important;
907917
}
908918

919+
/* ── Table & base cells ── */
920+
[data-theme="dark"] .diff-output .d2h-diff-table,
921+
[data-theme="dark"] .diff-output tbody,
922+
[data-theme="dark"] .diff-output tr,
923+
[data-theme="dark"] .diff-output td {
924+
background: #1a1829 !important;
925+
color: #e2e8f0 !important;
926+
}
927+
928+
/* ── Line numbers ── */
909929
[data-theme="dark"] .diff-output .d2h-code-linenumber,
910930
[data-theme="dark"] .diff-output .d2h-code-side-linenumber {
911931
background: #13112b !important;
912932
color: #4a4a6a !important;
913-
border-color: #2a2740 !important;
914933
}
915934

935+
/* ── Unchanged / context lines ── */
936+
[data-theme="dark"] .diff-output .d2h-cntx td,
937+
[data-theme="dark"] .diff-output .d2h-cntx .d2h-code-linenumber,
938+
[data-theme="dark"] .diff-output .d2h-cntx .d2h-code-side-linenumber {
939+
background: #1a1829 !important;
940+
color: #e2e8f0 !important;
941+
}
942+
943+
[data-theme="dark"] .diff-output .d2h-cntx .d2h-code-linenumber,
944+
[data-theme="dark"] .diff-output .d2h-cntx .d2h-code-side-linenumber {
945+
color: #4a4a6a !important;
946+
}
947+
948+
/* ── Code line content ── */
916949
[data-theme="dark"] .diff-output .d2h-code-line,
917-
[data-theme="dark"] .diff-output .d2h-code-side-line {
918-
background: #1a1829;
919-
color: #e2e8f0;
950+
[data-theme="dark"] .diff-output .d2h-code-side-line,
951+
[data-theme="dark"] .diff-output .d2h-code-line-ctn {
952+
background: transparent !important;
953+
color: #e2e8f0 !important;
920954
}
921955

922-
[data-theme="dark"] .diff-output .d2h-ins,
956+
/* ── Inserted lines ── */
923957
[data-theme="dark"] .diff-output .d2h-ins td {
924958
background: #0d2b1a !important;
925959
color: #86efac !important;
@@ -931,7 +965,20 @@ body {
931965
color: #4ade80 !important;
932966
}
933967

934-
[data-theme="dark"] .diff-output .d2h-del,
968+
[data-theme="dark"] .diff-output .d2h-ins .d2h-code-line-ctn,
969+
[data-theme="dark"] .diff-output .d2h-ins .d2h-code-line {
970+
color: #86efac !important;
971+
}
972+
973+
/* ── Inline inserted chars ── */
974+
[data-theme="dark"] .diff-output .d2h-ins ins,
975+
[data-theme="dark"] .diff-output .d2h-code-line ins {
976+
background: #166534 !important;
977+
color: #bbf7d0 !important;
978+
text-decoration: none !important;
979+
}
980+
981+
/* ── Deleted lines ── */
935982
[data-theme="dark"] .diff-output .d2h-del td {
936983
background: #2d0d0d !important;
937984
color: #fca5a5 !important;
@@ -943,12 +990,34 @@ body {
943990
color: #f87171 !important;
944991
}
945992

993+
[data-theme="dark"] .diff-output .d2h-del .d2h-code-line-ctn,
994+
[data-theme="dark"] .diff-output .d2h-del .d2h-code-line {
995+
color: #fca5a5 !important;
996+
}
997+
998+
/* ── Inline deleted chars ── */
999+
[data-theme="dark"] .diff-output .d2h-del del,
1000+
[data-theme="dark"] .diff-output .d2h-code-line del {
1001+
background: #7f1d1d !important;
1002+
color: #fecaca !important;
1003+
text-decoration: none !important;
1004+
}
1005+
1006+
/* ── Info / hunk header ── */
1007+
[data-theme="dark"] .diff-output .d2h-info td,
9461008
[data-theme="dark"] .diff-output .d2h-info {
1009+
background: #1e1b3d !important;
1010+
color: #818cf8 !important;
1011+
}
1012+
1013+
/* ── Empty placeholder (side-by-side) ── */
1014+
[data-theme="dark"] .diff-output .d2h-emptyplaceholder,
1015+
[data-theme="dark"] .diff-output .d2h-code-side-emptyplaceholder {
9471016
background: #13112b !important;
948-
color: #6366f1 !important;
9491017
}
9501018

951-
[data-theme="dark"] .diff-output .d2h-emptyplaceholder {
1019+
[data-theme="dark"] .diff-output .d2h-emptyplaceholder td,
1020+
[data-theme="dark"] .diff-output .d2h-code-side-emptyplaceholder td {
9521021
background: #13112b !important;
9531022
}
9541023

0 commit comments

Comments
 (0)