Extract top-level defines for colors.
Move helper functions into separate modules.