From f1cc46812bbefa977f59e7b9926c5a3bcdd6e626 Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 16 Apr 2022 17:53:54 +0200 Subject: [PATCH] added RGB 24-bit colour support automatic detection --- .tmux.conf | 16 ++++++++++++++-- .tmux.conf.local | 9 +++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 3046fb3..961e6b3 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -712,9 +712,21 @@ run 'cut -c3- ~/.tmux.conf | sh -s _apply_configuration' # } # # _apply_overrides() { -# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-false} +# tmux_conf_theme_24b_colour=${tmux_conf_theme_24b_colour:-auto} # tmux_conf_24b_colour=${tmux_conf_24b_colour:-$tmux_conf_theme_24b_colour} -# if _is_enabled "$tmux_conf_24b_colour"; then +# if [ x"$tmux_conf_24b_colour" = x"auto" ]; then +# case "$COLORTERM" in +# truecolor|24bit) +# apply_overrides=true +# ;; +# esac +# if [ x"$apply_overrides" = x"" ] && [ x"$(tput colors)" = x"16777216" ]; then +# apply_overrides=true +# fi +# elif _is_enabled "$tmux_conf_24b_colour"; then +# apply_overrides=true +# fi +# if [ x"$apply_overrides" = x"true" ]; then # case "$TERM" in # screen-*|tmux-*) # ;; diff --git a/.tmux.conf.local b/.tmux.conf.local index 515bc31..45725ae 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -42,8 +42,13 @@ tmux_conf_new_session_prompt=false # RGB 24-bit colour support (tmux >= 2.2), possible values are: # - true -# - false (default) -tmux_conf_24b_colour=false +# - false +# - auto (default) +# +# automatic detection relies on the COLORTERM environment variable being defined +# to 'truecolor' or '24bit' or '$ tput colors' answering '16777216' +# see https://github.com/termstandard/colors +tmux_conf_24b_colour=auto # default theme tmux_conf_theme_colour_1="#080808" # dark gray