-
Notifications
You must be signed in to change notification settings - Fork 0
tput
holzkohlengrill edited this page Dec 15, 2023
·
2 revisions
Guide still missing
For now refer to: http://linuxcommand.org/lc3_adv_tput.php
# Get number of lines and columns in current window
tput lines
tput cols
# Position cursor and print "Hello" centered
clear
tput cup $(expr $(tput lines) / 2) $(expr $(tput cols) / 2); printf HELLO
# Definitions
BLACK=$(tput setaf 0)
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
LIME_YELLOW=$(tput setaf 190)
POWDER_BLUE=$(tput setaf 153)
BLUE=$(tput setaf 4)
MAGENTA=$(tput setaf 5)
CYAN=$(tput setaf 6)
WHITE=$(tput setaf 7)
BRIGHT=$(tput bold)
NORMAL=$(tput sgr0)
BLINK=$(tput blink)
REVERSE=$(tput smso)
UNDERLINE=$(tput smul)
# Example Usage
printf "%40s\n" "${BLUE}This text is blue${NORMAL}"
- http://linuxcommand.org/lc3_adv_tput.php (Main source)
- https://www.cheatography.com/chrissoper1/cheat-sheets/bash-script-colors/ (cheat sheet - does not contain everything findable in "Main soruce")
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License *.
Code (snippets) are licensed under a MIT License *.
* Unless stated otherwise