🗝
summary refs log tree commit diff
path: root/cgit/css.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cgit/css.sh')
-rwxr-xr-xcgit/css.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/cgit/css.sh b/cgit/css.sh
new file mode 100755
index 0000000..b0fd633
--- /dev/null
+++ b/cgit/css.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+set -e
+
+test -d cgit/css && rm -r cgit/css
+mkdir cgit/css
+
+function compile {
+    local variant=$1
+    local css=$2
+    curl -L "https://github.com/ArmandPhilippot/coldark-bat/raw/master/Coldark-$variant.tmTheme" \
+        | MODE=theme cgit-syntect - cgit/css/$css.css cgit/css/scopes
+    sed -i 's/background-color: .*//' cgit/css/$css.css # we don't actually want that
+}
+
+compile Cold light
+compile Dark dark
+
+curl https://git.kernel.org/cgit-data/cgit.css \
+    | tail -n+2 \
+    | sed 's/font-family: .* monospace/font-family: monospace/' \
+    | sed -n '/Style definition file/q;p' \
+    > cgit/css/kernel.css
+
+{
+    echo '/* adapted from https://git.kernel.org/cgit-data/cgit.css */'
+    cat cgit/css/kernel.css
+    cat cgit/css/light.css
+    echo "@media only all and (prefers-color-scheme: dark) {"
+    cat cgit/css/dark.css
+    echo "}"
+    cat cgit/patch.css
+} | prettier --parser css > cgit/css/style.css
+
+# rm -r cgit/css