KWin
Loading...
Searching...
No Matches
colorhelper.h
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2012 Martin Gräßlin <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6#pragma once
7
8#include <QColor>
9#include <QObject>
10
16class ColorHelper : public QObject
17{
18 Q_OBJECT
22 Q_PROPERTY(qreal contrast READ contrast CONSTANT)
23public:
24 explicit ColorHelper(QObject *parent = nullptr);
25 ~ColorHelper() override;
58 Q_ENUM(ShadeRole)
120 Q_ENUM(BackgroundRole)
121
122
184 Q_ENUM(ForegroundRole)
195 Q_INVOKABLE QColor shade(const QColor &color, ShadeRole role);
196 Q_INVOKABLE QColor shade(const QColor &color, ShadeRole role, qreal contrast);
213 Q_INVOKABLE QColor multiplyAlpha(const QColor &color, qreal alpha);
218 Q_INVOKABLE QColor background(bool active, BackgroundRole role = NormalBackground) const;
219
224 Q_INVOKABLE QColor foreground(bool active, ForegroundRole role = NormalText) const;
225
226 qreal contrast() const;
227};
Helper to manipulate colors.
Definition colorhelper.h:17
Q_INVOKABLE QColor multiplyAlpha(const QColor &color, qreal alpha)
Q_INVOKABLE QColor foreground(bool active, ForegroundRole role=NormalText) const
qreal contrast
Definition colorhelper.h:22
Q_INVOKABLE QColor shade(const QColor &color, ShadeRole role)
@ AlternateBackground
Definition colorhelper.h:79
Q_INVOKABLE QColor background(bool active, BackgroundRole role=NormalBackground) const
ColorHelper(QObject *parent=nullptr)
~ColorHelper() override