#include "CyberQueerStyle.h"
#include <QPalette>

CyberQueerStyle::CyberQueerStyle()
    : QProxyStyle(QStringLiteral("Fusion"))
{}

// Primary theme colors — hex literals are updated by apply-theme.sh.
// After changing colors, rebuild with: qt-themes/cyberqueer/style-plugin/build.sh
void CyberQueerStyle::polish(QPalette &p)
{
    QProxyStyle::polish(p);

    const QColor bg    (QRgb(0xFF1A1A1A));
    const QColor fg    (QRgb(0xFFD6ABAB));
    const QColor accent(QRgb(0xFF5018DD));
    const QColor hot   (QRgb(0xFFE40046));

    for (auto grp : {QPalette::Active, QPalette::Inactive}) {
        p.setColor(grp, QPalette::Window,          bg);
        p.setColor(grp, QPalette::WindowText,      fg);
        p.setColor(grp, QPalette::Base,            bg);
        p.setColor(grp, QPalette::AlternateBase,   QColor(0x22, 0x22, 0x22));
        p.setColor(grp, QPalette::Text,            fg);
        p.setColor(grp, QPalette::BrightText,      Qt::white);
        p.setColor(grp, QPalette::Button,          bg);
        p.setColor(grp, QPalette::ButtonText,      fg);
        p.setColor(grp, QPalette::Highlight,       accent);
        p.setColor(grp, QPalette::HighlightedText, Qt::white);
        p.setColor(grp, QPalette::Link,            accent);
        p.setColor(grp, QPalette::LinkVisited,     hot);
        p.setColor(grp, QPalette::ToolTipBase,     accent);
        p.setColor(grp, QPalette::ToolTipText,     Qt::white);
        p.setColor(grp, QPalette::Light,           QColor(0x2A, 0x2A, 0x2A));
        p.setColor(grp, QPalette::Midlight,        QColor(0x25, 0x25, 0x25));
        p.setColor(grp, QPalette::Dark,            QColor(0x0D, 0x0D, 0x0D));
        p.setColor(grp, QPalette::Mid,             QColor(0x1F, 0x1F, 0x1F));
        p.setColor(grp, QPalette::Shadow,          QColor(0x2A, 0x2A, 0x2A));
        p.setColor(grp, QPalette::PlaceholderText, QColor(0x80, 0x80, 0x86));
    }
    p.setColor(QPalette::Disabled, QPalette::WindowText, QColor(0x80, 0x80, 0x86));
    p.setColor(QPalette::Disabled, QPalette::Text,       QColor(0x80, 0x80, 0x86));
    p.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(0x80, 0x80, 0x86));
}
