Skip to content

Instantly share code, notes, and snippets.

@MHenderson
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save MHenderson/3de362f0ceecabf8ade8 to your computer and use it in GitHub Desktop.

Select an option

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.
!#/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
#!/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