Fix transparent bar contrast timing
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
|
||||
|
||||
require_command magick
|
||||
|
||||
TMPDIR=$(mktemp -d)
|
||||
trap 'rm -rf "$TMPDIR"' EXIT
|
||||
|
||||
export PATH="$ROOT/bin:$PATH"
|
||||
|
||||
light_top="$TMPDIR/light-top.png"
|
||||
dark_top="$TMPDIR/dark-top.png"
|
||||
|
||||
magick -size 100x100 xc:'#202020' -fill '#f5f5f5' -draw 'rectangle 0,0 99,19' "$light_top"
|
||||
magick -size 100x100 xc:'#f5f5f5' -fill '#202020' -draw 'rectangle 0,0 99,19' "$dark_top"
|
||||
|
||||
result=$(HOME="$TMPDIR" omarchy-shell-bar-text-color top 20 '#ffffff' '#101010' --background "$light_top" --screen 100x100)
|
||||
[[ $result == "#101010" ]] || fail "transparent bar text switches to background color on light wallpaper" "expected #101010, got $result"
|
||||
pass "transparent bar text switches to background color on light wallpaper"
|
||||
|
||||
result=$(HOME="$TMPDIR" omarchy-shell-bar-text-color top 20 '#ffffff' '#101010' --background "$dark_top" --screen 100x100)
|
||||
[[ $result == "#ffffff" ]] || fail "transparent bar text keeps text color on dark wallpaper" "expected #ffffff, got $result"
|
||||
pass "transparent bar text keeps text color on dark wallpaper"
|
||||
|
||||
result=$(HOME="$TMPDIR" omarchy-shell-bar-text-color top 20 '#ffffff' '#101010' --background "$TMPDIR/missing.png" --screen 100x100)
|
||||
[[ $result == "#ffffff" ]] || fail "transparent bar text falls back to text color when sampling fails" "expected #ffffff, got $result"
|
||||
pass "transparent bar text falls back to text color when sampling fails"
|
||||
Reference in New Issue
Block a user