summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/carddelegate.cpp34
-rw-r--r--src/carddelegate.h31
2 files changed, 44 insertions, 21 deletions
diff --git a/src/carddelegate.cpp b/src/carddelegate.cpp
index f13205e..bce9eec 100644
--- a/src/carddelegate.cpp
+++ b/src/carddelegate.cpp
@@ -58,16 +58,32 @@ QColor CardDelegate::accentLineColour(const QColor &accountColour)
// at (0.18, 0.22, 0.26), which is the background. The weight is a fraction
// OF THE ACCOUNT COLOUR, so a low one keeps the background, not the hue.
//
- // The bar is the account's colour, undiluted. Blending it toward Base at
- // all was the mistake: a chip's colour is chosen to carry text on top and
- // is therefore already muted, and three pixels of a muted colour on a dark
- // background is nothing at all. There is no text on this bar, so nothing
- // needs the contrast a chip's fill was picked for.
+ // The account's own hue, lifted to a floor of saturation and lightness.
//
- // What DOES step back is the spine, below: a line running the height of a
- // whole expansion has to be followable without competing with the senders
- // beside it, which is a different problem from a 3px edge marker.
- return accountColour;
+ // Blending toward Base was the first mistake and is long gone: a chip's
+ // colour is already muted, since it is chosen to carry legible text on top,
+ // and three pixels of a muted colour is nothing. Handing the raw colour
+ // through was the second: it is better, but the five real accounts are all
+ // mid-tone by construction and still read as faint stripes on a dark theme.
+ //
+ // A FLOOR rather than a repaint. A colour already past it is returned
+ // untouched, so a user who deliberately picked something vivid keeps
+ // exactly what they picked, and only the muted ones move. Hue is never
+ // touched at all, because hue is the entire information the bar carries:
+ // shifting it would make a bar stop matching its account's chip and its
+ // swatch in the dropdown.
+ //
+ // The numbers were chosen by rendering all five accounts as 3px bars on
+ // both a dark and a light card background and looking. Higher pushed the
+ // green toward a neon that no longer matched its own chip; lower left it
+ // where it started.
+ constexpr float kMinSaturation = 0.65f;
+ constexpr float kMinLightness = 0.50f;
+
+ float h = 0, s = 0, l = 0, a = 0;
+ accountColour.getHslF(&h, &s, &l, &a);
+ return QColor::fromHslF(h, qMax(s, kMinSaturation),
+ qMax(l, kMinLightness), a);
}
QSize CardDelegate::sizeHint(const QStyleOptionViewItem &option,
diff --git a/src/carddelegate.h b/src/carddelegate.h
index 7012eaa..74dee8e 100644
--- a/src/carddelegate.h
+++ b/src/carddelegate.h
@@ -52,20 +52,27 @@ public:
static QRect expanderRectFor(const QStyleOptionViewItem &option,
const QModelIndex &index);
- /// The colour the accent bar is painted in: the account's own, undiluted.
+ /// The colour the accent bar is painted in: the account's hue, lifted to a
+ /// floor of saturation and lightness.
///
- /// Blending it toward the palette's Base was tried first, at the 0.35
- /// weight threadLineColour() uses, and produced an INVISIBLE bar on a dark
- /// theme: against a Base of (0.169, 0.169, 0.169) it landed at (0.18, 0.22,
- /// 0.26), which is the background. The weight is a fraction OF THE ACCOUNT
- /// COLOUR, so a low one keeps the background rather than the hue.
+ /// Two earlier versions were wrong in opposite directions. Blending toward
+ /// the palette's Base at threadLineColour()'s 0.35 weight produced an
+ /// INVISIBLE bar on a dark theme, landing at (0.18, 0.22, 0.26) against a
+ /// Base of (0.169, 0.169, 0.169): the weight is a fraction OF THE ACCOUNT
+ /// COLOUR, so a low one keeps the background rather than the hue. Passing
+ /// the raw colour through fixed that and was still too quiet, because an
+ /// account colour is chosen as a CHIP's fill with legible text on top and
+ /// is therefore mid-tone by construction.
///
- /// An account colour is already chosen to be a chip's fill with legible
- /// text on top, so it is muted to begin with; three pixels of a muted
- /// colour is nothing. Nothing is drawn on this bar, so it needs none of the
- /// contrast that choice was made for. The SPINE is where the muting belongs
- /// and is blended in paint(): it runs the full height of every reply in an
- /// expansion and has to be followable without competing with the senders.
+ /// A floor, not a repaint: a colour already past it is returned untouched,
+ /// so a deliberately vivid choice is preserved. Hue is never altered, since
+ /// hue is the whole information the bar carries and a shifted one would
+ /// stop matching the account's chip and its swatch in the dropdown.
+ ///
+ /// The SPINE takes its colour from this and mutes it again in paint(): it
+ /// runs the full height of every reply in an expansion and has to be
+ /// followable without competing with the senders, which is a different
+ /// problem from a 3px edge marker.
///
/// Falls back to threadLineColour() for a thread with no account tag.
static QColor accentLineColour(const QColor &accountColour);