extract test result coloring logic.