Skip to main content

Apply color themes to a variety of shell command line tools.

Project description

dye-your-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-your-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

You'll need python version 3.9 or higher. Install with pipx:

$ pipx install dye-your-shell

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dye_your_shell-0.12.0.tar.gz (50.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dye_your_shell-0.12.0-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file dye_your_shell-0.12.0.tar.gz.

File metadata

  • Download URL: dye_your_shell-0.12.0.tar.gz
  • Upload date:
  • Size: 50.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for dye_your_shell-0.12.0.tar.gz
Algorithm Hash digest
SHA256 00128285b8275708cac7d72f12c50a12eef991251679cd902a13cd28acfffdb1
MD5 3bc99ca32aa07bc6ab1888dd15c63ea1
BLAKE2b-256 d2d1fb8c3415ba5cb32a69c72ac293c90f1386849ffe1af1b9a008f3ed739357

See more details on using hashes here.

File details

Details for the file dye_your_shell-0.12.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dye_your_shell-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c64c7775582ae6680d0872e0553025c9bc44d097c704234547fd64d9e7ad3094
MD5 50508a26dca8c9f1a2f282686e7c93f9
BLAKE2b-256 8bfb0f469e63ad4684a23dda5d3ee11dc20ab30ec342bc3ac56d4eaba8cfe004

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page