From 41c2bf905b17f6ae5fddd46f09613df19a01671e Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Tue, 30 Jul 2019 23:55:44 -0400 Subject: [PATCH] bash: add Virtual Console Gruvbox-like 16color theme There's something nice about the Virtual Console. No mouse, no distractions, no popups... it's pure concentration, and I'm slowly getting comfortably set up there. Getting a decent colorscheme set up took a *while* (see previous long commit about $TERM and NeoVim). But having a 16-color gruvbox inspired theme to the console is remarkably easy. Note that bolding the first 8 colors results in the "bright" versions, which allows the bash_prompt to still use real tput colors (past 8 doesn't exist in TERM=linux) but get the bright colors too. --- bash/bashrc | 1 + bash/console_theme | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 bash/console_theme diff --git a/bash/bashrc b/bash/bashrc index 79a4034..2dbbc00 100644 --- a/bash/bashrc +++ b/bash/bashrc @@ -48,5 +48,6 @@ function source_if_exists { source_if_exists "$HOME/.bash/git-completion.bash" # Git Completion source_if_exists "$HOME/.aliases" # Aliases (source after Git Completion!) +source_if_exists "$HOME/.console_theme" # Virtual Console colors (if TERM == "linux") source_if_exists "$HOME/.bash_prompt" # Personal Prompt source_if_exists "$HOME/.bashrc.local" # System specific settings diff --git a/bash/console_theme b/bash/console_theme new file mode 100644 index 0000000..2b1a3f2 --- /dev/null +++ b/bash/console_theme @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# bash/console_theme +# A small script to set the Virtual Console to use Gruvbox colors. +# Colors originally from https://github.com/morhetz/gruvbox by Pavel Pertsev +# For more on escape sequences see console_codes(4) +if [[ "$TERM" =~ "linux" ]]; then + # Gruvbox 16 colors + printf "\033]P0282828" # 0: Black + printf "\033]P1cc241d" # 1: Red + printf "\033]P298971a" # 2: Green + printf "\033]P3d79921" # 3: Yellow + printf "\033]P4458588" # 4: Blue + printf "\033]P5b16286" # 5: Magenta + printf "\033]P6689d6a" # 6: Cyan + printf "\033]P7a89984" # 7: White + printf "\033]P8928374" # 8: Bright Black + printf "\033]P9fb4934" # 9: Bright Red + printf "\033]Pab8bb26" # 10: Bright Green + printf "\033]Pbfabd2f" # 11: Bright Yellow + printf "\033]Pc83a598" # 12: Bright Blue + printf "\033]Pdd3869b" # 13: Bright Magenta + printf "\033]Pe8ec07c" # 14: Bright Cyan + printf "\033]Pfebdbb2" # 15: Bright White + clear # Redraw the screen... +fi -- libgit2 0.28.4