Colors on output

64 views
Skip to first unread message

Bearcat Şándor

unread,
Mar 24, 2017, 6:40:25 PM3/24/17
to beets
Would there be a way to have colors on output for format_item and format_album commands?

Thanks,

Bearcat

Adrian Sampson

unread,
Mar 25, 2017, 1:14:58 AM3/25/17
to beets...@googlegroups.com
Hmm… I’m not quite sure I understand. Where were you imagining the colors should appear?

--
You received this message because you are subscribed to the Google Groups "beets" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beets-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bearcat Şándor

unread,
Mar 25, 2017, 1:54:31 AM3/25/17
to beets...@googlegroups.com

Well, say when you do a 'beet ls Beatles' you might want the artist in green, the title in orange and the track time in yellow. Depending on the fields you have setup in your config of course.


You received this message because you are subscribed to a topic in the Google Groups "beets" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beets-users/oK1IM1re3K4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beets-users...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--

Bearcat M. Şándor, CEO
Feline Soul Systems LLC
Voice: 872.CAT.SOUL (872.228.7685)
Fax: 406.235.7070

Bearcat Şándor

unread,
Mar 25, 2017, 2:32:37 AM3/25/17
to beets...@googlegroups.com

Or at least green, orange and yellow according to your terminal settings.

Adrian Sampson

unread,
Mar 26, 2017, 4:24:18 PM3/26/17
to beets...@googlegroups.com
OK, thanks for explaining! For what it’s worth, you can probably accomplish this already by injecting ANSI color escape sequences directly into your format strings. For example, this works for me in zsh:

$ beet ls -f $fg[red]'$artist'$fg[white]' - '$fg[green]'$title’

You could also sort out how to concoct the right strings to put in your YAML config. If you still think built-in support would be better, please do file a feature request on GitHub with full details! (For example, we’d need a design for how to specify colors and for how to handle the case when output is not for a terminal.)

Bearcat Şándor

unread,
Mar 27, 2017, 12:31:06 AM3/27/17
to beets...@googlegroups.com
That should work great. I didn't realise that the ansi sequences would work.

Bearcat Şándor

unread,
Mar 27, 2017, 1:21:39 AM3/27/17
to beets...@googlegroups.com
i know this isn't a help channel,but i don't even know where to begin to add ansi color sequences to my YAML configs. Do you?

Adrian Sampson

unread,
Mar 27, 2017, 9:20:13 AM3/27/17
to beets...@googlegroups.com
It will take a little homework, but the key is that ANSI escape sequences consist of ordinary ASCII characters (and therefore also UTF-8 characters). Specifically, ANSI escape sequences start with the ESC control character, which is U+001B:

vastyfields offrance

unread,
Aug 6, 2017, 12:06:17 PM8/6/17
to beets
If there's anyone still interested in this, I colored my output like so using the config file:

format_item: "\u001b[92m$artist\u001b[39m - \u001b[31m$album\u001b[39m - \u001b[93m$title\u001b[39m"
format_album: "\u001b[92m$albumartist\u001b[39m - \u001b[31m$album\u001b[39m"

Karcsi Kolbasz

unread,
Aug 22, 2017, 12:06:47 AM8/22/17
to beets
Where is this set in the config?
Reply all
Reply to author
Forward
0 new messages