Utility functions for colors.
More...
#include <color.h>
|
| | Color (QObject *parent=nullptr) |
| |
| Q_INVOKABLE QColor | transparent (const QColor &color, qreal alpha) |
| |
| Q_INVOKABLE QColor | blend (const QColor &color1, const QColor &color2, qreal alpha) |
| |
| Q_INVOKABLE qreal | luminance (const QColor &color) |
| |
| Q_INVOKABLE bool | isDarkColor (const QColor &color) |
| |
| Q_INVOKABLE QColor | lightDark (const QColor &background, const QColor &lightColor, const QColor &darkColor) |
| |
|
| static Color * | create (QQmlEngine *engine, QJSEngine *jsEngine) |
| |
Utility functions for colors.
Utility functions to manipulate colors.
Definition at line 15 of file color.h.
◆ Color()
| Color::Color |
( |
QObject * |
parent = nullptr | ) |
|
|
explicit |
◆ blend()
| QColor Color::blend |
( |
const QColor & |
color1, |
|
|
const QColor & |
color2, |
|
|
qreal |
alpha |
|
) |
| |
Blend color1 and color2 together and set alpha to alpha.
Definition at line 17 of file color.cpp.
◆ create()
| Color * Color::create |
( |
QQmlEngine * |
engine, |
|
|
QJSEngine * |
jsEngine |
|
) |
| |
|
static |
◆ isDarkColor()
| bool Color::isDarkColor |
( |
const QColor & |
color | ) |
|
Returns true if color is dark and should have light content on top.
Definition at line 31 of file color.cpp.
◆ lightDark()
| QColor Color::lightDark |
( |
const QColor & |
background, |
|
|
const QColor & |
lightColor, |
|
|
const QColor & |
darkColor |
|
) |
| |
Select a color depending on whether background color is light or dark. Returns lightColor if background is a light color, otherwise returns darkColor.
Definition at line 37 of file color.cpp.
◆ luminance()
| qreal Color::luminance |
( |
const QColor & |
color | ) |
|
Calculate luminance of color.
Definition at line 26 of file color.cpp.
◆ transparent()
| QColor Color::transparent |
( |
const QColor & |
color, |
|
|
qreal |
alpha |
|
) |
| |
A utility method for changing the alpha on color. Returns a new object, and does not modify the original color at all.
Definition at line 11 of file color.cpp.
The documentation for this class was generated from the following files: