Skip to content
Snippets Groups Projects
Theme.h 1.42 KiB
Newer Older
  • Learn to ignore specific revisions
  • // SPDX-FileCopyrightText: Nheko Contributors
    
    Nicolas Werner's avatar
    Nicolas Werner committed
    //
    // SPDX-License-Identifier: GPL-3.0-or-later
    
    
    Konstantinos Sideris's avatar
    Konstantinos Sideris committed
    
    #include <QColor>
    
    #include <QPalette>
    
    #include <QQmlEngine>
    
    class Theme final : public QPalette
    
    Konstantinos Sideris's avatar
    Konstantinos Sideris committed
    {
    
        Q_GADGET
    
        QML_ANONYMOUS
    
    
        Q_PROPERTY(QColor sidebarBackground READ sidebarBackground CONSTANT)
        Q_PROPERTY(QColor alternateButton READ alternateButton CONSTANT)
        Q_PROPERTY(QColor separator READ separator CONSTANT)
        Q_PROPERTY(QColor red READ red CONSTANT)
    
        Q_PROPERTY(QColor green READ green CONSTANT)
    
        Q_PROPERTY(QColor error READ error CONSTANT)
    
        Q_PROPERTY(QColor orange READ orange CONSTANT)
    
    Nicolas Werner's avatar
    Nicolas Werner committed
        Q_PROPERTY(QColor online READ online CONSTANT)
        Q_PROPERTY(QColor unavailable READ unavailable CONSTANT)
    
    Konstantinos Sideris's avatar
    Konstantinos Sideris committed
    public:
    
        Theme() {}
    
        explicit Theme(QStringView theme);
        static QPalette paletteFromTheme(QStringView theme);
    
        QColor sidebarBackground() const { return sidebarBackground_; }
        QColor alternateButton() const { return alternateButton_; }
        QColor separator() const { return separator_; }
        QColor red() const { return red_; }
    
        QColor green() const { return green_; }
        QColor error() const { return error_; }
    
        QColor orange() const { return orange_; }
    
    Nicolas Werner's avatar
    Nicolas Werner committed
        QColor online() const { return QColor(0x00, 0xcc, 0x66); }
        QColor unavailable() const { return QColor(0xff, 0x99, 0x33); }
    
    Konstantinos Sideris's avatar
    Konstantinos Sideris committed
    
    private:
    
        QColor sidebarBackground_, separator_, red_, green_, error_, orange_, alternateButton_;
    
    Konstantinos Sideris's avatar
    Konstantinos Sideris committed
    };