diff --git a/script/omarchy-theme-set-templates b/script/omarchy-theme-set-templates index 233997c..c5ffdb6 100755 --- a/script/omarchy-theme-set-templates +++ b/script/omarchy-theme-set-templates @@ -7,6 +7,7 @@ TEMPLATES_DIR="$DOTFILES_DIR/default/themed" USER_TEMPLATES_DIR="$HOME/.config/omarchy/themed" NEXT_THEME_DIR="$HOME/.config/omarchy/current/next-theme" COLORS_FILE="$NEXT_THEME_DIR/colors.toml" +THEME_MODE="$NEXT_THEME_DIR/light.mode" # Convert hex color to decimal RGB (e.g., "#1e1e2e" -> "30,30,46") hex_to_rgb() { @@ -18,6 +19,13 @@ hex_to_rgb() { if [[ -f $COLORS_FILE ]]; then sed_script=$(mktemp) + key="theme_mode"; + if [[ -f $THEME_MODE ]]; then + printf 's|{{ %s }}|%s|g\n' "$key" "light" # {{ key }} -> value + else + printf 's|{{ %s }}|%s|g\n' "$key" "dark" # {{ key }} -> value + fi >"$sed_script" + while IFS='=' read -r key value; do key="${key//[\"\' ]/}" # strip quotes and spaces from key [[ $key && $key != \#* ]] || continue # skip empty lines and comments @@ -30,7 +38,7 @@ if [[ -f $COLORS_FILE ]]; then rgb=$(hex_to_rgb "$value") echo "s|{{ ${key}_rgb }}|${rgb}|g" fi - done <"$COLORS_FILE" >"$sed_script" + done <"$COLORS_FILE" >>"$sed_script" shopt -s nullglob