mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-11 04:23:29 -08:00
[Icons] Add a badge icon treatment
Restore the filled-disc look the ready/not-ready icons had before the one-glyph cutover, without bringing back palette-locked art. IconStyle::Badge composes the existing sentinel SVG at paint time: a gradient disc, a dark ring, and the glyph re-weighted and inked for contrast against the tone. Line stays the default and is unchanged. Only the two state icons opt in. The add/remove icons keep the line treatment because their old art was a filled glyph with an outline and no disc, so badging them would invent a look the UI never had. Disabled badges fall back to the line glyph so an unavailable control still reads as unavailable.
This commit is contained in:
parent
76c8d8868a
commit
717f64a88b
9 changed files with 610 additions and 51 deletions
|
|
@ -16,6 +16,32 @@
|
|||
#include <QString>
|
||||
#include <QStringView>
|
||||
|
||||
/**
|
||||
* @brief Selects how a `currentColor` glyph is painted.
|
||||
*
|
||||
* Style is a treatment, not a color: the tint still decides the tone, and the
|
||||
* style decides how much shape carries that tone.
|
||||
*
|
||||
* Line is the default and the behavior every caller had before the axis
|
||||
* existed: the recolored glyph alone, at the author's stroke weight. It stays
|
||||
* the right choice for navigation, menu and toolbar glyphs, where a row of
|
||||
* badges would outshout the content.
|
||||
*
|
||||
* Badge reproduces the pre-#7595 ready/not-ready art: a filled disc, a dark ring
|
||||
* and a contrast glyph derived from the tone. It costs attention as a filled
|
||||
* shape, so it is opt-in per call site and it is not a generic semantic
|
||||
* treatment: the add/remove/delete icons were filled glyphs with an outline and
|
||||
* no disc, so badging them would invent a look the UI never had. Authored art
|
||||
* that carries its own colors is never badged; it falls back to the asset path.
|
||||
* Disabled icons also fall back to the line glyph, because a filled disc at full
|
||||
* mass does not read as unavailable.
|
||||
*/
|
||||
enum class IconStyle
|
||||
{
|
||||
Line, // the recolored glyph alone
|
||||
Badge, // filled disc + dark ring + contrast glyph
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Selects the color that replaces the `currentColor` sentinel.
|
||||
*
|
||||
|
|
@ -64,9 +90,11 @@ private:
|
|||
* extension (for example `icons/search`), matching themePixmap().
|
||||
* @param tint Color that replaces the sentinel: a palette role or a semantic
|
||||
* application color. Defaults to WindowText.
|
||||
* @param style Treatment of the glyph: a line, or the badge shape that keeps
|
||||
* the pre-migration filled-art reading. Defaults to Line.
|
||||
* @return An icon that follows the application palette.
|
||||
*/
|
||||
QIcon loadThemedIcon(QStringView prefix, IconTint tint = {});
|
||||
QIcon loadThemedIcon(QStringView prefix, IconTint tint = {}, IconStyle style = IconStyle::Line);
|
||||
|
||||
/**
|
||||
* @brief Renders a resolved theme SVG when it carries the `currentColor` sentinel.
|
||||
|
|
@ -79,9 +107,14 @@ QIcon loadThemedIcon(QStringView prefix, IconTint tint = {});
|
|||
* @param tint Color that replaces the sentinel: a palette role or a semantic
|
||||
* application color. Defaults to WindowText.
|
||||
* @param size Pixel size to render at; an empty size uses the SVG's intrinsic size.
|
||||
* @param style Treatment of the glyph: a line, or a badge. A badge on a
|
||||
* non-sentinel asset stays null, like the line path.
|
||||
* @return The recolored pixmap, or a null pixmap when the asset is not a
|
||||
* sentinel-carrying SVG.
|
||||
*/
|
||||
QPixmap loadSentinelSvgPixmap(const QString &resolvedPath, IconTint tint = {}, const QSize &size = {});
|
||||
QPixmap loadSentinelSvgPixmap(const QString &resolvedPath,
|
||||
IconTint tint = {},
|
||||
const QSize &size = {},
|
||||
IconStyle style = IconStyle::Line);
|
||||
|
||||
#endif // THEME_ICON_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue