Verified Commit eed53615 authored by Chris Stevens's avatar Chris Stevens
Browse files

Change color script to awk; add comments to tmux.conf

parent 60f98902
......@@ -100,8 +100,11 @@ For PuTTY you'll need to go to :guilabel:`Configuration` -> :guilabel:`Connectio
# term
#
# Set tmux-256color for tmux for reasons: https://github.com/tmux/tmux/wiki/FAQ
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color*:Tc"
# Make sure true color capability "Tc" is set for xterm
set -ga terminal-overrides ",xterm*:Tc"
#
# powerline
......@@ -109,50 +112,23 @@ For PuTTY you'll need to go to :guilabel:`Configuration` -> :guilabel:`Connectio
source /lib/python3.10/site-packages/powerline/bindings/tmux/powerline.conf
Python color test script
------------------------
Here's a python script to make sure your terminal is working with 256 colors. You may want to run this script both before and after running tmux to verify colors are working correctly
.. code-block:: python
import sys
import os
def echo(msg):
os.system('echo -n "' + str(msg) + '"')
def out(n):
os.system("tput setab " + str(n) + "; echo -n " + ("\"% 4d\"" % n))
os.system("tput setab 0")
Color test script
-----------------
# normal colors 1 - 16
os.system("tput setaf 16")
for n in range(8):
out(n)
echo("\n")
for n in range(8, 16):
out(n)
Here's a script to make sure your terminal is working with true color. You may want to run this script both before and after running tmux to verify colors are working correctly
echo("\n")
echo("\n")
y=16
while y < 231:
for z in range(0,6):
out(y)
y += 1
echo("\n")
echo("\n")
for n in range(232, 256):
out(n)
if n == 237 or n == 243 or n == 249:
echo("\n")
.. code-block:: shell
echo("\n")
os.system("tput setaf 7")
os.system("tput setab 0")
awk -v term_cols="${width:-$(tput cols || echo 80)}" 'BEGIN{
s="/\\";
for (colnum = 0; colnum<term_cols; colnum++) {
r = 255-(colnum*255/term_cols);
g = (colnum*510/term_cols);
b = (colnum*255/term_cols);
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%2+1,1);
}
printf "\n";
}'
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment