#!/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