From 85f02f4498435b6a9de751d760a0fe1076cb501c Mon Sep 17 00:00:00 2001 From: fatalerrors Date: Wed, 15 Apr 2026 13:35:33 +0200 Subject: [PATCH] themable prompt and some proposed themes --- profile.d/prompt.sh | 194 ++++++++++++++++++++++--- profile.d/themes/abyss.theme | 42 ++++++ profile.d/themes/adwaita.theme | 42 ++++++ profile.d/themes/dark.theme | 32 ++++ profile.d/themes/default.theme | 32 ++++ profile.d/themes/light.theme | 35 +++++ profile.d/themes/monochrome.theme | 64 ++++++++ profile.d/themes/monokai.theme | 45 ++++++ profile.d/themes/plasma.theme | 42 ++++++ profile.d/themes/solarized-light.theme | 127 ++++++++++++++++ profile.d/themes/solarized.theme | 122 ++++++++++++++++ 11 files changed, 759 insertions(+), 18 deletions(-) create mode 100755 profile.d/themes/abyss.theme create mode 100755 profile.d/themes/adwaita.theme create mode 100755 profile.d/themes/dark.theme create mode 100755 profile.d/themes/default.theme create mode 100755 profile.d/themes/light.theme create mode 100755 profile.d/themes/monochrome.theme create mode 100755 profile.d/themes/monokai.theme create mode 100755 profile.d/themes/plasma.theme create mode 100755 profile.d/themes/solarized-light.theme create mode 100755 profile.d/themes/solarized.theme diff --git a/profile.d/prompt.sh b/profile.d/prompt.sh index e9d4c91..000a11b 100644 --- a/profile.d/prompt.sh +++ b/profile.d/prompt.sh @@ -34,6 +34,134 @@ # * OF SUCH DAMAGE. # ------------------------------------------------------------------------------ + +# ------------------------------------------------------------------------------ +# Parse a prompt theme file safely — it is NEVER sourced or executed. +# Two categories of keys are accepted: +# PROMPT_COLOR_* — prompt slot colours (TIME_FG, BAR_BG, …) +# Standard colour variables from disp.sh (Blue, On_IBlack, …) — allows a +# theme to redefine the palette used everywhere in the shell session. +# Allowed value forms: +# $ColorName or ${ColorName} — colour variable from disp.sh (resolved by +# indirection via ${!varname}) +# \e[...m or \033[...m — raw ANSI escape literal (single block) +# Any other key or value is rejected with a warning. +# Usage: load_theme [theme_dir] +# theme_name_or_path : bare name (e.g. "dark") or an explicit path. +# theme_dir : directory to search for bare names; defaults to +# $MYPATH/profile.d/themes. Overridable via +# PROMPT_THEME_DIR. +load_theme() +{ + local theme_name="$1" + local theme_dir="${2:-${PROMPT_THEME_DIR:-$MYPATH/profile.d/themes}}" + local theme_file="" + + [[ -z "$theme_name" ]] && return 0 + + if [[ "$theme_name" == /* || "$theme_name" == */* ]]; then + theme_file="$theme_name" + else + theme_file="$theme_dir/${theme_name}.theme" + fi + + if [[ ! -f "$theme_file" || ! -r "$theme_file" ]]; then + printf "[ Warning ] load_theme: theme file not found: %s\n" "$theme_file" >&2 + return 1 + fi + + # ---- Key whitelist: prompt slots ---------------------------------------- + local -A _lth_allowed=( + [PROMPT_COLOR_TIME_FG]=1 [PROMPT_COLOR_TIME_BG]=1 + [PROMPT_COLOR_BAR_BG]=1 + [PROMPT_COLOR_OK_FG]=1 [PROMPT_COLOR_OK_MARK]=1 + [PROMPT_COLOR_ERR_BG]=1 [PROMPT_COLOR_ERR_FG]=1 [PROMPT_COLOR_ERR_MARK]=1 + [PROMPT_COLOR_ROOT_FG]=1 [PROMPT_COLOR_USER_FG]=1 + [PROMPT_COLOR_DIR_FG]=1 + ) + + # ---- Colour variable names exported by disp.sh -------------------------- + local _lth_color_re + _lth_color_re='Black|Red|Green|Yellow|Blue|Purple|Cyan|White' + _lth_color_re+='|BBlack|BRed|BGreen|BYellow|BBlue|BPurple|BCyan|BWhite' + _lth_color_re+='|UBlack|URed|UGreen|UYellow|UBlue|UPurple|UCyan|UWhite' + _lth_color_re+='|On_Black|On_Red|On_Green|On_Yellow|On_Blue|On_Purple|On_Cyan|On_White' + _lth_color_re+='|IBlack|IRed|IGreen|IYellow|IBlue|IPurple|ICyan|IWhite' + _lth_color_re+='|BIBlack|BIRed|BIGreen|BIYellow|BIBlue|BIPurple|BICyan|BIWhite' + _lth_color_re+='|On_IBlack|On_IRed|On_IGreen|On_IYellow|On_IBlue|On_IPurple|On_ICyan|On_IWhite' + _lth_color_re+='|DEFAULTFG|DEFAULTBG|DEFAULTCOL|RESETCOL' + + # ---- Key whitelist: standard colour vars (same list as above) ----------- + local _lth_cn + for _lth_cn in \ + Black Red Green Yellow Blue Purple Cyan White \ + BBlack BRed BGreen BYellow BBlue BPurple BCyan BWhite \ + UBlack URed UGreen UYellow UBlue UPurple UCyan UWhite \ + On_Black On_Red On_Green On_Yellow On_Blue On_Purple On_Cyan On_White \ + IBlack IRed IGreen IYellow IBlue IPurple ICyan IWhite \ + BIBlack BIRed BIGreen BIYellow BIBlue BIPurple BICyan BIWhite \ + On_IBlack On_IRed On_IGreen On_IYellow On_IBlue On_IPurple On_ICyan On_IWhite \ + DEFAULTFG DEFAULTBG DEFAULTCOL RESETCOL; do + _lth_allowed[$_lth_cn]=1 + done + unset _lth_cn + + # ERE: safe colour reference $Name or ${Name} + local _lth_ref_re='^\$\{?('"$_lth_color_re"')\}?$' + + # ERE: raw ANSI escape literal \e[...m or \033[...m + local _lth_ansi_re='^(\\e|\\033)\[[0-9;]*m$' + + # ---- Line parser --------------------------------------------------------- + local _lth_line _lth_key _lth_value _lth_varname _lth_lineno=0 + + while IFS= read -r _lth_line || [[ -n "$_lth_line" ]]; do + ((_lth_lineno++)) + _lth_line="${_lth_line%$'\r'}" # strip CR + _lth_line="${_lth_line#"${_lth_line%%[![:space:]]*}"}" # ltrim + _lth_line="${_lth_line%"${_lth_line##*[![:space:]]}"}" # rtrim + [[ -z "$_lth_line" || "$_lth_line" == '#'* ]] && continue # blank/comment + [[ "$_lth_line" == 'export '* ]] && _lth_line="${_lth_line#export }" # strip prefix + + if [[ "$_lth_line" != *=* ]]; then + printf "[ Warning ] load_theme: %s:%d: not a key=value pair, ignoring.\n" \ + "$theme_file" "$_lth_lineno" >&2 + continue + fi + + _lth_key="${_lth_line%%=*}" + _lth_value="${_lth_line#*=}" + _lth_key="${_lth_key#"${_lth_key%%[![:space:]]*}"}" + _lth_key="${_lth_key%"${_lth_key##*[![:space:]]}"}" # trim key + + if [[ -z "${_lth_allowed[$_lth_key]+x}" ]]; then + printf "[ Warning ] load_theme: %s:%d: key '%s' is not allowed, ignoring.\n" \ + "$theme_file" "$_lth_lineno" "$_lth_key" >&2 + continue + fi + + # Strip surrounding quotes + _lth_value="${_lth_value#\"}" ; _lth_value="${_lth_value%\"}" + _lth_value="${_lth_value#\'}" ; _lth_value="${_lth_value%\'}" + + if [[ "$_lth_value" =~ $_lth_ref_re ]]; then + # Safe colour variable reference — resolve via indirection + _lth_varname="${_lth_value#\$}" + _lth_varname="${_lth_varname#\{}" + _lth_varname="${_lth_varname%\}}" + export "$_lth_key"="${!_lth_varname}" + elif [[ "$_lth_value" =~ $_lth_ansi_re ]]; then + # Raw ANSI escape literal — accept as-is + export "$_lth_key"="$_lth_value" + else + printf "[ Warning ] load_theme: %s:%d: invalid value for '%s', ignoring.\n" \ + "$theme_file" "$_lth_lineno" "$_lth_key" >&2 + fi + done < "$theme_file" +} +# ------------------------------------------------------------------------------ + + # ------------------------------------------------------------------------------ # timer_* functions : internal timing function for prompt # Usage: timer_now @@ -95,38 +223,68 @@ set_prompt() local FancyX='\342\234\227' local Checkmark='\342\234\223' + # Resolve theme/config colours with hardcoded fallbacks + local _time_fg="${PROMPT_COLOR_TIME_FG:-$Blue}" + local _time_bg="${PROMPT_COLOR_TIME_BG:-$On_IBlack}" + local _bar_bg="${PROMPT_COLOR_BAR_BG:-$On_Blue}" + local _ok_fg="${PROMPT_COLOR_OK_FG:-$White}" + local _ok_mark="${PROMPT_COLOR_OK_MARK:-$Green}" + local _err_bg="${PROMPT_COLOR_ERR_BG:-$On_Red}" + local _err_fg="${PROMPT_COLOR_ERR_FG:-$White}" + local _err_mark="${PROMPT_COLOR_ERR_MARK:-$BYellow}" + local _root_fg="${PROMPT_COLOR_ROOT_FG:-$Red}" + local _user_fg="${PROMPT_COLOR_USER_FG:-$Green}" + local _dir_fg="${PROMPT_COLOR_DIR_FG:-$ICyan}" + # Begin with time - PS1="\[\e[s$Blue$OnGrey [ \t ] $On_Blue" + PS1="\[\e[s${_time_fg}${_time_bg} [ \t ] ${_bar_bg}" - # Add a bright white exit status for the last command - - # If it was successful, print a green check mark. Otherwise, print - # a red X. + # Add exit status of the last command. + # If it was successful, print a green check mark. Otherwise, print a red X. if [[ $Last_Command == 0 ]]; then - PS1+="$White$On_Blue [ \$Last_Command " - PS1+="$Green$Checkmark " + PS1+="${_ok_fg}${_bar_bg} [ \$Last_Command " + PS1+="${_ok_mark}${Checkmark} " else - PS1+="$White$On_Red [ \$Last_Command " - PS1+="$BYellow$FancyX " + PS1+="${_err_fg}${_err_bg} [ \$Last_Command " + PS1+="${_err_mark}${FancyX} " fi - # Add the ellapsed time and current date + # Add the elapsed time timer_stop - PS1+="($timer_show)$White ] $On_Blue " + PS1+="($timer_show)${_ok_fg} ] ${_bar_bg} " - # If root, just print the host in red. Otherwise, print the current user - # and host in green. + # If root, print the host in root colour. Otherwise use user colour. if [[ $EUID -eq 0 ]]; then - PS1+="$Red\\u$Green@\\h" + PS1+="${_root_fg}\\u${_user_fg}@\\h" else - PS1+="$Green\\u@\\h" + PS1+="${_user_fg}\\u@\\h" fi PS1+="\e[K\e[u$DEFAULTCOL\n" - # Print the working directory and prompt marker in blue, and reset - # the text color to the default. - PS1+="$ICyan\\w \\\$$DEFAULTCOL " + # Print the working directory and prompt marker, then reset colour. + PS1+="${_dir_fg}\\w \\\$$DEFAULTCOL " } # ------------------------------------------------------------------------------ +# ------------------------------------------------------------------------------ +# Theme and configuration loading. +# Precedence (lowest → highest): +# 1. Hardcoded fallbacks in set_prompt +# 2. Theme file (PROMPT_THEME key from [prompt] section) +# 3. Individual PROMPT_COLOR_* overrides in [prompt] section +# +# CONF_prompt is already populated by parse_conf (run in profile.sh before +# modules are sourced). We extract PROMPT_THEME and PROMPT_THEME_DIR from the +# raw associative array now so load_theme can run before load_conf "prompt" +# exports remaining keys. That way any PROMPT_COLOR_* value set explicitly in +# [prompt] wins over the same variable set by the theme file. +_pt_theme="${CONF_prompt[PROMPT_THEME]:-}" +_pt_dir="${CONF_prompt[PROMPT_THEME_DIR]:-}" +[[ -n "$_pt_theme" ]] && load_theme "$_pt_theme" ${_pt_dir:+"$_pt_dir"} +unset _pt_theme _pt_dir + +load_conf "prompt" +# ------------------------------------------------------------------------------ + + # EOF diff --git a/profile.d/themes/abyss.theme b/profile.d/themes/abyss.theme new file mode 100755 index 0000000..04f7597 --- /dev/null +++ b/profile.d/themes/abyss.theme @@ -0,0 +1,42 @@ +# Abyss prompt theme — deep ocean navy, electric teal, golden accents +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Inspired by the VS Code "Abyss" theme: deep navy/black backdrop, electric +# teal highlights, golden-yellow accents, cool electric blue for identifiers. +# Palette overrides shift the cooler hues to their high-intensity (electric) +# equivalents — blue becomes IBlue, green shifts toward teal (ICyan). +# ------------------------------------------------------------------------------ + +# Palette overrides — shift colours toward cool electric hues +Blue="\e[0;94m" # electric blue (IBlue — abyss identifier colour) +Green="\e[0;96m" # teal (ICyan — abyss string colour) +Yellow="\e[0;93m" # bright gold (IYellow — abyss constant colour) + +PROMPT_COLOR_TIME_FG="$ICyan" # electric teal clock +PROMPT_COLOR_TIME_BG="$On_Black" # deep black background +PROMPT_COLOR_BAR_BG="$On_Blue" # deep blue bar + +PROMPT_COLOR_OK_FG="$ICyan" # teal on success +PROMPT_COLOR_OK_MARK="$IGreen" # bright teal-green checkmark + +PROMPT_COLOR_ERR_BG="$On_Red" # red background on failure +PROMPT_COLOR_ERR_FG="$IWhite" # bright white text +PROMPT_COLOR_ERR_MARK="$IYellow" # golden X + +PROMPT_COLOR_ROOT_FG="$IRed" # red for root +PROMPT_COLOR_USER_FG="$IBlue" # electric blue for user +PROMPT_COLOR_DIR_FG="$ICyan" # teal path diff --git a/profile.d/themes/adwaita.theme b/profile.d/themes/adwaita.theme new file mode 100755 index 0000000..c1dd379 --- /dev/null +++ b/profile.d/themes/adwaita.theme @@ -0,0 +1,42 @@ +# Adwaita prompt theme — clean GNOME defaults, blue accent, green/red status +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Follows the GNOME HIG colour intent: a single calm blue accent (#3584e4), +# pleasant green for success (#33d17a), clear red for errors (#e01b24). +# No intense saturation, no heavy remapping — legibility over spectacle. +# Palette overrides gently shift Blue and Green to their IBlue/IGreen +# variants to better match Adwaita's brighter, flatter tones. +# ------------------------------------------------------------------------------ + +# Palette overrides — align to Adwaita's brighter accent tones +Blue="\e[0;94m" # IBlue → closer to Adwaita blue (#3584e4) +Green="\e[0;92m" # IGreen → closer to Adwaita green (#33d17a) + +PROMPT_COLOR_TIME_FG="$Cyan" # calm cyan clock text +PROMPT_COLOR_TIME_BG="$On_IBlack" # dark grey clock background +PROMPT_COLOR_BAR_BG="$On_Blue" # blue main bar (Adwaita accent) + +PROMPT_COLOR_OK_FG="$White" # clean white on success +PROMPT_COLOR_OK_MARK="$Green" # Adwaita green checkmark + +PROMPT_COLOR_ERR_BG="$On_Red" # Adwaita red on failure +PROMPT_COLOR_ERR_FG="$White" # white text +PROMPT_COLOR_ERR_MARK="$Yellow" # yellow X (warning intent) + +PROMPT_COLOR_ROOT_FG="$Red" # Adwaita red for root +PROMPT_COLOR_USER_FG="$IBlue" # Adwaita blue for user +PROMPT_COLOR_DIR_FG="$IGreen" # Adwaita green for path diff --git a/profile.d/themes/dark.theme b/profile.d/themes/dark.theme new file mode 100755 index 0000000..7499e8e --- /dev/null +++ b/profile.d/themes/dark.theme @@ -0,0 +1,32 @@ +# Dark prompt theme — dark grey bar, cyan user, magenta path +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ + +PROMPT_COLOR_TIME_FG="$ICyan" # Clock text +PROMPT_COLOR_TIME_BG="$On_Black" # Clock background (black) +PROMPT_COLOR_BAR_BG="$On_IBlack" # Main bar background (dark grey) + +PROMPT_COLOR_OK_FG="$IGreen" # Exit-code text on success +PROMPT_COLOR_OK_MARK="$BGreen" # Checkmark colour on success + +PROMPT_COLOR_ERR_BG="$On_Red" # Exit-code background on failure +PROMPT_COLOR_ERR_FG="$BIWhite" # Exit-code text on failure +PROMPT_COLOR_ERR_MARK="$BIYellow" # X mark colour on failure + +PROMPT_COLOR_ROOT_FG="$BIRed" # Username colour when root +PROMPT_COLOR_USER_FG="$ICyan" # Username@host colour for normal users +PROMPT_COLOR_DIR_FG="$IPurple" # Working directory colour diff --git a/profile.d/themes/default.theme b/profile.d/themes/default.theme new file mode 100755 index 0000000..89dd5f7 --- /dev/null +++ b/profile.d/themes/default.theme @@ -0,0 +1,32 @@ +# Default prompt theme — blue bar, green user, cyan path +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ + +PROMPT_COLOR_TIME_FG="$Blue" # Clock text +PROMPT_COLOR_TIME_BG="$On_IBlack" # Clock background (dark grey) +PROMPT_COLOR_BAR_BG="$On_Blue" # Main bar background + +PROMPT_COLOR_OK_FG="$White" # Exit-code text on success +PROMPT_COLOR_OK_MARK="$Green" # Checkmark colour on success + +PROMPT_COLOR_ERR_BG="$On_Red" # Exit-code background on failure +PROMPT_COLOR_ERR_FG="$White" # Exit-code text on failure +PROMPT_COLOR_ERR_MARK="$BYellow" # X mark colour on failure + +PROMPT_COLOR_ROOT_FG="$Red" # Username colour when root +PROMPT_COLOR_USER_FG="$Green" # Username@host colour for normal users +PROMPT_COLOR_DIR_FG="$ICyan" # Working directory colour diff --git a/profile.d/themes/light.theme b/profile.d/themes/light.theme new file mode 100755 index 0000000..61da5d9 --- /dev/null +++ b/profile.d/themes/light.theme @@ -0,0 +1,35 @@ +# Light prompt theme — white bar, blue user, purple path +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Opposite of dark.theme: backgrounds flip to bright whites, foregrounds +# shift to their dark/regular equivalents for contrast on a light terminal. +# ------------------------------------------------------------------------------ + +PROMPT_COLOR_TIME_FG="$Blue" # Clock text (ICyan → Blue, darker for light bg) +PROMPT_COLOR_TIME_BG="$On_IWhite" # Clock background (On_Black → On_IWhite) +PROMPT_COLOR_BAR_BG="$On_White" # Main bar background (On_IBlack → On_White) + +PROMPT_COLOR_OK_FG="$Green" # Exit-code text on success (IGreen → Green) +PROMPT_COLOR_OK_MARK="$BGreen" # Checkmark colour on success (unchanged — bold green reads on both) + +PROMPT_COLOR_ERR_BG="$On_Red" # Exit-code background on failure (unchanged) +PROMPT_COLOR_ERR_FG="$BIWhite" # Exit-code text on failure (unchanged — white on red works on both) +PROMPT_COLOR_ERR_MARK="$BYellow" # X mark on failure (BIYellow → BYellow, less glaring on light) + +PROMPT_COLOR_ROOT_FG="$Red" # Username when root (BIRed → Red) +PROMPT_COLOR_USER_FG="$Blue" # Username@host normal user (ICyan → Blue) +PROMPT_COLOR_DIR_FG="$Purple" # Working directory (IPurple → Purple) diff --git a/profile.d/themes/monochrome.theme b/profile.d/themes/monochrome.theme new file mode 100755 index 0000000..f9f65ce --- /dev/null +++ b/profile.d/themes/monochrome.theme @@ -0,0 +1,64 @@ +# Monochrome prompt theme — strict greyscale, no hue at all +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# All hues are silenced — colour variables are remapped to greyscale ANSI +# codes so that ls, man, grep, etc. also lose their colour cues. Contrast +# is achieved entirely through brightness: dark grey / light grey / white. +# Error state uses an inverted (white background, black text) bar so it +# remains visually distinct without relying on red. +# ------------------------------------------------------------------------------ + +# Palette overrides — replace every hue with a grey equivalent +Red="\e[0;37m" # light grey +Green="\e[0;97m" # bright white (success intent kept as brightest) +Yellow="\e[0;90m" # dark grey +Blue="\e[0;90m" # dark grey +Purple="\e[0;37m" # light grey +Cyan="\e[0;37m" # light grey +BRed="\e[1;37m" # bold light grey +BGreen="\e[1;97m" # bold bright white +BYellow="\e[1;90m" # bold dark grey +BBlue="\e[1;90m" # bold dark grey +BPurple="\e[1;37m" # bold light grey +BCyan="\e[1;37m" # bold light grey +IRed="\e[0;97m" # bright white +IGreen="\e[0;97m" # bright white +IYellow="\e[0;90m" # dark grey +IBlue="\e[0;90m" # dark grey +IPurple="\e[0;37m" # light grey +ICyan="\e[0;37m" # light grey +BIRed="\e[1;97m" # bold bright white +BIGreen="\e[1;97m" # bold bright white +BIYellow="\e[1;90m" # bold dark grey +BIBlue="\e[1;90m" # bold dark grey +BIPurple="\e[1;37m" # bold light grey +BICyan="\e[1;37m" # bold light grey + +PROMPT_COLOR_TIME_FG="$IBlack" # dark grey clock text (subtle) +PROMPT_COLOR_TIME_BG="$On_IBlack" # dark grey clock background +PROMPT_COLOR_BAR_BG="$On_IBlack" # dark grey main bar + +PROMPT_COLOR_OK_FG="$IWhite" # bright white on success +PROMPT_COLOR_OK_MARK="$BIWhite" # bold bright white checkmark + +PROMPT_COLOR_ERR_BG="$On_White" # inverted: bright white bar on error +PROMPT_COLOR_ERR_FG="$Black" # black text on white background +PROMPT_COLOR_ERR_MARK="$BBlack" # bold black X + +PROMPT_COLOR_ROOT_FG="$BIWhite" # bold bright white for root warning +PROMPT_COLOR_USER_FG="$IWhite" # bright white for normal user +PROMPT_COLOR_DIR_FG="$White" # standard white for path diff --git a/profile.d/themes/monokai.theme b/profile.d/themes/monokai.theme new file mode 100755 index 0000000..af9e1a2 --- /dev/null +++ b/profile.d/themes/monokai.theme @@ -0,0 +1,45 @@ +# Monokai prompt theme — high-saturation, vivid hues on near-black +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Monokai's signature: lime green, orange-yellow, hot pink/red, bright violet, +# electric cyan — all on a near-black (#272822) background. +# Palette overrides remap the dim ANSI regulars to their vivid high-intensity +# equivalents so that ls, grep colour output, etc. also look more "Monokai". +# ------------------------------------------------------------------------------ + +# Palette overrides — boost regular colours to Monokai-vivid equivalents +Red="\e[0;91m" # hot pink/red (#F92672) +Green="\e[0;92m" # lime green (#A6E22E) +Yellow="\e[0;93m" # orange-yellow (#E6DB74 / #FD971F) +Blue="\e[0;94m" # electric blue (#66D9E8 → shift blue) +Purple="\e[0;95m" # bright violet (#AE81FF) +Cyan="\e[0;96m" # electric cyan (#66D9E8) + +PROMPT_COLOR_TIME_FG="$IYellow" # orange clock text +PROMPT_COLOR_TIME_BG="$On_IBlack" # near-black Monokai background +PROMPT_COLOR_BAR_BG="$On_IBlack" # flat dark bar + +PROMPT_COLOR_OK_FG="$IGreen" # lime green on success +PROMPT_COLOR_OK_MARK="$IGreen" # lime green checkmark + +PROMPT_COLOR_ERR_BG="$On_IBlack" # keep dark — use colour for contrast +PROMPT_COLOR_ERR_FG="$IRed" # hot pink on failure +PROMPT_COLOR_ERR_MARK="$IRed" # hot pink X + +PROMPT_COLOR_ROOT_FG="$IRed" # hot pink for root +PROMPT_COLOR_USER_FG="$IYellow" # orange-yellow for user +PROMPT_COLOR_DIR_FG="$ICyan" # electric cyan for path diff --git a/profile.d/themes/plasma.theme b/profile.d/themes/plasma.theme new file mode 100755 index 0000000..633843e --- /dev/null +++ b/profile.d/themes/plasma.theme @@ -0,0 +1,42 @@ +# Plasma prompt theme — vivid KDE Plasma purples and electric cyan +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Captures the charged, vivid energy of KDE Plasma: dominant bright magenta/ +# purple, electric cyan highlights, all on a dark background. Palette overrides +# boost Blue, Purple, and Cyan to their high-intensity equivalents so that +# shell colour output reflects the same vivid palette. +# ------------------------------------------------------------------------------ + +# Palette overrides — vivid charged hues +Blue="\e[0;94m" # electric blue (IBlue) +Purple="\e[0;95m" # vivid magenta (IPurple — Plasma's signature colour) +Cyan="\e[0;96m" # electric cyan (ICyan) + +PROMPT_COLOR_TIME_FG="$IPurple" # vivid purple clock text +PROMPT_COLOR_TIME_BG="$On_IBlack" # dark grey background +PROMPT_COLOR_BAR_BG="$On_Purple" # bright magenta bar + +PROMPT_COLOR_OK_FG="$ICyan" # electric cyan on success +PROMPT_COLOR_OK_MARK="$IGreen" # green checkmark + +PROMPT_COLOR_ERR_BG="$On_Red" # red bar on failure +PROMPT_COLOR_ERR_FG="$IWhite" # bright white text +PROMPT_COLOR_ERR_MARK="$IYellow" # yellow X + +PROMPT_COLOR_ROOT_FG="$IRed" # red for root +PROMPT_COLOR_USER_FG="$BIPurple" # bold vivid purple for user +PROMPT_COLOR_DIR_FG="$ICyan" # electric cyan path diff --git a/profile.d/themes/solarized-light.theme b/profile.d/themes/solarized-light.theme new file mode 100755 index 0000000..419244f --- /dev/null +++ b/profile.d/themes/solarized-light.theme @@ -0,0 +1,127 @@ +# Solarized Light prompt theme — exact 24-bit / true-colour palette +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Requires a terminal with true-colour / 24-bit support. +# Check with: printf '\e[38;2;220;50;47mred\e[0m\n' +# If you see solid red text, your terminal supports this theme. +# (konsole, iTerm2, kitty, alacritty, Windows Terminal all do) +# +# Solarized Light base tones (inverted vs Dark): +# Base3 #fdf6e3 →253 246 227 (main background — lightest) +# Base2 #eee8d5 →238 232 213 (background highlights) +# Base1 #93a1a1 →147 161 161 (comments / secondary content) +# Base0 #839496 →131 148 150 (body text — secondary) +# Base00 #657b83 →101 123 131 (body text — main on light bg) +# Base01 #586e75 → 88 110 117 (emphasis) +# Base02 #073642 → 7 54 66 (darkest — used for strong contrast) +# +# Accent colours are identical to Solarized Dark: +# Yellow #b58900 →181 137 0 +# Orange #cb4b16 →203 75 22 +# Red #dc322f →220 50 47 +# Magenta #d33682 →211 54 130 +# Violet #6c71c4 →108 113 196 +# Blue #268bd2 → 38 139 210 +# Cyan #2aa198 → 42 161 152 +# Green #859900 →133 153 0 +# ------------------------------------------------------------------------------ + +# ---- Foreground palette overrides ------------------------------------------- +# The accent fg colours are identical to Dark — only the base/neutral roles flip. +# Regular +Black="\e[38;2;253;246;227m" # Base3 — lightest (fg on light bg = invisible; used as bg fg pair complement) +Red="\e[38;2;220;50;47m" # Red +Green="\e[38;2;133;153;0m" # Green +Yellow="\e[38;2;181;137;0m" # Yellow — primary accent +Blue="\e[38;2;38;139;210m" # Blue +Purple="\e[38;2;211;54;130m" # Magenta +Cyan="\e[38;2;42;161;152m" # Cyan +White="\e[38;2;101;123;131m" # Base00 — main body text on light bg + +# Bold +BBlack="\e[1;38;2;238;232;213m" # Base2 bold +BRed="\e[1;38;2;220;50;47m" # Red bold +BGreen="\e[1;38;2;133;153;0m" # Green bold +BYellow="\e[1;38;2;181;137;0m" # Yellow bold +BBlue="\e[1;38;2;38;139;210m" # Blue bold +BPurple="\e[1;38;2;211;54;130m" # Magenta bold +BCyan="\e[1;38;2;42;161;152m" # Cyan bold +BWhite="\e[1;38;2;88;110;117m" # Base01 bold — emphasis text + +# High intensity (emphasis / I* family) +IBlack="\e[38;2;147;161;161m" # Base1 — secondary/comments +IRed="\e[38;2;203;75;22m" # Orange — Solarized's "bright red" +IGreen="\e[38;2;133;153;0m" # Green (no brighter variant) +IYellow="\e[38;2;181;137;0m" # Yellow (no brighter variant) +IBlue="\e[38;2;108;113;196m" # Violet — Solarized's "bright blue" +IPurple="\e[38;2;211;54;130m" # Magenta (no brighter variant) +ICyan="\e[38;2;42;161;152m" # Cyan (no brighter variant) +IWhite="\e[38;2;88;110;117m" # Base01 — emphasis + +# Bold high intensity +BIBlack="\e[1;38;2;147;161;161m" # Base1 bold +BIRed="\e[1;38;2;203;75;22m" # Orange bold +BIGreen="\e[1;38;2;133;153;0m" # Green bold +BIYellow="\e[1;38;2;181;137;0m" # Yellow bold +BIBlue="\e[1;38;2;108;113;196m" # Violet bold +BIPurple="\e[1;38;2;211;54;130m" # Magenta bold +BICyan="\e[1;38;2;42;161;152m" # Cyan bold +BIWhite="\e[1;38;2;88;110;117m" # Base01 bold + +# ---- Background palette overrides ------------------------------------------- +# Light bases flip: On_Black → Base3 (lightest), On_IBlack → Base2 (highlights) +On_Black="\e[48;2;253;246;227m" # Base3 — main light background +On_Red="\e[48;2;220;50;47m" # Red +On_Green="\e[48;2;133;153;0m" # Green +On_Yellow="\e[48;2;181;137;0m" # Yellow +On_Blue="\e[48;2;38;139;210m" # Blue +On_Purple="\e[48;2;211;54;130m" # Magenta +On_Cyan="\e[48;2;42;161;152m" # Cyan +On_White="\e[48;2;101;123;131m" # Base00 + +On_IBlack="\e[48;2;238;232;213m" # Base2 — background highlights (slightly darker than Base3) +On_IRed="\e[48;2;203;75;22m" # Orange +On_IGreen="\e[48;2;133;153;0m" # Green +On_IYellow="\e[48;2;181;137;0m" # Yellow +On_IBlue="\e[48;2;108;113;196m" # Violet +On_IPurple="\e[48;2;211;54;130m" # Magenta +On_ICyan="\e[48;2;42;161;152m" # Cyan +On_IWhite="\e[48;2;88;110;117m" # Base01 + +# ---- Special codes ---------------------------------------------------------- +DEFAULTFG="\e[38;2;101;123;131m" # Base00 — default foreground on light bg +DEFAULTBG="\e[48;2;253;246;227m" # Base3 — default background +RESETCOL="\e[0m" + +# ---- Prompt colour slots ---------------------------------------------------- +# All specified as direct ANSI sequences to avoid ordering dependencies +# with the palette overrides above. + +PROMPT_COLOR_TIME_FG="\e[38;2;181;137;0m" # Yellow — primary accent +PROMPT_COLOR_TIME_BG="\e[48;2;238;232;213m" # Base2 — slightly darker than bg +PROMPT_COLOR_BAR_BG="\e[48;2;238;232;213m" # Base2 — warm light bar + +PROMPT_COLOR_OK_FG="\e[38;2;7;54;66m" # Base02 — dark text for contrast on light +PROMPT_COLOR_OK_MARK="\e[38;2;133;153;0m" # Green — checkmark + +PROMPT_COLOR_ERR_BG="\e[48;2;220;50;47m" # Red — error background +PROMPT_COLOR_ERR_FG="\e[38;2;253;246;227m" # Base3 — light text on red +PROMPT_COLOR_ERR_MARK="\e[38;2;253;246;227m" # Base3 — X mark (bright on red) + +PROMPT_COLOR_ROOT_FG="\e[38;2;220;50;47m" # Red — root warning +PROMPT_COLOR_USER_FG="\e[38;2;42;161;152m" # Cyan — normal user +PROMPT_COLOR_DIR_FG="\e[38;2;38;139;210m" # Blue — working directory diff --git a/profile.d/themes/solarized.theme b/profile.d/themes/solarized.theme new file mode 100755 index 0000000..f67dc4a --- /dev/null +++ b/profile.d/themes/solarized.theme @@ -0,0 +1,122 @@ +# Solarized Dark prompt theme — exact 24-bit / true-colour palette +# ------------------------------------------------------------------------------ +# Theme files are NOT executed as shell scripts. load_theme() parses them +# line by line. Only the following value forms are accepted: +# +# KEY="$ColorVarName" — reference to a colour variable from disp.sh +# KEY="${ColorVarName}" — same with braces +# KEY="\e[...m" — raw ANSI escape sequence (single block) +# +# Accepted keys: +# PROMPT_COLOR_* — prompt slot colours (see profile.conf [prompt]) +# Standard colour vars — Black, Blue, On_IBlack, … (overrides the palette +# from disp.sh for the whole shell session) +# +# Any unknown key, unsafe value, or shell construct will be ignored with a +# warning — theme files cannot execute code. +# ------------------------------------------------------------------------------ +# Requires a terminal with true-colour / 24-bit support. +# Check with: printf '\e[38;2;220;50;47mred\e[0m\n' +# If you see solid red text, your terminal supports this theme. +# (konsole, iTerm2, kitty, alacritty, Windows Terminal all do) +# +# Solarized Dark exact hex → RGB mapping used below: +# Base03 #002b36 → 0 43 54 (darkest background) +# Base02 #073642 → 7 54 66 (background highlights) +# Base01 #586e75 → 88 110 117 (comments / secondary content) +# Base00 #657b83 →101 123 131 (body text — dark background) +# Base0 #839496 →131 148 150 (body text — main) +# Base1 #93a1a1 →147 161 161 (optional emphasis) +# Yellow #b58900 →181 137 0 +# Orange #cb4b16 →203 75 22 +# Red #dc322f →220 50 47 +# Magenta #d33682 →211 54 130 +# Violet #6c71c4 →108 113 196 +# Blue #268bd2 → 38 139 210 +# Cyan #2aa198 → 42 161 152 +# Green #859900 →133 153 0 +# ------------------------------------------------------------------------------ + +# ---- Foreground palette overrides ------------------------------------------- +# Regular +Black="\e[38;2;0;43;54m" # Base03 — darkest content fg +Red="\e[38;2;220;50;47m" # Red +Green="\e[38;2;133;153;0m" # Green +Yellow="\e[38;2;181;137;0m" # Yellow — primary accent +Blue="\e[38;2;38;139;210m" # Blue +Purple="\e[38;2;211;54;130m" # Magenta +Cyan="\e[38;2;42;161;152m" # Cyan +White="\e[38;2;131;148;150m" # Base0 — body text + +# Bold +BBlack="\e[1;38;2;7;54;66m" # Base02 bold +BRed="\e[1;38;2;220;50;47m" # Red bold +BGreen="\e[1;38;2;133;153;0m" # Green bold +BYellow="\e[1;38;2;181;137;0m" # Yellow bold +BBlue="\e[1;38;2;38;139;210m" # Blue bold +BPurple="\e[1;38;2;211;54;130m" # Magenta bold +BCyan="\e[1;38;2;42;161;152m" # Cyan bold +BWhite="\e[1;38;2;147;161;161m" # Base1 bold + +# High intensity (brighter / emphasis roles in Solarized) +IBlack="\e[38;2;88;110;117m" # Base01 — secondary/comments +IRed="\e[38;2;203;75;22m" # Orange — Solarized's "bright red" +IGreen="\e[38;2;133;153;0m" # Green (no brighter variant) +IYellow="\e[38;2;181;137;0m" # Yellow (no brighter variant) +IBlue="\e[38;2;108;113;196m" # Violet — Solarized's "bright blue" +IPurple="\e[38;2;211;54;130m" # Magenta (no brighter variant) +ICyan="\e[38;2;42;161;152m" # Cyan (no brighter variant) +IWhite="\e[38;2;147;161;161m" # Base1 — optional emphasis + +# Bold high intensity +BIBlack="\e[1;38;2;88;110;117m" # Base01 bold +BIRed="\e[1;38;2;203;75;22m" # Orange bold +BIGreen="\e[1;38;2;133;153;0m" # Green bold +BIYellow="\e[1;38;2;181;137;0m" # Yellow bold +BIBlue="\e[1;38;2;108;113;196m" # Violet bold +BIPurple="\e[1;38;2;211;54;130m" # Magenta bold +BICyan="\e[1;38;2;42;161;152m" # Cyan bold +BIWhite="\e[1;38;2;147;161;161m" # Base1 bold + +# ---- Background palette overrides ------------------------------------------- +On_Black="\e[48;2;0;43;54m" # Base03 +On_Red="\e[48;2;220;50;47m" # Red +On_Green="\e[48;2;133;153;0m" # Green +On_Yellow="\e[48;2;181;137;0m" # Yellow +On_Blue="\e[48;2;38;139;210m" # Blue +On_Purple="\e[48;2;211;54;130m" # Magenta +On_Cyan="\e[48;2;42;161;152m" # Cyan +On_White="\e[48;2;131;148;150m" # Base0 + +On_IBlack="\e[48;2;7;54;66m" # Base02 — background highlights +On_IRed="\e[48;2;203;75;22m" # Orange +On_IGreen="\e[48;2;133;153;0m" # Green +On_IYellow="\e[48;2;181;137;0m" # Yellow +On_IBlue="\e[48;2;108;113;196m" # Violet +On_IPurple="\e[48;2;211;54;130m" # Magenta +On_ICyan="\e[48;2;42;161;152m" # Cyan +On_IWhite="\e[48;2;147;161;161m" # Base1 + +# ---- Special codes ---------------------------------------------------------- +DEFAULTFG="\e[38;2;131;148;150m" # Base0 — default foreground +DEFAULTBG="\e[48;2;0;43;54m" # Base03 — default background +RESETCOL="\e[0m" + +# ---- Prompt colour slots ---------------------------------------------------- +# All specified as direct ANSI sequences to avoid ordering dependencies +# with the palette overrides above. + +PROMPT_COLOR_TIME_FG="\e[38;2;181;137;0m" # Yellow — primary accent +PROMPT_COLOR_TIME_BG="\e[48;2;0;43;54m" # Base03 — darkest background +PROMPT_COLOR_BAR_BG="\e[48;2;7;54;66m" # Base02 — bar background + +PROMPT_COLOR_OK_FG="\e[38;2;131;148;150m" # Base0 — body text on success +PROMPT_COLOR_OK_MARK="\e[38;2;133;153;0m" # Green — checkmark + +PROMPT_COLOR_ERR_BG="\e[48;2;220;50;47m" # Red — error background +PROMPT_COLOR_ERR_FG="\e[38;2;253;246;227m" # Base3 — bright fg on red +PROMPT_COLOR_ERR_MARK="\e[38;2;181;137;0m" # Yellow — X mark on red bg + +PROMPT_COLOR_ROOT_FG="\e[38;2;220;50;47m" # Red — root warning +PROMPT_COLOR_USER_FG="\e[38;2;42;161;152m" # Cyan — normal user +PROMPT_COLOR_DIR_FG="\e[38;2;38;139;210m" # Blue — working directory