https://github.com/kergoth/beets-stylize
Beets plugin to add style to your music library.
https://github.com/kergoth/beets-stylize
beets-plugin
Last synced: 3 months ago
JSON representation
Beets plugin to add style to your music library.
- Host: GitHub
- URL: https://github.com/kergoth/beets-stylize
- Owner: kergoth
- License: mit
- Created: 2024-08-16T18:45:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-06T03:59:37.000Z (over 1 year ago)
- Last Synced: 2025-12-17T01:01:54.023Z (6 months ago)
- Topics: beets-plugin
- Language: Python
- Homepage:
- Size: 827 KB
- Stars: 5
- Watchers: 1
- Forks: 1
- Open Issues: 22
-
Metadata Files:
- Readme: .github/README.remotified.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Stylize Plugin for Beets
[][pypi status]
[][pypi status]
[][pypi status]
[][license]
[][read the docs]
[][tests]
[][codecov]
[][pre-commit]
[![Ruff codestyle][ruff badge]][ruff project]
[pypi status]: https://pypi.org/project/beets-stylize/
[read the docs]: https://beets-stylize.readthedocs.io/
[tests]: https://github.com/kergoth/beets-stylize/actions?workflow=Tests
[codecov]: https://app.codecov.io/gh/kergoth/beets-stylize
[pre-commit]: https://github.com/pre-commit/pre-commit
[ruff badge]: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
[ruff project]: https://github.com/charliermarsh/ruff
![Album Listing][]
The [stylize](https://github.com/kergoth/beets-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 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:
- Make sure it’s in the Python path (known as `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`.
- Set the pluginpath config variable to point to the directory containing the plugin. (See Configuring) This would require cloning or otherwise downloading this [repository](https://github.com/kergoth/beets-stylize) before adding to the pluginpath.
## Configuring
First, enable the `stylize` plugin (see [Using Plugins][]). Colors for use with the `stylize` function may be defined using the [colors][] option under [UI Options][] in your beets configuration. For example:
```yaml
ui:
colors:
artist: ["bold", "green"]
```
## 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` and `format_album` configuration options:
```yaml
ui:
color: true
colors:
# Field colors for use in the item and album formats.
album: ["blue", "bold"]
albumartist: ["yellow"]
artist: ["bold", "yellow"]
title: ["normal"]
format_item: "%stylize{artist,$artist} %nocolor{- }%stylize{album,$album} %nocolor{- }%stylize{title,$title}"
format_album: "%stylize{albumartist,$albumartist} %nocolor{- }%stylize{album,$album}"
```
With this configured, we see listings like this:
![Album Listing][]
And this:
![Track Listing][]
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:
![Nocolor Listing][]
As an example of how to use `%link`, this would make the entire line a clickable link to the file path:
```yaml
format_item: "%link{file://$path,$artist - $album - $title}"
```
As we see here, in the Visual Studio Code terminal:
![Link Listing][]
## Contributing
Contributions are very welcome.
To learn more, see the [Contributor Guide].
## License
Distributed under the terms of the [MIT license][license],
_Stylize Plugin for Beets_ is free and open source software.
## Issues
If you encounter any problems,
please [file an issue] along with a detailed description.
## Credits
This project is a plugin for the [beets][] project, and would not exist without that fantastic project.
This project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter] template.
[template functions]: https://beets.readthedocs.io/en/stable/reference/pathformat.html#template-functions
[beets]: https://beets.readthedocs.io/en/stable/index.html
[format_item]: https://beets.readthedocs.io/en/stable/reference/config.html#id66
[format_album]: https://beets.readthedocs.io/en/stable/reference/config.html#id67
[list]: https://beets.readthedocs.io/en/stable/reference/cli.html#list-cmd
[other plugins]: https://beets.readthedocs.io/en/stable/plugins/index.html#other-plugins
[using plugins]: https://beets.readthedocs.io/en/stable/plugins/index.html#using-plugins
[colors]: https://beets.readthedocs.io/en/stable/reference/config.html#colors
[ui options]: https://beets.readthedocs.io/en/stable/reference/config.html#id81
[@cjolowicz]: https://github.com/cjolowicz
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
[file an issue]: https://github.com/kergoth/beets-stylize/issues
[track listing]: https://raw.githubusercontent.com/kergoth/beets-stylize/main/docs/images/track_listing.png
[album listing]: https://raw.githubusercontent.com/kergoth/beets-stylize/main/docs/images/album_listing.png
[nocolor listing]: https://raw.githubusercontent.com/kergoth/beets-stylize/main/docs/images/nocolor_listing.png
[link listing]: https://raw.githubusercontent.com/kergoth/beets-stylize/main/docs/images/link_listing.png
[license]: https://github.com/kergoth/beets-stylize/blob/main/LICENSE
[contributor guide]: https://github.com/kergoth/beets-stylize/blob/main/CONTRIBUTING.md