That logic does not belong in the foreground color computation.
In its current state, the logic is broken for cases such as icon-only command buttons in disabled state, as the text check short circuits the logic, returns null, and that is then treated to draw the icon with enabled state visuals.
That logic does not belong in the foreground color computation.
In its current state, the logic is broken for cases such as icon-only command buttons in disabled state, as the text check short circuits the logic, returns null, and that is then treated to draw the icon with enabled state visuals.