The semantic colors of one theme, derived from a QPalette and a tinge. More...
| Header: | #include <SemanticPalette> |
| QColor | categoryTone(int index, int count) const |
| QColor | categoryTone(const QColor &seed, const QColor &background, int index, int count) |
SemanticPalette holds the role colors, such as danger and success, the syntax highlighting colors and the item tones. generate() derives every color from the window colors, the highlight and the node's tinge, so the roles match the active theme and keep readable contrast. StyleManager generates one palette per tinge when it applies a style, and registers it with registerPalette(). The registry holds each palette as a std::shared_ptr<const SemanticPalette>, so a palette is immutable once it is registered, and a reader can keep its pointer after the style changes.
A consumer asks for a palette when it draws: forWidget() finds the one whose window color matches the widget or an ancestor, forTinge() looks one up by tinge, and current() returns the most recently registered palette. If nothing is registered yet, current() generates a default palette and registers it. A read-write lock guards the registry.
See also Typography and OctoStyle.
Returns the tone of category index of count against this palette's window, from its tinge (config-ui §CFGU-5).
[static] QColor SemanticPalette::categoryTone(const QColor &seed, const QColor &background, int index, int count)Returns the tone of category index of count, with hues spread from seed and the contrast measured against background.
Even and odd indices take two lightness bands: lighter on a dark background, darker on a light one. So two neighbors differ in lightness as well as in hue. Each tone then moves to the nearest lightness that reaches kCategoryContrast, and an odd tone moves further from its even neighbor until the two differ by kCategoryLuminanceStep.