Kirigami2
colorutils.cpp
46 return QColor::fromRgb((foregroundAlpha * foreground.red()) + (inverseForegroundAlpha * background.red()),
54 return QColor::fromRgb((foregroundAlpha * foreground.red()) + (inverseBackgroundAlpha * background.red()),
75 auto saturation = std::clamp(linearlyInterpolateDouble(one.saturationF(), two.saturationF(), balance), 0.0, 1.0);
76 auto value = std::clamp(linearlyInterpolateDouble(one.valueF(), two.valueF(), balance), 0.0, 1.0);
77 auto alpha = std::clamp(linearlyInterpolateDouble(one.alphaF(), two.alphaF(), balance), 0.0, 1.0);
126 if ((parsed.red || parsed.green || parsed.blue) && (parsed.hue || parsed.saturation || parsed.value)) {
127 qCCritical(KirigamiPlatform) << "It is an error to have both RGB and HSV values in an adjustment.";
230QColor ColorUtils::tintWithAlpha(const QColor &targetColor, const QColor &tintColor, double alpha)
Q_INVOKABLE qreal grayForColor(const QColor &color)
Same Algorithm as brightnessForColor but returns a 0 to 1 value for an estimate of the equivalent gra...
Definition colorutils.cpp:30
Q_INVOKABLE QColor adjustColor(const QColor &color, const QJSValue &adjustments)
Increases or decreases the properties of color by fixed amounts.
Definition colorutils.cpp:133
Q_INVOKABLE QColor alphaBlend(const QColor &foreground, const QColor &background)
Returns the result of overlaying the foreground color on the background color.
Definition colorutils.cpp:35
Q_INVOKABLE QColor scaleColor(const QColor &color, const QJSValue &adjustments)
Smoothly scales colors.
Definition colorutils.cpp:179
static Q_INVOKABLE qreal chroma(const QColor &color)
Returns the CIELAB chroma of the given color.
Definition colorutils.cpp:304
Q_INVOKABLE QColor tintWithAlpha(const QColor &targetColor, const QColor &tintColor, double alpha)
Tint a color using a separate alpha value.
Definition colorutils.cpp:230
Q_INVOKABLE QColor linearInterpolation(const QColor &one, const QColor &two, double balance)
Returns a linearly interpolated color between color one and color two.
Definition colorutils.cpp:61
Q_INVOKABLE ColorUtils::Brightness brightnessForColor(const QColor &color)
Returns whether a color is bright or dark.
Definition colorutils.cpp:21
@ Light
The item is light and requires a dark foreground color to achieve readable contrast.
Definition colorutils.h:31
@ Dark
The item is dark and requires a light foreground color to achieve readable contrast.
Definition colorutils.h:30
int alpha() const const
int blue() const const
float blueF() const const
QColor fromHsvF(float h, float s, float v, float a)
QColor fromRgb(QRgb rgb)
QColor fromRgbF(float r, float g, float b, float a)
int green() const const
float greenF() const const
int red() const const
float redF() const const
bool hasProperty(const QString &name) const const
QJSValue property(const QString &name) const const
T qobject_cast(QObject *object)
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:49:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:49:07 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.