Added colours script
This commit is contained in:
		
							
								
								
									
										33
									
								
								colours
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										33
									
								
								colours
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,33 @@
 | 
				
			|||||||
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Print out escape sequences usable for coloured text on tty.
 | 
				
			||||||
 | 
					printf 'Colour escapes are %s\n' '\e[${value};...;${value}m'
 | 
				
			||||||
 | 
					printf 'Values 30..37 are \e[33mforeground colours\e[m\n'
 | 
				
			||||||
 | 
					printf 'Values 40..47 are \e[43mbackground colours\e[m\n'
 | 
				
			||||||
 | 
					printf 'Value  1 gives a  \e[1mbold look\e[m\n'
 | 
				
			||||||
 | 
					printf 'Value  2 gives a  \e[2mdim look\e[m\n'
 | 
				
			||||||
 | 
					printf 'Value  3 gives a  \e[3mitalic look\e[m\n'
 | 
				
			||||||
 | 
					printf 'Value  4 gives a  \e[4munderlined look\e[m\n'
 | 
				
			||||||
 | 
					printf 'Value  5 gives a  \e[5mblinking look\e[m\n\n'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# foreground colours
 | 
				
			||||||
 | 
					for fgc in {30..37}; do
 | 
				
			||||||
 | 
						# background colours
 | 
				
			||||||
 | 
						for bgc in {40..47}; do
 | 
				
			||||||
 | 
							fgc=${fgc#37} # white
 | 
				
			||||||
 | 
							bgc=${bgc#40} # black
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							vals="${fgc:+$fgc;}${bgc}"
 | 
				
			||||||
 | 
							vals=${vals%%;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							seq0="${vals:+\e[${vals}m}"
 | 
				
			||||||
 | 
							printf " %-9s" "${seq0:-(default)}"
 | 
				
			||||||
 | 
							echo -e -n " ${seq0}TEXT\e[m"
 | 
				
			||||||
 | 
							echo -e -n " \e[${vals:+${vals+$vals;}}1mBOLD\e[m"
 | 
				
			||||||
 | 
							echo -e -n " \e[${vals:+${vals+$vals;}}2mDIM\e[m"
 | 
				
			||||||
 | 
							echo -e -n " \e[${vals:+${vals+$vals;}}3mITA\e[m"
 | 
				
			||||||
 | 
							echo -e -n " \e[${vals:+${vals+$vals;}}4mUND\e[m"
 | 
				
			||||||
 | 
							echo -e -n " \e[${vals:+${vals+$vals;}}5mBLI\e[m"
 | 
				
			||||||
 | 
						done
 | 
				
			||||||
 | 
						echo; echo
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
		Reference in New Issue
	
	Block a user