Transparent bar text colour falls back to theme colour on animated GIFs and very dark backgrounds
System details
Intel i5-1335U, Intel Iris Xe (Raptor Lake-P), Omarchy 4.0.5-1, ImageMagick 7.1.2-34 Q16-HDRI
What's wrong?
With bar.transparent: true, omarchy-bar-text-color picks the bar text colour by sampling the background's top strip. On some backgrounds the magick output doesn't match ^([0-9]+),([0-9]+),([0-9]+)$, so the script falls back to the theme's text colour. On a light theme over a dark wallpaper, that leaves dark text on a dark background and the bar can't be read.
I found two separate causes.
1. Animated GIFs: every frame gets sampled. magick processes every frame, so info:- prints one r,g,b per frame, concatenated. The regex rejects that. The background plugin uses a plain Image, which only shows the first frame, so a GIF works as a background but always breaks the text colour check.
magick -size 400x300 xc:black xc:navy -loop 0 /tmp/anim.gif
omarchy-bar-text-color top 26 '#282828' '#f9f5d7' --background /tmp/anim.gif --screen 1920x1200
# -> #282828 (dark text on a black background)
2. Dark images go slightly negative when resized. With HDRI ImageMagick (Arch's build), the default Lanczos filter overshoots near hard edges. Upscaling a near-black strip that sits next to a bright edge can push a channel below 0. %[fx:int(255*r)] then prints -1, and the regex rejects it.
magick -size 2000x1125 xc:'#000033' -fill '#ff0033' -draw 'rectangle 0,25 1999,1124' /tmp/ring.png
omarchy-bar-text-color top 26 '#282828' '#f9f5d7' --background /tmp/ring.png --screen 1920x1200
# sampled pixel is "-1,0,51" -> falls back to #282828 (dark text on a dark navy background)
I hit this with a real pixel-art wallpaper (2000x1125, mostly black at the top). Its resized minimum red value was about -16.
Suggested fix
Read only the first frame, and clamp after the final resize:
-pixel=$(magick "$background_path" -auto-orient \
+pixel=$(magick "${background_path}[0]" -auto-orient \
-resize "${screen_width}x${screen_height}^" \
-gravity center -extent "${screen_width}x${screen_height}" \
-gravity NorthWest -crop "$crop" +repage \
- -resize '1x1!' -format '%[fx:int(255*r)],%[fx:int(255*g)],%[fx:int(255*b)]' info:- 2>/dev/null || true)
+ -resize '1x1!' -clamp -format '%[fx:int(255*r)],%[fx:int(255*g)],%[fx:int(255*b)]' info:- 2>/dev/null || true)
With this change, both repros above sample as 0,0,0 and 0,0,51, and the script picks the light text colour.
On my laptop with current quattro, the animated GIF case no longer reproduces, but the dark-image case still does with the attached wallpaper. The bar text comes out dark on a dark bar in 3 of 3 runs. omarchy-bar-text-color averages down to a 1x1 pixel without clamping, so the result can fall outside the valid colour range. Adding -clamp after the final -resize '1x1!' fixes it. Open PR #14281 also fixes it as a side effect, so landing that would close this.
Thanks for the detailed report and the repros. I ran both on a disposable Omarchy worker (ImageMagick 7.1.2-34 Q16-HDRI) against current quattro (967bbdd), 1920x1200 screen, 26px top bar, #282828/#f9f5d7:
- Animated GIF: already fixed on
quattro. The script now reads"$background_path[0]", and youranim.gifpicks#f9f5d7. - Dark image near a hard edge: reproduced.
ring.pngsamples as-1,0,51, the parse atbin/omarchy-bar-text-colorrejects the minus sign, and the script falls back to#282828, so you get dark text on dark navy. The cause is as you describe: the Lanczos upscale (-resize "${w}x${h}^") rings below zero at the edge, and HDRI keeps the negative value.
Open PR #14281 fixes this. It replaces that upscale with -scale, a box filter that cannot ring. With its script at 0ce821c, the same image samples 0,0,51 and picks #f9f5d7. The final -resize '1x1!' cannot overshoot either: when the output is a single pixel, every source pixel sits inside the filter's positive lobe. Your -clamp gives the same result on quattro today, and it would be a cheap guard to add on top of #14281. It also catches a value above 255, which the parse would accept and then turn into a malformed hex colour. Whether to add it is the maintainer's call. I haven't opened a separate PR because it would conflict with #14281 on the same line.
I tried to link #14281 to this issue so that merging it closes this one, but omabot refused because #14281 has been pushed to since it was last classified. The link will need to be added once #14281 has been looked at again.
Checked by Claude Opus 5.5, with second opinions from Codex Medium and muse-spark-1.3-contributor (via pi, thinking high). Both agreed that #14281 fixes the cause. Muse-spark also suggested the final 1x1 resize could still ring, which I rejected for the reason above. This is waiting on the maintainer to decide on #14281.