Browse Source

slightly optimize print256colours

Von Random 2 months ago
parent
commit
75da38d8d8
1 changed files with 1 additions and 3 deletions
  1. 1
    3
      print256colours.sh

+ 1
- 3
print256colours.sh View File

@@ -51,9 +51,7 @@ function contrast_colour {
51 51
 function print_colour {
52 52
     local colour="$1" contrast
53 53
     contrast=$(contrast_colour "$1")
54
-    printf "\\e[48;5;%sm" "$colour"                # Start block of colour
55
-    printf "\\e[38;5;%sm%3d" "$contrast" "$colour" # In contrast, print number
56
-    printf "\\e[0m "                               # Reset colour
54
+    printf "\\e[38;5;%s;48;5;%sm%3d\\e[0m " "$contrast" "$colour" "$colour"
57 55
 }
58 56
 
59 57
 # Starting at $1, print a run of $2 colours

Loading…
Cancel
Save