#!/bin/bash

[ -f "$HOME/.local/snippets/apply-color-helper" ] || {
    echo "Missing helper script: $HOME/.local/snippets/apply-color-helper"
    exit 1
}
. "$HOME/.local/snippets/apply-color-helper"

for file in "$path"/icons/*.svg; do
    [ -f "$file" ] || continue
    sed -i -E "s/(fill=\"#)([0-9A-Fa-f]{6})(\")/\1${colorHex}\3/" "$file" || {
        log_error "Failed to edit ${file}"
        exit 1
    }
done

file="$path"/style.css

sed -i -E "s/(border-color:\s*#)([0-9A-Fa-f]{6})(;)/\1${colorHex}\3/" "$file" || {
    log_error "Failed to edit ${file}"
    exit 1
}

log_success "wlogout (niri version)"
