🗝
summary refs log tree commit diff
path: root/cgit/css.sh
blob: b0fd63388b6f7c49abe1d1be2372f344f0da0703 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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