Catppuccin theme for cgit
This theme brings the Catppuccin color palette to cgit. It also makes some very slight UI changes to cgit itself. The theme can be seen in action on this website itself, and can be easily ported to other colorschemes too.
Syntax highlighting (with pygments) and markdown styling (with syntax highlighting inside the code blocks) is also supported.
Usage
Website styling
Move cgit.css
to /usr/share/cgit/cgit.css
on your server. Also make sure
your /etc/cgitrc
has this:
css=/cgit.css
Uncomment one of the theme variants at the top of the cgit.css
file, and
set --accent-color
to your preferred accent color.
Syntax highlighting
Install catppuccin[pygments]
from pip (along with other dependencies as
defined in cgit's manual). Place syntax-highlighting.py
at
/usr/lib/cgit/filters/syntax-highlighting.py
Find these lines in syntax-highlighting.py
:
from catppuccin.extras.pygments import MochaStyle
# ...
formatter = HtmlFormatter(style=MochaStyle, nobackground=True)
And optionally replace MochaStyle
with LatteStyle
, FrappeStyle
or
MacchiatoStyle
Markdown styling
Move md2html
to /usr/lib/cgit/filters/html-converters/md2html
and optionally
edit these lines:
from catppuccin.extras.pygments import MochaStyle
# ...
sys.stdout.write(HtmlFormatter(style=MochaStyle).get_style_defs('.highlight'))
And replace MochaStyle
with LatteStyle
, FrappeStyle
or MacchiatoStyle