1---
  2title: "Making cgit look nicer"
  3url: making-cgit-look-nicer.html
  4date: 2023-06-24T13:33:58+02:00
  5type: note
  6draft: false
  7---
  8
  9For personal use I have a [private Git server](https://git.mitjafelicijan.com)
 10set up and I use GitHub just as a mirror. By default the cgit theme looks a bit
 11dated so I made the flowing theme.
 12
 13- `/etc/cgitrc`
 14
 15```ini
 16css=/cgit.css
 17logo=/startrek.gif
 18favicon=/favicon.png
 19source-filter=/usr/lib/cgit/filters/syntax-highlighting-edited.sh
 20about-filter=/usr/lib/cgit/filters/about-formatting.sh
 21
 22local-time=1
 23snapshots=tar.gz
 24repository-sort=age
 25cache-size=1000
 26branch-sort=age
 27summary-log=200
 28max-atom-items=50
 29max-repo-count=100
 30
 31enable-index-owner=0
 32enable-follow-links=1
 33enable-log-filecount=1
 34enable-log-linecount=1
 35
 36root-title=Place for code, experiments and other bullshit!
 37root-desc=
 38clone-url=git@git.mitjafelicijan.com:/home/git/$CGIT_REPO_URL
 39
 40mimetype.gif=image/gif
 41mimetype.html=text/html
 42mimetype.jpg=image/jpeg
 43mimetype.jpeg=image/jpeg
 44mimetype.pdf=application/pdf
 45mimetype.png=image/png
 46mimetype.svg=image/svg+xml
 47
 48readme=:README.md
 49readme=:readme.md
 50
 51# Must be at the end!
 52virtual-root=/
 53scan-path=/home/git/
 54```
 55
 56For `syntax-highlighting-edited.sh` follow instructions on
 57[https://wiki.archlinux.org/title/Cgit](https://wiki.archlinux.org/title/Cgit#Using_highlight).
 58
 59- `/usr/share/cgit/cgit.css`
 60
 61```css
 62* {
 63        font-size: 11pt;
 64}
 65
 66body {
 67        font-family: monospace;
 68        background: white;
 69        padding: 1em;
 70}
 71
 72th, td {
 73        text-align: left;
 74}
 75
 76/* HEADER */
 77
 78#header {
 79        margin-bottom: 1em;
 80}
 81
 82#header .logo img {
 83        display: block;
 84        height: 3em;
 85        margin-right: 10px;
 86}
 87
 88#header .sub.right {
 89        display: none;
 90}
 91
 92/* FOOTER */
 93
 94.footer {
 95        margin-top: 2em;
 96        font-style: italic;
 97}
 98
 99.footer, .footer a {
100        color: gray;
101}
102
103/* TABS */
104
105.tabs a {
106        margin-bottom: 2em;
107        display: inline-block;
108        margin-right: 1em;
109}
110
111.tabs td a:only-child {
112        display: none;
113}
114
115/* HIDING ELEMENTS */
116
117.cgit-panel, .form {
118        display: none;
119}
120
121/* LISTS */
122
123.list td, .list th {
124        padding-right: 2em;
125}
126
127.list .nohover a {
128        color: black;
129}
130
131.list .button {
132        padding-right: 0.5em;
133}
134
135/* COMMIT */
136
137.commit-subject {
138        padding: 1em 0;
139}
140
141.decoration a {
142        padding-left: 0.5em;
143}
144
145.commit-info th {
146        padding-right: 1em;
147}
148
149.commit-subject {
150        padding: 2em 0;
151}
152
153table.diff div.head {
154        padding-top: 2em;
155}
156
157table.diffstat td {
158        padding-right: 1em;
159}
160
161/* CONTENT */
162
163.linenumbers {
164        padding-right: 0.5em;
165}
166
167.linenumbers a {
168        color: gray;
169}
170
171.pager {
172        display: flex;
173        list-style-type: none;
174        padding: 0;
175        gap: 0.5em;
176}
177
178/* DIFF COLORS */
179
180table.diff {
181        width: 100%;
182}
183
184table.diff td {
185        white-space: pre;
186}
187
188table.diff td div.head {
189        font-weight: bold;
190        margin-top: 1em;
191        color: black;
192}
193
194table.diff td div.hunk {
195        color: #009;
196}
197
198table.diff td div.add {
199        color: green;
200}
201
202table.diff td div.del {
203        color: red;
204}
205```