Improve colorallocation with the static method getColor.