Last active
August 29, 2015 14:01
-
-
Save MHenderson/3de362f0ceecabf8ade8 to your computer and use it in GitHub Desktop.
Apply a colouring from Culberson's colouring programs output to a file in DOT format.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !#/bin/bash | |
| r=1 # colouring number. Look at row 2r of the .res file. | |
| n=1 | |
| p=$(( 2 * r )) | |
| s=`sed "$p!d" $1` #generalise from 2 to 2r | |
| while [ -n "$s" ] | |
| do | |
| temp=${s#?} | |
| char=${s%"$temp"} | |
| if [ "$char" != " " ]; then | |
| colour=`palette $char` # set colour based on current label value | |
| printf "$n [style=filled, color=$colour];\n" | |
| n=$((n+1)) | |
| fi | |
| s=$temp | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| case $1 in | |
| 1) COLOUR=red ;; | |
| 2) COLOUR=blue ;; | |
| 3) COLOUR=green ;; | |
| 4) COLOUR=yellow ;; | |
| 5) COLOUR=orange;; | |
| 6) COLOUR=maroon ;; | |
| 7) COLOUR=teal ;; | |
| *) COLOUR=black ;; | |
| esac | |
| echo $COLOUR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment