I just figured out how to change the color from the icon to any other color. Therefore, the icon image should consist of one solid color (here: "black"), which can be converted using pixmap and its masking ability into another color (for example, "red"):
pixmap = QPixmap(filename) mask = pixmap.createMaskFromColor(QColor('black'), Qt.MaskOutColor) pixmap.fill((QColor('red'))) pixmap.setMask(mask) btNew = QToolButton() btNew.setIcon(QIcon(pixmap))
source share