python.utils.color module

color_mix(c1, c1_strength, c2, c2_strength)[source]

Convenience method for making a color from 2 existing colors.

This is primarily used to prevent hardcoding of colors that don’t work in other color palettes. The idea is that you can provide a color from the current widget palette and shift it toward another color. For example, you could get a red-shifted text color by supplying the windowText color for a widget as color 1, and the full red as color 2. Then use the strength args to weight the resulting color more toward the windowText or full red. It’s still important to test the resulting colors in multiple color schemes.

Parameters:
  • c1 – QtGui.QColor 1
  • c1_strength – int factor of the strength of this color
  • c2 – QtGui.QColor 2
  • c2_strength – int factor of the strength of this color
Returns:

The mixed color.

Return type:

QtGui.QColor