shchemes/lib/apply_scheme_to_template.sh
2024-03-20 14:47:27 -06:00

26 lines
402 B
Bash

#!/usr/bin/env bash
SCHEME=$1
TEMPLATE=$2
if [ -z "$MO_PATH" ]; then
MO_PATH="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/mo/mo"
fi
source $MO_PATH
rgb_r() {
echo "$((0x${MO_FUNCTION_ARGS[0]:0:2}))"
}
rgb_g() {
echo "$((0x${MO_FUNCTION_ARGS[0]:2:2}))"
}
rgb_b() {
echo "$((0x${MO_FUNCTION_ARGS[0]:4:4}))"
}
set -a # All variables after this will be exported
source $SCHEME
mo "$TEMPLATE"