dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 590c77ff7bd5c572f5acae7991b147f622b2a2dc
parent 9fec4adb6b68b0811f993f32bec9e78d66a3b297
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Tue,  5 Mar 2019 18:24:40 +0100

Script to easily view color table for tput


Former-commit-id: 8ab9689bcdc4b1df9c035407e2b1ed5a370860b3
Diffstat:
Ascripts/tput-colors | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/scripts/tput-colors b/scripts/tput-colors @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +if ! command -v tput &> /dev/null; then + echo "tput not installed." + exit 1 +fi + +if ! [[ "$1" =~ ^[0-9]+$ ]]; then + echo "Usage: tput-colors [number]" + exit 1 +fi +tput init &> /dev/null +hr() { tput sgr0; for ((i=0; i<$(tput cols); i++)); do echo -n "#"; done; echo; } +hr +echo "Colors for tput:" +hr +if [ $# -eq 0 ]; then + for ((i=1; i<=$(tput colors); i++)); do + echo "$(tput sgr0)$i $(tput setaf $i)sample text" + done +else + for ((i=1; i<=$1; i++)); do + echo "$(tput sgr0)$i $(tput setaf $i)sample text" + done +fi +hr