What strings are allowed to represent colors in Qt stylesheets?
Asked Answered
T

1

7

I am trying to change the color of some labels in pyqt5 by setting their style sheets like so:

background-color : lightblue

My problem is I don't know what colors I am allowed to use. For example, 'lightblue' works but 'lightred' does not. Is there some sort of lookup table somewhere with accepted color string values?

Tarr answered 5/6, 2020 at 16:41 Comment(0)
F
10

As the QColor documentation explains, it follows the SVG color names specification, and the Qt stylesheet parser follows the same rule.

You can find the whole list of available colors in the "Recognized color keyword names" chapter of the SVG 1.0 specification.

Freezedrying answered 5/6, 2020 at 16:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.