Skip to content

Commit eb9ce39

Browse files
mkuhlmannlunny
authored andcommitted
Fix unified diff view styling (#585)
Signed-off-by: Manuel Kuhlmann <[email protected]>
1 parent a5e07da commit eb9ce39

File tree

3 files changed

+54
-34
lines changed

3 files changed

+54
-34
lines changed

public/css/index.css

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,29 +1992,37 @@ footer .ui.language .menu {
19921992
padding-top: 8px;
19931993
padding-bottom: 8px;
19941994
}
1995-
.repository .diff-file-box .code-diff tbody tr.add-code td:nth-child(1),
1996-
.repository .diff-file-box .code-diff tbody tr.add-code td:nth-child(2),
1997-
.repository .diff-file-box .code-diff tbody tr.del-code td:nth-child(3),
1998-
.repository .diff-file-box .code-diff tbody tr.del-code td:nth-child(4) {
1999-
background-color: #fafafa;
1995+
.repository .diff-file-box .code-diff tbody tr .removed-code {
1996+
background-color: #ff9999;
1997+
}
1998+
.repository .diff-file-box .code-diff tbody tr .added-code {
1999+
background-color: #99ff99;
20002000
}
2001-
.repository .diff-file-box .code-diff tbody tr.del-code td:nth-child(1),
2002-
.repository .diff-file-box .code-diff tbody tr.del-code td:nth-child(2),
2003-
.repository .diff-file-box .code-diff tbody tr td.del-code {
2001+
.repository .diff-file-box .code-diff-unified tbody tr.del-code td {
20042002
background-color: #ffe0e0 !important;
20052003
border-color: #f1c0c0 !important;
20062004
}
2007-
.repository .diff-file-box .code-diff tbody tr.add-code td:nth-child(3),
2008-
.repository .diff-file-box .code-diff tbody tr.add-code td:nth-child(4),
2009-
.repository .diff-file-box .code-diff tbody tr td.add-code {
2005+
.repository .diff-file-box .code-diff-unified tbody tr.add-code td {
20102006
background-color: #d6fcd6 !important;
20112007
border-color: #c1e9c1 !important;
20122008
}
2013-
.repository .diff-file-box .code-diff tbody tr .removed-code {
2014-
background-color: #ff9999;
2009+
.repository .diff-file-box .code-diff-split tbody tr.add-code td:nth-child(1),
2010+
.repository .diff-file-box .code-diff-split tbody tr.add-code td:nth-child(2),
2011+
.repository .diff-file-box .code-diff-split tbody tr.del-code td:nth-child(3),
2012+
.repository .diff-file-box .code-diff-split tbody tr.del-code td:nth-child(4) {
2013+
background-color: #fafafa;
20152014
}
2016-
.repository .diff-file-box .code-diff tbody tr .added-code {
2017-
background-color: #99ff99;
2015+
.repository .diff-file-box .code-diff-split tbody tr.del-code td:nth-child(1),
2016+
.repository .diff-file-box .code-diff-split tbody tr.del-code td:nth-child(2),
2017+
.repository .diff-file-box .code-diff-split tbody tr td.del-code {
2018+
background-color: #ffe0e0 !important;
2019+
border-color: #f1c0c0 !important;
2020+
}
2021+
.repository .diff-file-box .code-diff-split tbody tr.add-code td:nth-child(3),
2022+
.repository .diff-file-box .code-diff-split tbody tr.add-code td:nth-child(4),
2023+
.repository .diff-file-box .code-diff-split tbody tr td.add-code {
2024+
background-color: #d6fcd6 !important;
2025+
border-color: #c1e9c1 !important;
20182026
}
20192027
.repository .diff-file-box.file-content img {
20202028
max-width: 100%;

public/less/_repository.less

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -922,24 +922,6 @@
922922
// }
923923
// }
924924

925-
// light gray for empty lines before / after commit
926-
&.add-code td:nth-child(1), &.add-code td:nth-child(2),
927-
&.del-code td:nth-child(3), &.del-code td:nth-child(4) {
928-
background-color: #fafafa;
929-
}
930-
931-
&.del-code td:nth-child(1), &.del-code td:nth-child(2),
932-
td.del-code {
933-
background-color: #ffe0e0 !important;
934-
border-color: #f1c0c0 !important;
935-
}
936-
937-
&.add-code td:nth-child(3), &.add-code td:nth-child(4),
938-
td.add-code{
939-
background-color: #d6fcd6 !important;
940-
border-color: #c1e9c1 !important;
941-
}
942-
943925
.removed-code {
944926
background-color: #ff9999;
945927
}
@@ -949,6 +931,36 @@
949931
}
950932
}
951933
}
934+
.code-diff-unified tbody tr {
935+
&.del-code td {
936+
background-color: #ffe0e0 !important;
937+
border-color: #f1c0c0 !important;
938+
}
939+
940+
&.add-code td {
941+
background-color: #d6fcd6 !important;
942+
border-color: #c1e9c1 !important;
943+
}
944+
}
945+
.code-diff-split tbody tr {
946+
// light gray for empty lines before / after commit
947+
&.add-code td:nth-child(1), &.add-code td:nth-child(2),
948+
&.del-code td:nth-child(3), &.del-code td:nth-child(4) {
949+
background-color: #fafafa;
950+
}
951+
952+
&.del-code td:nth-child(1), &.del-code td:nth-child(2),
953+
td.del-code {
954+
background-color: #ffe0e0 !important;
955+
border-color: #f1c0c0 !important;
956+
}
957+
958+
&.add-code td:nth-child(3), &.add-code td:nth-child(4),
959+
td.add-code{
960+
background-color: #d6fcd6 !important;
961+
border-color: #c1e9c1 !important;
962+
}
963+
}
952964
&.file-content {
953965
img {
954966
max-width: 100%;

templates/repo/diff/box.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<img src="{{$.RawPath}}/{{EscapePound .Name}}">
8686
</div>
8787
{{else}}
88-
<div class="file-body file-code code-view code-diff">
88+
<div class="file-body file-code code-view code-diff {{if $.IsSplitStyle}}code-diff-split{{else}}code-diff-unified{{end}}">
8989
<table>
9090
<tbody>
9191
{{if $.IsSplitStyle}}

0 commit comments

Comments
 (0)