matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.55k stars 643 forks source link

Background colors from bitbar plugins do not work #792

Closed ahmetb closed 1 month ago

ahmetb commented 2 years ago

v2.1.7-beta

Repro: https://xbarapp.com/docs/plugins/Dev/Tutorial/ansi.sh.html

renders as image

but it should render as image

another repro is at https://github.com/ahmetb/dotfiles/blob/master/bitbar-plugins/yahoo_stock_ticker.1m.py renders as

image

whereas bitbar renders this as image

leaanthony commented 2 years ago

Hmmm...there must be something up with the ANSI parser. I'll take a look.

ahmetb commented 2 years ago

Any love for this issue? 😇

leaanthony commented 2 years ago

Thanks for the ping! I'll have a quick peek tonight

ahmetb commented 2 years ago

If you need a repro: https://github.com/ahmetb/dotfiles/blob/master/bitbar-plugins/yahoo_stock_ticker.1m.py

leaanthony commented 2 years ago

Thanks. This'll be the weekend now. It looks like a parse error so I'll need to create a test case out of this for https://github.com/leaanthony/go-ansi-parser

leaanthony commented 2 years ago

@ahmetb - after more looking at this, it seems bitbar didn't render it correctly anyway. [40m should be black, not grey. I'm also reading that [1m (bold) should be interpreted as "high intensity" so it would make the colours brighter. Running this script in a terminal seems to set it to intense colours by default, which is weird.

I've fixed a small parse error which cleared it all up: image

I believe, based on what I'm reading in the standards, this is the correct output for those codes. If you disagree and have more insights, please let me know. Cheers.

leaanthony commented 2 years ago

Should also mention that the bitbar rendering of the yahoo finance plugin in this thread is also a bit off. The screenshot on the plugin page looks like there are no background colours: https://xbarapp.com/docs/plugins/Finance/yahoo_stock_ticker.10m.py.html

ahmetb commented 2 years ago

I have customized it. I recommend trying with the link I provided.