Skip to main content

dye-my-shell

activate color output in shell commands using themes and patterns

There are many modern *nix and *bsd command line tools which can output using a full 16.7 million color palette. For example:

Even the GNU Project's venerable ls can show various types of files in different colors.

Unfortunately, these tools all use slightly different color configuration mechanisms. With enough fiddling, you can get your shell init scripts to make all these tools use a similar color scheme, but if you want to change it, you've got a lot of work ahead.

dye-my-shell installs a command line program named dye to do its work.

dye reads a configuration file containing a set of colors, and instructions on how to apply those colors to as many command line tools as can support it. This configuration file is called a pattern. Each command line tool (ie bat, fzf, eza) has it's own set of instructions in the pattern which are powered by an agent, which is included in dye. This agent knows how to easily apply the colors to that command line tool, for example by setting an environment variable, or executing certain shell commands, or copying a template to a config file.

Instead of tweaking your collection of bash scripts to create or change all these colors, you now just tell dye to apply your pattern.

export DYE_PATTERN_FILE=~/.dye/dracula.toml
source <(dye apply)

Pattern Files

Here's an example of a pattern file:

#
# sample definition for a dracula theme

version = "1.0.0"
name = "dracula"

[styles]
# these are from https://draculatheme.com/contribute
background =  "#282a36"
foreground =  "#f8f8f2"

# styles for text and the highlighted line
# these are the only things fzf supports background colors for
text = "#f8f8f2 on default"
current_line =  "#f8f8f2 on #44475a"

# other colors from the dracula palette
comment =  "#6272a4"
cyan =  "#8be9fd"
green =  "#50fa7b"
orange =  "#ffb86c"
pink =  "#ff79c6"
purple =  "#bd93f9"
red =  "#ff5555"
yellow =  "#f1fa8c"

[scope.iterm]
agent = "iterm"
style.foreground = "foreground"
style.background = "background"

[scope.ls_colors]
agent = "environment_variables"
export.LS_COLORS = "$(vivid generate dracula)"

[scope.bat]
agent = "environment_variables"
export.BAT_THEME = "Dracula"

[scope.fzf]
agent = "fzf"
environment_variable = "FZF_DEFAULT_OPTS"
colorbase = "dark"

# command line options
opt.--pointer = "•"
opt.--prompt = "> "
opt.--bind = "ctrl-k:kill-line,ctrl-j:ignore,ctrl-u:unix-line-discard"

# these styles are special because they set both foreground and background
style.text = "text"
style.current_line = "current_line"

# no special parsing for these styles, just use the fzf color name
# highlighted substrings
style.hl = "pink"
# highlighted substrings current line
style."hl+" = "pink"
style.label = "green"
style.border = "orange"
style.prompt = "green"
style.pointer = "cyan"
style.query = "pink"

Installation

$ uv tool install dye-my-shell

If you don't use uv, maybe you should give it a try. Or, you can install python yourself, and then install dye-my-shell with pipx

$ pipx install dye-my-shell

You need a *nix-ish bash shell environment. Probably works in Windows Subsystem for Linux, but isn't tested there.

Metadata

Release files for dye-my-shell 0.13.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dye-my-shell 0.13.0
File Size Uploaded Provenance
dye_my_shell-0.13.0.tar.gz 58.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dye-my-shell 0.13.0
File Interpreter ABI Platform
dye_my_shell-0.13.0-py3-none-any.whl Python 3 none any Details

Total release size: 100.2 kB

Release files / dye_my_shell-0.13.0.tar.gz

Download URL dye_my_shell-0.13.0.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d80f5a0e49228c10a4342cd59a71fd259263f5d0d02cfb48d7402d50e3062175
BLAKE2b-256 checksum
How to use checksums
791dd73ba62184f8e1915eeb5fe023244492807372828f226559a0ff510ca8b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / dye_my_shell-0.13.0-py3-none-any.whl

Download URL dye_my_shell-0.13.0-py3-none-any.whl
Size 42.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc30c3bffc654f07d85b3fed8d3a2d2cceb194381a9ebeca2278f8171b58061a
BLAKE2b-256 checksum
How to use checksums
e95c281d0a1c37aaccb23a6b208af4f56ce2f39c46e6067c6a7a5f77781c89db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for dye-my-shell 0.13.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.13.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page