tarch-misc/misc/bin/scripts/system/style
Andrey Zimin 61a16825e4 add bin
2024-03-10 13:58:36 +03:00

90 lines
2.0 KiB
Bash
Executable File

#!/bin/zsh
RESET_COLOR="\033[0m"
BOLD="\033[1m"
ITALIC="\033[3m"
BLACK="\033[30m"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[34m"
MAGENTA="\033[35m"
CYAN="\033[36m"
WHITE="\033[37m"
PURPLE="\033[35m"
# для специфического цвета запусить в терминал
# showcolors256 или showcolors256 fg
# выбрать код цвет аи вставить тут или в коде
code_color_0=245
code_color_1=245
code_color_2=031
COLOR_BUILD_0="\033[38;5;${code_color_0}m";
COLOR_BUILD_1="\033[38;5;${code_color_1}m";
COLOR_BUILD_2="\033[38;5;${code_color_2}m";
function showcolors256() {
local row col blockrow blockcol red green blue
local showcolor=_showcolor256_${1:-bg}
local white="\033[1;37m"
local reset="\033[0m"
echo -e "Set foreground color: \\\\033[38;5;${white}NNN${reset}m"
echo -e "Set background color: \\\\033[48;5;${white}NNN${reset}m"
echo -e "Reset color & style: \\\\033[0m"
echo
echo 16 standard color codes:
for row in {0..1}; do
for col in {0..7}; do
$showcolor $(( row*8 + col )) $row
done
echo
done
echo
echo 6·6·6 RGB color codes:
for blockrow in {0..2}; do
for red in {0..5}; do
for blockcol in {0..1}; do
green=$(( blockrow*2 + blockcol ))
for blue in {0..5}; do
$showcolor $(( red*36 + green*6 + blue + 16 )) $green
done
echo -n " "
done
echo
done
echo
done
echo 24 grayscale color codes:
for row in {0..1}; do
for col in {0..11}; do
$showcolor $(( row*12 + col + 232 )) $row
done
echo
done
echo
}
function _showcolor256_fg() {
local code=$( printf %03d $1 )
echo -ne "\033[38;5;${code}m"
echo -nE " $code "
echo -ne "\033[0m"
}
function _showcolor256_bg() {
if (( $2 % 2 == 0 )); then
echo -ne "\033[1;37m"
else
echo -ne "\033[0;30m"
fi
local code=$( printf %03d $1 )
echo -ne "\033[48;5;${code}m"
echo -nE " $code "
echo -ne "\033[0m"
}