Tuning bash colors
This commit is contained in:
@@ -1,24 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
# Inspired by
|
||||
# https://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/
|
||||
# https://linux.101hacks.com/ps1-examples/prompt-color-using-tput/
|
||||
|
||||
function get_color()
|
||||
{
|
||||
local color="$1"
|
||||
echo "\[$(tput setaf "$color")\]"
|
||||
}
|
||||
|
||||
readonly RED=$(get_color 1)
|
||||
readonly GREEN=$(get_color 2)
|
||||
readonly CYAN=$(get_color 6)
|
||||
readonly END_COLOR='\[\033[00m\]'
|
||||
RED=$(tput setaf 1)
|
||||
GREEN=$(tput setaf 2)
|
||||
CYAN=$(tput setaf 6)
|
||||
COLOR_RESET=$(tput sgr0)
|
||||
|
||||
function get_ps1_prompt()
|
||||
{
|
||||
local username='\u'
|
||||
local hostname='\h'
|
||||
local working_directory='\w'
|
||||
local workdir='\w'
|
||||
local user_type='\$'
|
||||
|
||||
echo "${debian_chroot:+($debian_chroot)}${GREEN}${username}@${hostname}${END_COLOR}:${CYAN}${working_directory}${END_COLOR}${user_type} "
|
||||
echo "${debian_chroot:+($debian_chroot)}${GREEN}${username}@${hostname}${COLOR_RESET}:${CYAN}${workdir}${COLOR_RESET}${user_type} "
|
||||
}
|
||||
|
||||
function set_ps1_prompt()
|
||||
|
||||
@@ -2,11 +2,14 @@
|
||||
# https://dev.to/fernand0/better-colors-for-ls-in-dark-terminals-3d6
|
||||
# https://github.com/seebi/dircolors-solarized
|
||||
|
||||
COLORS_FILE="$LWS/conf/dircolors.ansi-light"
|
||||
#COLORS_FILE="$LWS/conf/dircolors/ansi-light.dircolors"
|
||||
COLORS_FILE="$LWS/conf/dircolors/dracula.dircolors"
|
||||
|
||||
if [[ -f "$COLORS_FILE" ]]; then
|
||||
xlog "Loading colors $COLORS_FILE"
|
||||
eval "$(dircolors "$COLORS_FILE")"
|
||||
else
|
||||
xlog "Colors $COLORS_FILE not found"
|
||||
fi
|
||||
|
||||
unset COLORS_FILE
|
||||
|
||||
Reference in New Issue
Block a user