Skip to main content

Use consistent color themes for a variety of command line tools.

Project description

shell-themer

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 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.

shell-themer uses a single theme configuration file to standardize and unify a set of color configurations, and generates the shell code to implement those changes.

All that hand tweaking in your shell init files can now be replaced with:

export THEME_FILE=~/themes/dracula.toml
source <(shell-themer generate)

This changes all your environment variables and other settings for the many shell tools you use to reflect the colors in the theme you have specified.

Theme Files

Here's an example of a theme 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 shell_themer

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

shell_themer-0.7.0.tar.gz (43.2 kB view details)

Uploaded Source

Built Distribution

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

shell_themer-0.7.0-py3-none-any.whl (28.5 kB view details)

Uploaded Python 3

File details

Details for the file shell_themer-0.7.0.tar.gz.

File metadata

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

File hashes

Hashes for shell_themer-0.7.0.tar.gz
Algorithm Hash digest
SHA256 3b8a2d043e2c4f8cd74394a81a463c4a328fffc6fd4aa2956c82d9cac740fdcb
MD5 f5bf7bf303d783fd67645878da307e21
BLAKE2b-256 d45cd1d196ffc734cce87100f9f0c4db5e0a569d39707ba07c92f1b5d4d0d5a2

See more details on using hashes here.

File details

Details for the file shell_themer-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: shell_themer-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 28.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for shell_themer-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a0e1f51aad3cb57dfabd88652859fdb8e281673778db28cece9a1318dfa5443
MD5 c95f5b23bdebfb99caedf02098bb693c
BLAKE2b-256 dd384ff33a2197162c90f3be151c2a226f06fa9f31fd8d16971f5b5f966df86f

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