Implements color assignment for visualization.