Consider putting this logic in a readColor function that takes a key and a default value.  Also consider making a dictionary cache so we're not constantly parsing color strings (as long as these aren't used in loops though that shouldn't matter).