#!/bin/sh

pushd /home/tastytea/blog/themes
for file in style.css style-compat.css; do
    cp slick/static/assets/${file} tastytea/static/assets/${file}

    # Remove fonts, save >400KiB (~92,5%)
    sed -Ei 's/@font-face\{[^\}]+\}//g' tastytea/static/assets/${file}

    # Increase font-size
    sed -i 's/font-size:16px/font-size:18px/g' tastytea/static/assets/${file}

    # Set maximum characters per line to 100
    sed -i 's/body{margin:0}/body{max-width:100ch;margin:auto}/' tastytea/static/assets/${file}
    
    sed -i 's/#1d1f21/#101112/g' tastytea/static/assets/${file} # Code Background

    sed -i 's/#ffffff/#1d1f21/g' tastytea/static/assets/${file} # Background
    sed -i 's/#fff/#1d1f21/g'    tastytea/static/assets/${file}
    sed -i 's/#efefef/#282a2e/g' tastytea/static/assets/${file} # Current Line
    sed -i 's/#eee/#282a2e/g'    tastytea/static/assets/${file} # Current Line
    sed -i 's/#d6d6d6/#373b41/g' tastytea/static/assets/${file} # Selection
    sed -i 's/#4d4d4c/#c5c8c6/g' tastytea/static/assets/${file} # Foreground
    sed -i 's/#8e908c/#969896/g' tastytea/static/assets/${file} # Comment
    sed -i 's/#c82829/#cc6666/g' tastytea/static/assets/${file} # Red
    sed -i 's/#f5871f/#de935f/g' tastytea/static/assets/${file} # Orange
    sed -i 's/#eab700/#f0c674/g' tastytea/static/assets/${file} # Yellow
    sed -i 's/#718c00/#b5bd68/g' tastytea/static/assets/${file} # Green
    sed -i 's/#3e999f/#8abeb7/g' tastytea/static/assets/${file} # Aqua
    sed -i 's/#4271ae/#81a2be/g' tastytea/static/assets/${file} # Blue
    sed -i 's/#8959a8/#b294bb/g' tastytea/static/assets/${file} # Purple

    sed -i 's/#000/#e2e0de/g' tastytea/static/assets/${file}    # Some links
done
popd
