File indexing completed on 2024-09-29 04:22:37

0001 /*
0002     SPDX-FileCopyrightText: 2017 Dušan Hanuš <hanus@pixelhouse.cz>
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include <QDebug>
0009 #include <QtGlobal>
0010 #include <QColor>
0011 
0012 class QColor;
0013 
0014 class QColorUtils
0015 {
0016 public:
0017     static QColor stringToColor(QString strColor);
0018     static QString colorToString(const QColor &color, bool alpha);
0019     static QColor complementary(QColor color);
0020 };
0021 
0022 class NegQColor
0023 {
0024 public:
0025     NegQColor();
0026     int8_t sign_r = 1;
0027     int8_t sign_g = 1;
0028     int8_t sign_b = 1;
0029     QColor qcolor;
0030     static NegQColor fromHsvF(qreal h, qreal s, qreal l, qreal a = 1.0);
0031     static NegQColor fromRgbF(qreal r, qreal g, qreal b, qreal a = 1.0);
0032     qreal redF() const;
0033     void setRedF(qreal val);
0034     qreal greenF() const;
0035     void setGreenF(qreal val);
0036     qreal blueF() const;
0037     void setBlueF(qreal val);
0038     qreal valueF() const;
0039     void setValueF(qreal val);
0040     int hue() const;
0041     qreal hueF() const;
0042     qreal saturationF() const;
0043     /** @brief overload of comparison operators */
0044     bool operator==(const NegQColor &other) const;
0045     bool operator!=(const NegQColor &other) const;
0046 };
0047 
0048 QDebug operator<<(QDebug qd, const NegQColor &color);