Backport module colour fixes from #1084 to v3.0

Cherry picked the commits as requested in #1093