From 430a7e8b0e0b3f50a2b3cae9d1ae20ed9c68befe Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 4 Jun 2022 13:15:10 -0400 Subject: [PATCH] I've started the process of redesigning the colours. --- tcshrc.colors | 1 + tcshrc.prompt.colors | 9 +++------ tcshrc.prompt.defs | 8 ++++---- tcshrc.prompt.final | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/tcshrc.colors b/tcshrc.colors index 79a890b..2aea2e3 100644 --- a/tcshrc.colors +++ b/tcshrc.colors @@ -80,6 +80,7 @@ set bright_white="$csi$ansi_bright;$ansi_white$ansi_color" # You process true colour by evaluating `__make_color_sequence` on the environment variable. alias __make_color_sequence ${CSHENV_DIR}/bin/__hex_to_ansi +set sgr_reset="[`__build_sgr_code no-csi reset`m" ########################### # vim:filetype=tcsh diff --git a/tcshrc.prompt.colors b/tcshrc.prompt.colors index 0efd294..ad66e21 100644 --- a/tcshrc.prompt.colors +++ b/tcshrc.prompt.colors @@ -3,15 +3,15 @@ ###################### -set date_color="${dim_magenta}" -set time_color="${bright_magenta}" +set date_color="ansi:5" +set time_color="ansi:13" set text_color="${bright_white}" set oldp_color="${dim}" set brace_color="${bright_yellow}" set host_color="${bright_blue}" set name_color="${bright_cyan}" set at_color="${dim_cyan}" -set path_color="${bright_green}" +set path_color="ansi:10" set line_color="${dim_red}" set prompt_color="${dim}" set depth_color="${dim_yellow}" @@ -20,15 +20,12 @@ set command_color="${dim}" set color_start="%{" set color_end="%}" -set date_color_seq="${color_start}${date_color}${color_end}" -set time_color_seq="${color_start}${time_color}${color_end}" set text_color_seq="${color_start}${text_color}${color_end}" set oldp_color_seq="${color_start}${oldp_color}${color_end}" set brace_color_seq="${color_start}${brace_color}${color_end}" set host_color_seq="${color_start}${host_color}${color_end}" set name_color_seq="${color_start}${name_color}${color_end}" set at_color_seq="${color_start}${at_color}${color_end}" -set path_color_seq="${color_start}${path_color}${color_end}" set line_color_seq="${color_start}${line_color}${color_end}" set prompt_color_seq="${color_start}${prompt_color}${color_end}" set depth_color_seq="${color_start}${depth_color}${color_end}" diff --git a/tcshrc.prompt.defs b/tcshrc.prompt.defs index 3e01620..6b038fa 100644 --- a/tcshrc.prompt.defs +++ b/tcshrc.prompt.defs @@ -19,6 +19,7 @@ if( ! $?unknown_tty ) then endif + # R G Y B C M set reference_colors=( ${csi}91m ${csi}92m ${csi}93m ${csi}38\;5\;33m ${csi}95m ${csi}96m ) @@ -112,9 +113,8 @@ set prompt_simple="${oldp_color_seq}[%n@%m: %c]%# " set align_prefix="%{${csi}A${csi}1000000G${csi}18D%}" set align_suffix="%{${csi}G${csi}1B%}" #set screen_return="%{8%}" -set date_prompt_core="${date_color_seq}%{%Y-%W-%D %}${time_color_seq}%{%P%}" -set date_prompt_left="${date_prompt_core}" -set date_prompt="${date_prompt_core}" +set date_prompt="%{%Y-%W-%D%}" +set time_prompt="%{%P%}" #unset edit if( $?CSHENV_DEBUG ) then @@ -128,7 +128,7 @@ set depth_prompt="${depth_color_seq}(${shlvl})" set line_prompt="${line_color_seq}`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`" set user_prompt="${name_color_seq}%n" set host_prompt="${host_color_seq}${CSHENV_HOSTNAME}" -set path_prompt="${path_color_seq}%c02" +set path_prompt="%c02" set end_prompt="${prompt_color_seq}%#${command_color_seq} " alias oldp 'set prompt="$prompt_simple"; set cshenv_user_prompt_override' diff --git a/tcshrc.prompt.final b/tcshrc.prompt.final index 3043893..33cae13 100644 --- a/tcshrc.prompt.final +++ b/tcshrc.prompt.final @@ -1,6 +1,34 @@ ############################ ### Final Prompt Setting ### ############################ + +# Recompute cached sgr codes from any configuration updates +if( ! $?curr_path_color ) then + set curr_path_color=impossible +endif +if( ! $?curr_path_color || "${curr_path_color}" != "${path_color}" ) then + set curr_path_color="${path_color}" + set path_color_seq="[`__build_sgr_code no-csi reset ${curr_path_color}`m" +endif + +if( ! $?curr_date_color ) then + set curr_date_color=impossible +endif +if( ! $?curr_date_color || "${curr_date_color}" != "${date_color}" ) then + set curr_date_color="${date_color}" + set date_color_seq="[`__build_sgr_code no-csi reset ${curr_date_color}`m" + set date_prompt_view="%{${date_color_seq}%}${date_prompt}%{${sgr_reset}%}" +endif + +if( ! $?curr_time_color ) then + set curr_time_color=impossible +endif +if( ! $?curr_time_color || "${curr_time_color}" != "${time_color}" ) then + set curr_time_color="${time_color}" + set time_color_seq="[`__build_sgr_code no-csi reset ${curr_time_color}`m" + set time_prompt_view="%{${time_color_seq}%}${time_prompt}%{${sgr_reset}%}" +endif + if( ${prompt_hcolor} != 0 ) then set last_color = ${reference_colors[${prompt_hcolor}]} endif @@ -18,6 +46,7 @@ set medium_battery_level = 50 set strong_battery_level = 75 + while( ${prompt_hcolor} == 0 ) if( $?CSHENV_DEBUG ) then echo colorshuffle @@ -188,10 +217,10 @@ if( ! $?CSHENV_DISABLE_PROMPT_GIT ) then set git_prompt_view="${git_prompt}" endif if( ! $?CSHENV_DISABLE_PROMPT_PATH ) then - set path_prompt_view="${path_prompt}" + set path_prompt_view="%{${path_color_seq}%}${path_prompt}%{${sgr_reset}%}" endif -set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt}${align_suffix}${brace_color_seq}\[${prompt_reference_view}${line_prompt_view}${depth_prompt_view}${line_spacer_view}${user_prompt_view}${at_view}${host_prompt_view}${git_prompt_view}${path_prompt_view}${brace_color_seq}\]${end_prompt}" +set prompt_cool="%{\n%}${align_prefix}${battery_prefix}${battery_prompt}${date_prompt_view}%{ %}${time_prompt_view}${align_suffix}${brace_color_seq}\[${prompt_reference_view}${line_prompt_view}${depth_prompt_view}${line_spacer_view}${user_prompt_view}${at_view}${host_prompt_view}${git_prompt_view}${path_prompt_view}${brace_color_seq}\]${end_prompt}"