Merge branch 'colour-redesign'
Conflicts: tcshrc.colors
This commit is contained in:
@ -126,10 +126,14 @@ function render_color()
|
||||
command_color=30
|
||||
if (( ${use_3_bit} ))
|
||||
then
|
||||
basecolor=$(( ${command_color} ))
|
||||
# Underline colours need 8-bit or more
|
||||
if (( ${background} > 1 )) ; then return; fi
|
||||
basecolor=$(( ${command_color} + ${background}*10))
|
||||
next="$(( ${basecolor} + ${legacy_3_bit} ))"
|
||||
elif (( ${use_4_bit} ))
|
||||
then
|
||||
# Underline colours need 8-bit or more
|
||||
if (( ${background} > 1 )) ; then return; fi
|
||||
command_color=$(( ${command_color} + ${intensity_1_bit} * 60 ))
|
||||
basecolor=$(( ${command_color} + ${background}*10 ))
|
||||
next="$(( ${basecolor} + ${legacy_3_bit} ))"
|
||||
@ -414,8 +418,14 @@ function build_sgr_code()
|
||||
bg:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 1 rgb_color ${1:3} ;;
|
||||
bg:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 1 rgb_color ${1:3} ;;
|
||||
|
||||
ul:ext:*) make_color 2 ext_color ${1:7} ;;
|
||||
# 12-bit color also supported
|
||||
ul:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 2 rgb_color ${1:3} ;;
|
||||
ul:[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]) make_color 2 rgb_color ${1:3} ;;
|
||||
|
||||
fg:*) make_color 0 named_color ${1:3} ;;
|
||||
bg:*) make_color 1 named_color ${1:3} ;;
|
||||
ul:*) make_color 2 named_color ${1:3} ;;
|
||||
*) make_color 0 named_color $1 ;;
|
||||
esac
|
||||
if [[ ! -z ${output} ]]
|
||||
|
@ -72,11 +72,12 @@ set bright_white="$csi$ansi_bright;$ansi_white$ansi_color"
|
||||
# True colour support #
|
||||
#######################
|
||||
|
||||
# The idea behind a true colour variable is that you run: `color_from_hex ff0077` and it expands to
|
||||
# The idea behind a true colour variable is that you run: `__build_sgr_code ff0077` and it expands to
|
||||
# a proper colour sequence for a 24-bit color. The shell script which computes these will also attempt to
|
||||
# compute a rounded version of your color for use with 8-bit color and a weaker rounded form for use
|
||||
# with 3 and 4 bit color.
|
||||
# compute a rounded version of your color for use with 8-bit colour and a weaker rounded form for use
|
||||
# with 3 and 4 bit colour. It does this based upon your terminal colour depth.
|
||||
|
||||
set sgr_reset="[`__build_sgr_code no-csi reset`m"
|
||||
|
||||
###########################
|
||||
# vim:filetype=tcsh
|
||||
|
@ -2,40 +2,25 @@
|
||||
### PROMPT COLOURS ###
|
||||
######################
|
||||
|
||||
# Note - It is not recommended to edit this. These are the default values.
|
||||
# Edit your `.user` or other config files to override these.
|
||||
|
||||
set date_color="${dim_magenta}"
|
||||
set time_color="${bright_magenta}"
|
||||
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 line_color="${dim_red}"
|
||||
set prompt_color="${dim}"
|
||||
set depth_color="${dim_yellow}"
|
||||
set command_color="${dim}"
|
||||
set date_color="ansi:5"
|
||||
set time_color="ansi:13"
|
||||
set text_color="reset"
|
||||
set brace_color="ansi:11"
|
||||
set host_color="ansi:12"
|
||||
set user_color="ansi:14"
|
||||
set at_color="ansi:6"
|
||||
set path_color="ansi:10"
|
||||
set line_color="ansi:1"
|
||||
set prompt_color="reset"
|
||||
set depth_color="ansi:3"
|
||||
set percent_color="ansi:6"
|
||||
#${csi}3;4;38;2;255;192;192;58;2;255;255;255m%}
|
||||
set branch_color="underline italic ffc0c0 ul:white"
|
||||
|
||||
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}"
|
||||
set command_color_seq="${color_start}${command_color}${color_end}"
|
||||
|
||||
|
||||
set oldp_color="${color_start}${dim_white}${color_end}"
|
||||
alias load_default_prompt_colors source ${CSHENV_DIR}/tcshrc.prompt.colors
|
||||
|
||||
###########################
|
||||
# vim:filetype=tcsh
|
||||
|
@ -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 )
|
||||
|
||||
@ -105,16 +106,15 @@ alias precmd 'source ${CSHENV_DIR}/tcshrc.prompt.final'
|
||||
|
||||
set promptchars='%#'
|
||||
|
||||
set prompt_simple="${oldp_color_seq}[%n@%m: %c]%# "
|
||||
set prompt_simple="%{${sgr_reset}%}[%n@%m: %c]%# "
|
||||
|
||||
# Screens are almost certainly not a million chars wide.
|
||||
# If they are... oh well, that's a really weird one.
|
||||
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
|
||||
@ -122,14 +122,15 @@ if( $?CSHENV_DEBUG ) then
|
||||
endif
|
||||
|
||||
|
||||
set depth_prompt="${depth_color_seq}(${shlvl})"
|
||||
set depth_prompt="(${shlvl})"
|
||||
|
||||
#we "convert" pts/$number entries to ttypK entries?
|
||||
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 end_prompt="${prompt_color_seq}%#${command_color_seq} "
|
||||
set line_prompt="`tty | sed -e 's;/dev/tty;;' -e 's;/dev/pts/;p/;' -e 's;/dev/;;' -e 's/not a tty/${unknown_tty}/'`"
|
||||
#set line_prompt="line"
|
||||
set user_prompt="%n"
|
||||
set host_prompt="${CSHENV_HOSTNAME}"
|
||||
set path_prompt="%c02"
|
||||
set end_prompt="%#"
|
||||
|
||||
alias oldp 'set prompt="$prompt_simple"; set cshenv_user_prompt_override'
|
||||
alias newp 'set prompt="$prompt_cool"; set cshenv_user_prompt_override'
|
||||
|
@ -1,6 +1,122 @@
|
||||
############################
|
||||
### Final Prompt Setting ###
|
||||
############################
|
||||
|
||||
if( $?CSHENV_DEBUG ) then
|
||||
echo "Setting up dynamic colour loading..."
|
||||
endif
|
||||
|
||||
# Recompute cached sgr codes from any configuration updates
|
||||
if( ! $?curr_branch_color ) then
|
||||
set curr_branch_color=impossible
|
||||
endif
|
||||
if( "${curr_branch_color}" != "${branch_color}" ) then
|
||||
set curr_branch_color="${branch_color}"
|
||||
set branch_color_seq="%{[`__build_sgr_code no-csi reset ${curr_branch_color}`m"
|
||||
endif
|
||||
|
||||
|
||||
if( ! $?curr_percent_color ) then
|
||||
set curr_percent_color=impossible
|
||||
endif
|
||||
if( "${curr_percent_color}" != "${percent_color}" ) then
|
||||
set curr_percent_color="${percent_color}"
|
||||
set percent_color_seq="[`__build_sgr_code no-csi reset ${curr_percent_color}`m"
|
||||
endif
|
||||
|
||||
if( ! $?curr_at_color ) then
|
||||
set curr_at_color=impossible
|
||||
endif
|
||||
if( "${curr_at_color}" != "${at_color}" ) then
|
||||
set curr_at_color="${at_color}"
|
||||
set at_color_seq="%{[`__build_sgr_code no-csi reset ${curr_at_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_depth_color ) then
|
||||
set curr_depth_color=impossible
|
||||
endif
|
||||
if( "${curr_depth_color}" != "${depth_color}" ) then
|
||||
set curr_depth_color="${depth_color}"
|
||||
set depth_color_seq="%{[`__build_sgr_code no-csi reset ${curr_depth_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_line_color ) then
|
||||
set curr_line_color=impossible
|
||||
endif
|
||||
if( "${curr_line_color}" != "${line_color}" ) then
|
||||
set curr_line_color="${line_color}"
|
||||
set line_color_seq="%{[`__build_sgr_code no-csi reset ${curr_line_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_path_color ) then
|
||||
set curr_path_color=impossible
|
||||
endif
|
||||
if( "${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_host_color ) then
|
||||
set curr_host_color=impossible
|
||||
endif
|
||||
if( "${curr_host_color}" != "${host_color}" ) then
|
||||
set curr_host_color="${host_color}"
|
||||
set host_color_seq="%{[`__build_sgr_code no-csi reset ${curr_host_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_date_color ) then
|
||||
set curr_date_color=impossible
|
||||
endif
|
||||
if( "${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}" != "${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( ! $?curr_text_color ) then
|
||||
set curr_text_color=impossible
|
||||
endif
|
||||
if( "${curr_text_color}" != "${text_color}" ) then
|
||||
set curr_text_color="${text_color}"
|
||||
set text_color_seq="[`__build_sgr_code no-csi reset ${curr_text_color}`m"
|
||||
endif
|
||||
|
||||
if( ! $?curr_brace_color ) then
|
||||
set curr_brace_color=impossible
|
||||
endif
|
||||
if( "${curr_brace_color}" != "${brace_color}" ) then
|
||||
set curr_brace_color="${brace_color}"
|
||||
set brace_color_seq="%{[`__build_sgr_code no-csi reset ${curr_brace_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_user_color ) then
|
||||
set curr_user_color=impossible
|
||||
endif
|
||||
if( "${curr_user_color}" != "${user_color}" ) then
|
||||
set curr_user_color="${user_color}"
|
||||
set user_color_seq="%{[`__build_sgr_code no-csi reset ${curr_user_color}`m%}"
|
||||
endif
|
||||
|
||||
if( ! $?curr_prompt_color ) then
|
||||
set curr_prompt_color=impossible
|
||||
endif
|
||||
if( "${curr_prompt_color}" != "${prompt_color}" ) then
|
||||
set curr_prompt_color="${prompt_color}"
|
||||
set prompt_color_seq="%{[`__build_sgr_code no-csi reset ${curr_prompt_color}`m%}"
|
||||
endif
|
||||
|
||||
if( $?CSHENV_DEBUG ) echo "Dynamic color loading processed..."
|
||||
|
||||
|
||||
if( ${prompt_hcolor} != 0 ) then
|
||||
set last_color = ${reference_colors[${prompt_hcolor}]}
|
||||
endif
|
||||
@ -18,6 +134,7 @@ set medium_battery_level = 50
|
||||
set strong_battery_level = 75
|
||||
|
||||
|
||||
|
||||
while( ${prompt_hcolor} == 0 )
|
||||
if( $?CSHENV_DEBUG ) then
|
||||
echo colorshuffle
|
||||
@ -110,7 +227,7 @@ if( $?CSHENV_SHOW_BATTERY_LEVEL ) then
|
||||
|
||||
#set battery_prompt="%{${battery_color}%}%{${battery_level}${at_color}\%%}%{${dim}%} "
|
||||
set battery_prefix="%{${csi}m${csi}28D%}"
|
||||
set battery_prompt="%{${csi}38;2;128;128;255;3mBattery Level:${dim} ${battery_color}${battery_level}${at_color}\%${dim} %}"
|
||||
set battery_prompt="%{${csi}38;2;128;128;255;3mBattery Level:${sgr_reset} ${battery_color}${battery_level}${percent_color_seq}%${sgr_reset} %}"
|
||||
else
|
||||
set battery_prefix=""
|
||||
set battery_prompt=""
|
||||
@ -134,7 +251,7 @@ if( 0 == ${__res} ) then
|
||||
# I could always fallback to this one... (keep padded spaces... for alignment)
|
||||
set branch_symbol=`printf '\u2387\ \ \ '`
|
||||
|
||||
set git_prompt="%{${csi}0;60m%}(${branch_symbol} %{${csi}3;4;38;2;255;192;192;58;2;255;255;255;68;2;255;255;255m%}${git_branch}%{${csi}m%}) "
|
||||
set git_prompt="%{${sgr_reset}%}(${branch_symbol} %{${branch_color_seq}%}${git_branch}%{${sgr_reset}%}) "
|
||||
#set git_prompt="%{${csi}10D${csi}2D(xyz${git_branch})${csi}m%%}"
|
||||
#set git_prompt="%{${csi}0;35m${csi}50D${git_branch} %}"
|
||||
endif
|
||||
@ -145,7 +262,7 @@ endif
|
||||
set prompt_reference_view=""
|
||||
set line_prompt_view=""
|
||||
set depth_prompt_view=""
|
||||
set user_prompt_view
|
||||
set user_prompt_view=""
|
||||
set at_view=""
|
||||
set host_prompt_view=""
|
||||
set git_prompt_view=""
|
||||
@ -156,15 +273,15 @@ if( ! $?CSHENV_DISABLE_PROMPT_SIGIL ) then
|
||||
set prompt_reference_view="${prompt_reference}"
|
||||
endif
|
||||
if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then
|
||||
set line_prompt_view="${line_prompt}"
|
||||
set line_spacer_view="${text_color_seq}\- "
|
||||
set line_prompt_view="${line_color_seq}${line_prompt}"
|
||||
set line_spacer_view="%{${text_color_seq}%}\- "
|
||||
endif
|
||||
if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then
|
||||
set depth_prompt_spacing=""
|
||||
if( ! $?CSHENV_DISABLE_PROMPT_TTY ) then
|
||||
set depth_prompt_spacing=" "
|
||||
endif
|
||||
set depth_prompt_view="${depth_prompt_spacing}${depth_prompt}"
|
||||
set depth_prompt_view="${depth_color_seq}${depth_prompt_spacing}${depth_prompt}"
|
||||
if( $?CSHENV_HIDE_SHELL_LEVEL_AT_ONE ) then
|
||||
if( ${shlvl} == 1 ) then
|
||||
set depth_prompt_view=""
|
||||
@ -172,7 +289,7 @@ if( ! $?CSHENV_DISABLE_PROMPT_NESTING ) then
|
||||
endif
|
||||
endif
|
||||
if( ! $?CSHENV_DISABLE_PROMPT_USER ) then
|
||||
set user_prompt_view="${user_prompt}"
|
||||
set user_prompt_view="${user_color_seq}${user_prompt}%{${sgr_reset}%}"
|
||||
if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
|
||||
set at_view="${at_color_seq}@"
|
||||
endif
|
||||
@ -182,16 +299,16 @@ if( ! $?CSHENV_DISABLE_PROMPT_HOST ) then
|
||||
if( $?CSHENV_DISABLE_PROMPT_GIT && $?CSHENV_DISABLE_PROMPT_PATH ) then
|
||||
set host_prompt_tail=""
|
||||
endif
|
||||
set host_prompt_view="${host_prompt}${text_color_seq}${host_prompt_tail}"
|
||||
set host_prompt_view="${host_color_seq}${host_prompt}%{${text_color_seq}%}${host_prompt_tail}"
|
||||
endif
|
||||
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}\[%{${sgr_reset}%}${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}\]%{${sgr_reset}%}${prompt_color_seq}${end_prompt}%{${sgr_reset}${text_color_seq}%} "
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user