[Linux] change the topic of powerline shell

Time:2020-2-17

The default powerline shell theme is a bit ugly

According to the introduction on the official website, powerline shell GitHub official website documents

You can change the theme by yourself.

1. Click themes

[Linux] change the topic of powerline shell

2. You can see the introduction of themes

[Linux] change the topic of powerline shell

3. Start configuration

3.1 first execute these two commands to create a config.json file.

mkdir -p ~/.config/powerline-shell
powerline-shell --generate-config > ~/.config/powerline-shell/config.json

3.2 download the official preset template theme

Download addresspowerline_shell/themes

Several of the graphsPy fileNamelytopic file

[Linux] change the topic of powerline shell

Download anywhere, I downloaded it to the same directory as config.json, that is ~ /. Config / powerline shell folder

3.3 configure the downloaded template theme to take effect

3.3.1 modify the config.json file

Edit config.json file, add the following to change “default. Py” to the corresponding theme py file

[Linux] change the topic of powerline shell

{
  "segments": [
    "virtual_env",
    "username",
    "hostname",
    "ssh",
    "cwd",
    "git",
    "hg",
    "jobs",
    "root"
  ],
  "theme":"/home/yjc/.config/powerline-shell/default.py"
}
3.3.2 make changes effective

Save exitReopen the terminalYou can see the effect


Default.py theme
[Linux] change the topic of powerline shell

Basic.py theme
[Linux] change the topic of powerline shell

Gruvbox.py theme
[Linux] change the topic of powerline shell

Other self attempts

Finally, share my theme

from powerline_shell.themes.default import DefaultColor


class Color(DefaultColor):
    USERNAME_FG = 15
    USERNAME_BG = 4
    USERNAME_ROOT_BG = 1

    HOSTNAME_FG = 15
    HOSTNAME_BG = 10

    HOME_SPECIAL_DISPLAY = False
    PATH_FG = 0
    PATH_BG = 7
    CWD_FG = 0
    SEPARATOR_FG = 14

    READONLY_BG = 1
    READONLY_FG = 7

    REPO_CLEAN_FG = 0
    REPO_CLEAN_BG = 15
    REPO_DIRTY_FG = 1
    REPO_DIRTY_BG = 15

    JOBS_FG = 4
    JOBS_BG = 7

    CMD_PASSED_FG = 15
    CMD_PASSED_BG = 2
    CMD_FAILED_FG = 15
    CMD_FAILED_BG = 1

    SVN_CHANGES_FG = REPO_DIRTY_FG
    SVN_CHANGES_BG = REPO_DIRTY_BG

    VIRTUAL_ENV_BG = 15
    VIRTUAL_ENV_FG = 2

    TIME_FG = 15
    TIME_BG = 10

Recommended Today

The application of USB camera in rk3399

The application of USB camera in rk3399 1, introduction UVCFull nameUSB Video Class, is a set of standard customized by usb-if. All USB interface cameras complying with this standard can almost be used directly under Windows Linux and other systems, achieving the similar effect of drive free. Of course, it doesn’t mean that there is […]