Skip to content

User Configuration

laike9m edited this page Jul 3, 2022 · 13 revisions

pdir2 supports color customization, and it's super easy.

The default path for config file is $HOME/.pdir2config. You can change it by setting the PDIR2_CONFIG_FILE environment variable.

File should be written in INI format. Here's an example:

[global]
doc-color = white
category-color = bright yellow
comma-color = bright green

Currently pdir2 only reads values from the global section, so just copy-past [global] into yours.

On the left is the item you want to change color for. Available fields and their default values are:

available fields default color
category-color yellow
attribute-color cyan
comma-color bright black
doc-color bright black
uniform-color

We support 16 colors:

black, bright black
red, bright red
green, bright green
yellow, bright yellow
blue, bright blue
magenta, bright magenta
cyan, bright cyan
white, bright white

FYI: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

uniform-color

When uniform-color is set, all other settings are suppressed, which means all output use uniform-color.

Therefore, to disable coloring, the simplest way is

[global]
uniform-color = bright white

Disable color (new in version 0.3.6)

There's a special configuration called enable-colorful-output that allows you to turn off/on color in the output.

[global]
enable-colorful-output = true|false|auto

Supported values are:

value meaning
auto Use colored output when stdout is a TTY, otherwise not. This is the default value if not specified.
true Always use colored output
false Always use non-colored output

It's recommended to not set it and just use auto. You can also use an environment variable PDIR2_NOCOLOR to do the same.

NOTE: enable-colorful-output and PDIR2_NOCOLOR will suppresses other setting including uniform-color. So if you set enable-colorful-output to false, uniform-color will not take effect.

Clone this wiki locally