From 4090b92ac461448c28cb903f685226fc9e0266d9 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 3 Jun 2021 23:39:32 +0900 Subject: Enable truecolor (24-bit color) in terminal --- .tmux.conf | 8 +++++++- .vimrc | 6 +++--- .zshrc | 17 +++++++++++++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 7508c9d..afc36f8 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -12,7 +12,13 @@ # BASICS {{{2 set-option -g base-index 1 set-option -g pane-base-index 1 -set-option -g default-shell /bin/zsh +set-option -g default-shell /usr/local/bin/zsh + +# TERMINAL FEATURES {{{2 +set-option -g default-terminal screen-256color +set-option -ga terminal-overrides ',xterm-256color:Tc' +set-option -ga terminal-overrides ',*:Smulx=\e[4::%p1%dm' +set-option -ga terminal-overrides ',*:Setulc=\e[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # APPEARANCE {{{2 set-option -g status-justify centre diff --git a/.vimrc b/.vimrc index b27e206..0c18da5 100644 --- a/.vimrc +++ b/.vimrc @@ -148,9 +148,9 @@ set hlsearch " .vimrc. nohlsearch if exists('+termguicolors') - if g:MY_ENV.os ==# 'mac' - set termguicolors - endif + let &t_8f="\[38;2;%lu;%lu;%lum" + let &t_8b="\[48;2;%lu;%lu;%lum" + set termguicolors endif set t_Co=256 set nocursorline diff --git a/.zshrc b/.zshrc index 2f61594..640ab96 100644 --- a/.zshrc +++ b/.zshrc @@ -313,6 +313,23 @@ function 256colors() { done } +function truecolors() { + awk 'BEGIN{ + s="/\\/\\/\\/\\/\\"; s=s s s s s s s s; + for (colnum = 0; colnum < 77; colnum++) { + r = 255 - (colnum * 255 / 76); + g = (colnum * 510 / 76); + b = (colnum * 255 / 76); + if (g > 255) + g = 510 - g; + printf "\033[48;2;%d;%d;%dm", r, g, b; + printf "\033[38;2;%d;%d;%dm", 255 - r, 255 - g, 255 - b; + printf "%s\033[0m", substr(s, colnum + 1, 1); + } + printf "\n"; + }' +} + # noxxx on => xxx off -- cgit v1.2.3-70-g09d2