New plugin announcement: stylize #5390
Replies: 4 comments 2 replies
-
Updated to add |
Beta Was this translation helpful? Give feedback.
-
Hey! It's wonderful that there's a new plugin! Would you mind adding an enhancement request to add this to our plugin page? Just so adding it to the docs doesn't get forgotten. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your work on this. I'd like to use the plugin. I'm on package beets 2.0.0, installed using Python 3.12.3. The plugin Requires-Python <3.11,>=3.8 Can you add in 3.12 if it will work with it? |
Beta Was this translation helpful? Give feedback.
-
Stylize Plugin for Beets
The stylize plugin adds style and color to the list command and other commands that need to print out items, by adding three template functions for use in beets track and album listings. It is intended for use with the format_item and format_album configuration options.
stylize
: Add color and formatting to your formatted items and albums.nocolor
: Show the supplied text only when color is disabled. This is useful to add separators between fields when color is unavailable.link
: Create clickable links in the terminal. This has no effect on an unsupported terminal. This lets you play a track or navigate to an album folder with a click.Installation
As the beets documentation describes in Other plugins, to use an external plugin like this one, there are two options for installation:
sys.path
to developers). This just means the plugin has to be installed on your system (e.g., with a setup.py script or a command like pip or easy_install). For example,pip install beets-stylize
.Configuring
First, enable the
stylize
plugin (see Using Plugins). Colors for use with thestylize
function may be defined using the colors option under UI Options in your beets configuration. For example:Using
The
stylize
function accepts a named color as the first argument, the text to be stylized as the second, and an optional third argument for the text to be used if color is disabled.Example usage in your beets configuration, based on the default
format_item
andformat_album
configuration options:With this configured, we see listings like this:
And this:
If no color is available, such as due to redirection, or setting the
NO_COLOR
environment variable, we see a listing like this due to the use of%nocolor
to add the separator:As an example of how to use
%link
, this would make the entire line a clickable link to the file path:As we see here, in the Visual Studio Code terminal:
Beta Was this translation helpful? Give feedback.
All reactions