I do not know what the problem is; that code has not changed in many years. Perhaps you're running Wayland and it is mixing colors (via a sort of transparency effect I guess, like happens on a Mac).