Because an MD5 hash is typically expressed as a hexadecimal number, 32 digits long *, all you need to do is cut 6 characters to get a color value.
COLOR=`echo $SVG | md5sum | cut -c 1-6`
To convert any string to a color value, just reduce it to the appropriate characters (= a-f and 0–9), pad it with an actual hex value (= ff0000 in this case) to ensure you get a minimum of 6 characters and cut 6 characters.
STRING=`shuf -n 1 /usr/share/dict/words` COLOR=`echo \`echo $STRING | \ sed 's/[^a-fA-F0-9]*//g'\`ff0000 |\ cut -c 1-6` echo $COLOR;