From 2cfee938ddc975beb95b17a9a676e9575045f7c5 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Tue, 3 Nov 2026 19:44:07 -1000 Subject: List a theme after cgit.css Any css or js line replaces the default rather than adding to it, so a theme set with a single css line, as the README implied, left every page unstyled. --- MANUAL.txt | 9 ++++++--- README.txt | 8 ++++++++ custom/cgitrc | 8 +++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/MANUAL.txt b/MANUAL.txt index 5aa4ebf..ce440c8 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -126,8 +126,9 @@ css:: Url which specifies the CSS document to include in all cgit pages. May be given multiple times, and each CSS url path is added in the head section of the document in turn. Setting this to an empty string will - disable generation of the link to this file in the head section. Default - value: "/cgit.css". + disable generation of the link to this file in the head section. The + first css line replaces the default, so a site stylesheet goes on a line + of its own after css=/cgit.css. Default value: "/cgit.css". date-format:: Format used for the calendar dates in the age columns of the log, refs @@ -321,7 +322,9 @@ js:: added in the head section of the document in turn. Each is loaded with defer, so it runs once the page has been parsed, still in the order given. Setting this to an empty string will disable generation of the - link to this file in the head section. Default value: "/cgit.js". + link to this file in the head section. The first js line replaces the + default, so a site script goes on a line of its own after js=/cgit.js. + Default value: "/cgit.js". local-time:: Flag which, if set to "1", makes cgit print commit and tag times in the diff --git a/README.txt b/README.txt index 29dabda..bcddbf4 100644 --- a/README.txt +++ b/README.txt @@ -175,6 +175,14 @@ A theme that only wants a colour change is a few lines. background: var(--surface); } +Keep a theme in a file of its own, since make install overwrites cgit.css. The +first css line replaces the default rather than adding to it, as a js line does +cgit.js, so list cgit.css first. The server configs in custom/servers/ serve +only the shipped files off disk, so add the theme to them too. + + css=/cgit.css + css=/theme.css + tests/t0005-markup.sh checks that every hook named here is still emitted. diff --git a/custom/cgitrc b/custom/cgitrc index 85bd531..427ced0 100644 --- a/custom/cgitrc +++ b/custom/cgitrc @@ -75,12 +75,14 @@ root-desc=a fast webinterface for the git dscm #readme=:README.md # CSS document urls added to the head of every page. An empty value disables it. -# Value is a url, and each css line adds one. Default is /cgit.css. +# The first css line replaces the default, so put a theme on a line after this +# one. Value is a url, and each css line adds one. Default is /cgit.css. css=/cgit.css # JavaScript document urls included on every page, loaded with defer in the -# order given. An empty value disables it. Value is a url, and each js line -# adds one. Default is /cgit.js. +# order given. An empty value disables it. The first js line replaces the +# default, so put a script of your own on a line after this one. Value is a +# url, and each js line adds one. Default is /cgit.js. js=/cgit.js # Shortcut icon url for all pages. Value is a url. Default is /favicon.ico. -- cgit 2.12.1