/*
* Copyright (C) 2024, KylinSoft Co., Ltd.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * Authors: iaom <zhangpengfei@kylinos.cn>
 *
 */

#include "dt-theme.h"

#include <QFile>
#include <QQmlComponent>
#include <QVariant>
#include <functional>
#include <mutex>
#include <QGSettings>
#include <QGuiApplication>
#include <QRegularExpression>

#include "ukui-theme-proxy.h"

static QHash<QQmlEngine *, UkuiQuick::DtTheme *> g_dtThemes;

namespace UkuiQuick {
#define COLOR_TOKEN_GETTER(token)                       \
    GradientColor* DtTheme::token() const { return &(d->m_##token); }
#define INT_TOKEN_GETTER(token)                         \
    int DtTheme::token() const { return d->m_##token; }
#define SHADOW_TOKEN_GETTER(token)                       \
    ShadowData* DtTheme::token() const { return &(d->m_##token); }
#define COLOR_TOKEN_SETTER(token)                       \
    void DtTheme::token##Set(QVariant value)            \
    {                                                   \
        GradientColor* gra = value.value<UkuiQuick::GradientColor*>();\
        if(gra == nullptr) {                            \
            QColor color = value.value<QColor>();       \
            if(d->m_##token != color) {                 \
                d->m_##token.setGradientDeg(0);         \
                d->m_##token.setGradientStart(QColor(0,0,0,0)); \
                d->m_##token.setGradientEnd(QColor(0,0,0,0)); \
                d->m_##token.setGradientBackground(QColor(0,0,0,0)); \
                d->m_##token.setPureColor(color);       \
                d->m_##token.setColorType(DtColorType::Pure);\
                Q_EMIT token##Changed();                \
            }                                           \
        } else {                                        \
            if(d->m_##token != gra) {                   \
                d->m_##token.setGradientDeg(gra->gradientDeg());\
                d->m_##token.setGradientStart(gra->gradientStart());\
                d->m_##token.setGradientEnd(gra->gradientEnd());\
                d->m_##token.setGradientBackground(gra->gradientBackground());\
                d->m_##token.setPureColor(QColor(0,0,0,0)); \
                d->m_##token.setColorType(DtColorType::Gradient);\
                Q_EMIT token##Changed();                \
            }                                           \
        }                                               \
    }
#define INT_TOKEN_SETTER(token)                         \
    void DtTheme::token##Set(QVariant value)            \
    {                                                   \
        if(d->m_##token != value.value<int>()) {        \
            d->m_##token = value.value<int>();          \
            Q_EMIT token##Changed();                    \
        }                                               \
    }

#define SHADOW_TOKEN_SETTER(token)                      \
void DtTheme::token##Set(QVariant value)                \
{                                                       \
    ShadowData* data = value.value<UkuiQuick::ShadowData*>();\
    if(d->m_##token != *data) {                          \
        d->m_##token.setXOffset(data->xOffset());       \
        d->m_##token.setYOffset(data->yOffset());       \
        d->m_##token.setBlurRadius(data->blurRadius()); \
        d->m_##token.setSpread(data->spread());         \
        d->m_##token.setIsMultiShadow(data->isMultiShadow());\
        d->m_##token.setShadowColor(data->shadowColor());\
        d->m_##token.setChildShadow(data->childShadow());\
        Q_EMIT token##Changed();                        \
    }                                                   \
}

#define UKUI_STYLE_SETTING          "org.ukui.style"
#define UKUI_STYLE_NAME_KEY         "widgetThemeName"
#define UKUI_STYLE_COLOR_KEY        "styleName"
#define UKUI_STYLE_FONT_SIZE_KEY    "systemFontSize"
#define UKUI_STYLE_FONT_KEY         "systemFont"
#define UKUI_STYLE_ICON_THEME_NAME_KEY "iconThemeName"
#define UKUI_STYLE_THEME_COLOR      "themeColor"
#define UKUI_STYLE_WINDOW_RADIUS    "windowRadius"
#define CONTROL_CENTER_SETTING          "org.ukui.control-center.personalise"
#define CONTROL_CENTER_TRANSPARENCY_KEY "transparency"

class ThemeGlobalConfigPrivate;
class ThemeGlobalConfigPrivate
{
public:
    QString m_themeName = "default";
    QString m_styleColor = "Light";
    qreal m_transparency = 1.0;
    qreal m_fontSize = 11.0;
    QString m_fontFamily = "Noto Sans CJK SC";
    Qt::LayoutDirection layoutDirection = QGuiApplication::layoutDirection();
    QString m_iconThemeName = "ukui-icon-theme-default";
    QString m_themeColor = "KBrand1";
    QString m_windowRadius = "bigRadius";
};
ThemeGlobalConfig* ThemeGlobalConfig::instance()
{
    static ThemeGlobalConfig* instance = nullptr;
    if(!instance) {
        instance = new ThemeGlobalConfig();
    }
    return instance;
}

ThemeGlobalConfig::~ThemeGlobalConfig()
{
    if (d) {
        delete d;
        d = nullptr;
    }
}

qreal ThemeGlobalConfig::transparency() const
{
    return d->m_transparency;
}

QString ThemeGlobalConfig::themeName() const
{
    return d->m_themeName;
}

QString ThemeGlobalConfig::styleColor() const
{
    return d->m_styleColor;
}

QString ThemeGlobalConfig::themeColor() const
{
    return d->m_themeColor;
}

QString ThemeGlobalConfig::windowRadius() const
{
    return d->m_windowRadius;
}

QString ThemeGlobalConfig::iconThemeName() const
{
    return d->m_iconThemeName;
}

Qt::LayoutDirection ThemeGlobalConfig::layoutDirection() const
{
    return d->layoutDirection;
}

bool ThemeGlobalConfig::isDarkTheme() const
{
    return d->m_styleColor == "Dark";
}

qreal ThemeGlobalConfig::fontSize() const
{
    return d->m_fontSize;
}

QString ThemeGlobalConfig::fontFamily() const
{
    return d->m_fontFamily;
}

ThemeGlobalConfig::ThemeGlobalConfig() : d(new ThemeGlobalConfigPrivate())
{
    QByteArray id(CONTROL_CENTER_SETTING);
    if (QGSettings::isSchemaInstalled(id)) {
        auto settings = new QGSettings(id, QByteArray(), this);

        QStringList keys = settings->keys();
        if (keys.contains(CONTROL_CENTER_TRANSPARENCY_KEY)) {
            d->m_transparency = settings->get(CONTROL_CENTER_TRANSPARENCY_KEY).toReal();
        }
        connect(settings, &QGSettings::changed, this, [this, settings] (const QString &key) {
            if (key == CONTROL_CENTER_TRANSPARENCY_KEY) {
                d->m_transparency = settings->get(key).toReal();
                Q_EMIT transparencyChanged();
            }
        });
    }

     id = UKUI_STYLE_SETTING;
    if (QGSettings::isSchemaInstalled(id)) {
        auto settings = new QGSettings(id, QByteArray(), this);

        QStringList keys = settings->keys();
        if (keys.contains(UKUI_STYLE_NAME_KEY)) {
            d->m_themeName = settings->get(UKUI_STYLE_NAME_KEY).toString();
        }
		if (keys.contains(UKUI_STYLE_COLOR_KEY)) {
            auto color = settings->get(UKUI_STYLE_COLOR_KEY).toString();
            if(color == "ukui-light" || color == "ukui-white") {
               d->m_styleColor = "Light";
            } else if (color == "ukui-dark" || color == "ukui-black") {
               d->m_styleColor = "Dark";
            }
        }
		if (keys.contains(UKUI_STYLE_FONT_SIZE_KEY)) {
            d->m_fontSize = settings->get(UKUI_STYLE_FONT_SIZE_KEY).toReal();
        }
		if (keys.contains(UKUI_STYLE_FONT_KEY)) {
            d->m_fontFamily = settings->get(UKUI_STYLE_FONT_KEY).toString();
        }
        if (keys.contains(UKUI_STYLE_THEME_COLOR)) {
            d->m_themeColor = settings->get(UKUI_STYLE_THEME_COLOR).toString();
        }
        if (keys.contains(UKUI_STYLE_WINDOW_RADIUS)) {
            d->m_windowRadius = settings->get(UKUI_STYLE_WINDOW_RADIUS).toString();
        }
        if (keys.contains(UKUI_STYLE_ICON_THEME_NAME_KEY)) {
            d->m_iconThemeName = settings->get(UKUI_STYLE_ICON_THEME_NAME_KEY).toString();
        }
        QObject::connect(settings, &QGSettings::changed, this, [this, settings] (const QString &key) {
            if (key == UKUI_STYLE_NAME_KEY) {
                if(d->m_themeName != settings->get(key).toString()) {
                    d->m_themeName = settings->get(key).toString();
                    Q_EMIT themeNameChanged();
                }
            } else if (key == UKUI_STYLE_COLOR_KEY) {
                auto color = settings->get(UKUI_STYLE_COLOR_KEY).toString();
                if(color == "ukui-light" || color == "ukui-white") {
                   d->m_styleColor = "Light";
                } else if (color == "ukui-dark" || color == "ukui-black") {
                   d->m_styleColor = "Dark";
                }
                Q_EMIT styleColorChanged();
            } else if (key == UKUI_STYLE_FONT_SIZE_KEY) {
                d->m_fontSize = settings->get(key).toReal();
                Q_EMIT fontSizeChanged();
            } else if (key == UKUI_STYLE_FONT_KEY) {
                d->m_fontFamily = settings->get(key).toString();
                Q_EMIT fontFamilyChanged();
            } else if (key == UKUI_STYLE_ICON_THEME_NAME_KEY) {
                d->m_iconThemeName = settings->get(key).toString();
                Q_EMIT iconThemeNameChanged();
            } else if (key == UKUI_STYLE_THEME_COLOR) {
                d->m_themeColor = settings->get(UKUI_STYLE_THEME_COLOR).toString();
                Q_EMIT themeColorChanged();
            } else if (key == UKUI_STYLE_WINDOW_RADIUS) {
                d->m_windowRadius = settings->get(UKUI_STYLE_WINDOW_RADIUS).toString();
                Q_EMIT windowRadiusChanged();
            }
        });
    }

    connect(qGuiApp, &QGuiApplication::layoutDirectionChanged, this, [this] (const Qt::LayoutDirection &layoutDirection) {
        d->layoutDirection = layoutDirection;
        Q_EMIT layoutDirectionChanged();
    });
}
class DtThemePrivate {
public:
    DtThemePrivate(DtTheme *q) : q(q) {};
    DESIGN_TOKENS
    QQmlEngine* m_engine = nullptr;
    DtThemeDefinition *m_themeDefinition = nullptr;
    DtTheme *q = nullptr;
    QMap<QString, std::function<void(QVariant)>> m_valueSet;
};

DtTheme::DtTheme(QQmlEngine* engine, QObject *parent) : QObject(parent), d(new DtThemePrivate(this))
{
    d->m_engine = engine;
    //加载默认主题文件
    addFuncPointer();
    //根据DT主题名称和颜色读取对应的qml文件
    setTheme();
    onWindowRadiusChanged();
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::transparencyChanged, this, &DtTheme::transparencyChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::themeNameChanged, this, &DtTheme::setTheme);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::themeColorChanged, this, &DtTheme::onThemeColorChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::styleColorChanged, this, &DtTheme::setTheme);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::windowRadiusChanged, this, &DtTheme::onWindowRadiusChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::fontSizeChanged, this, &DtTheme::fontSizeChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::fontFamilyChanged, this, &DtTheme::fontFamilyChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::iconThemeNameChanged, this, &DtTheme::iconThemeNameChanged);
    connect(ThemeGlobalConfig::instance(), &ThemeGlobalConfig::layoutDirectionChanged, this, &DtTheme::layoutDirectionChanged);
}

DtTheme* DtTheme::self(QQmlEngine* engine)
{
    if(!engine) {
        return nullptr;
    }
    const QHash<QQmlEngine*, DtTheme*>::iterator it = g_dtThemes.find(engine);
    if(it == g_dtThemes.end()) {
        return g_dtThemes.insert(engine, new DtTheme(engine)).value();
    }
    return it.value();
}

DtTheme::~DtTheme()
{
    g_dtThemes.remove(d->m_engine);
    if(d) {
        delete d;
        d = nullptr;
    }
}

void DtTheme::proportySet()
{
    if(!d->m_themeDefinition) {
        return;
    }
    const QMetaObject* metaObject = d->m_themeDefinition->metaObject();
    QStringList properties;
    for(int i = metaObject->propertyOffset(); i < metaObject->propertyCount(); ++i)
        properties << QString::fromLatin1(metaObject->property(i).name());
    for (auto token : properties) {
        if(QVariant value = d->m_themeDefinition->property(token.toLocal8Bit().data()); value.isValid()) {
            if(d->m_valueSet.contains(token)) {
                std::function<void(QVariant)> valueSet = d->m_valueSet[token];
                valueSet(value);
            }
        }
    }
}

void DtTheme::setTheme()
{
    //根据DT主题名称和颜色读取对应的qml文件
    QString path= QString("/usr/share/config/themeconfig/token/k%1%2.qml").arg(ThemeGlobalConfig::instance()->themeName()).arg(ThemeGlobalConfig::instance()->styleColor());
    if(!QFile::exists(path)) {
        qWarning() << "No Theme file found, using default theme";
        path = QStringLiteral("/usr/share/ukui/ukui-quick-platform/DtThemeDefault.qml");
    }
    if(QFile::exists(path)) {
        QQmlComponent component(d->m_engine);
        component.loadUrl(QUrl(path));
        if (!component.isError()) {
            auto result = component.create();
            if (auto themeDefinition = qobject_cast<DtThemeDefinition *>(result)) {
                d->m_themeDefinition = themeDefinition;
                //TODO token详细的分类,分组更新
                proportySet();
                if (d->m_themeDefinition) {
                    delete d->m_themeDefinition;
                    d->m_themeDefinition = nullptr;
                }
                onThemeColorChanged();
                return;
            }
        }
        const auto errors = component.errors();
        for (const auto&error: errors) {
            qWarning() << error.toString();
        }
        qWarning() << "Invalid Theme file, using default theme.";
    }
 }

void DtTheme::addFuncPointer()
{
    d->m_valueSet.clear();
    d->m_valueSet.insert("windowTextActive", std::bind(&DtTheme::windowTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("windowTextInactive", std::bind(&DtTheme::windowTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("windowTextDisable", std::bind(&DtTheme::windowTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonActive", std::bind(&DtTheme::buttonActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonInactive", std::bind(&DtTheme::buttonInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonDisable", std::bind(&DtTheme::buttonDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("lightActive", std::bind(&DtTheme::lightActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("lightInactive", std::bind(&DtTheme::lightInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("lightDisable", std::bind(&DtTheme::lightDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midLightActive", std::bind(&DtTheme::midLightActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midLightInactive", std::bind(&DtTheme::midLightInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midLightDisable", std::bind(&DtTheme::midLightDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("darkActive", std::bind(&DtTheme::darkActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("darkInactive", std::bind(&DtTheme::darkInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("darkDisable", std::bind(&DtTheme::darkDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midActive", std::bind(&DtTheme::midActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midInactive", std::bind(&DtTheme::midInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("midDisable", std::bind(&DtTheme::midDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("textActive", std::bind(&DtTheme::textActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("textInactive", std::bind(&DtTheme::textInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("textDisable", std::bind(&DtTheme::textDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("brightTextActive", std::bind(&DtTheme::brightTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("brightTextInactive", std::bind(&DtTheme::brightTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("brightTextDisable", std::bind(&DtTheme::brightTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonTextActive", std::bind(&DtTheme::buttonTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonTextInactive", std::bind(&DtTheme::buttonTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("buttonTextDisable", std::bind(&DtTheme::buttonTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("baseActive", std::bind(&DtTheme::baseActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("baseInactive", std::bind(&DtTheme::baseInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("baseDisable", std::bind(&DtTheme::baseDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("windowActive", std::bind(&DtTheme::windowActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("windowInactive", std::bind(&DtTheme::windowInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("windowDisable", std::bind(&DtTheme::windowDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("shadowActive", std::bind(&DtTheme::shadowActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("shadowInactive", std::bind(&DtTheme::shadowInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("shadowDisable", std::bind(&DtTheme::shadowDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("highlightedTextActive", std::bind(&DtTheme::highlightedTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("highlightedTextInactive", std::bind(&DtTheme::highlightedTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("highlightedTextDisable", std::bind(&DtTheme::highlightedTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkActive", std::bind(&DtTheme::linkActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkInactive", std::bind(&DtTheme::linkInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkDisable", std::bind(&DtTheme::linkDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkVisitedActive", std::bind(&DtTheme::linkVisitedActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkVisitedInactive", std::bind(&DtTheme::linkVisitedInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("linkVisitedDisable", std::bind(&DtTheme::linkVisitedDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("alternateBaseActive", std::bind(&DtTheme::alternateBaseActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("alternateBaseInactive", std::bind(&DtTheme::alternateBaseInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("alternateBaseDisable", std::bind(&DtTheme::alternateBaseDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("noRoleActive", std::bind(&DtTheme::noRoleActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("noRoleInactive", std::bind(&DtTheme::noRoleInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("noRoleDisable", std::bind(&DtTheme::noRoleDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipBaseActive", std::bind(&DtTheme::toolTipBaseActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipBaseInactive", std::bind(&DtTheme::toolTipBaseInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipBaseDisable", std::bind(&DtTheme::toolTipBaseDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipTextActive", std::bind(&DtTheme::toolTipTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipTextInactive", std::bind(&DtTheme::toolTipTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("toolTipTextDisable", std::bind(&DtTheme::toolTipTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("placeholderTextActive", std::bind(&DtTheme::placeholderTextActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("placeholderTextInactive", std::bind(&DtTheme::placeholderTextInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("placeholderTextDisable", std::bind(&DtTheme::placeholderTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kWhite", std::bind(&DtTheme::kWhiteSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kBlack", std::bind(&DtTheme::kBlackSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray0", std::bind(&DtTheme::kGray0Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray1", std::bind(&DtTheme::kGray1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray2", std::bind(&DtTheme::kGray2Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray3", std::bind(&DtTheme::kGray3Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray4", std::bind(&DtTheme::kGray4Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray5", std::bind(&DtTheme::kGray5Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray6", std::bind(&DtTheme::kGray6Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray7", std::bind(&DtTheme::kGray7Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray8", std::bind(&DtTheme::kGray8Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray9", std::bind(&DtTheme::kGray9Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray10", std::bind(&DtTheme::kGray10Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray11", std::bind(&DtTheme::kGray11Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray12", std::bind(&DtTheme::kGray12Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray13", std::bind(&DtTheme::kGray13Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray14", std::bind(&DtTheme::kGray14Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray15", std::bind(&DtTheme::kGray15Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray16", std::bind(&DtTheme::kGray16Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGray17", std::bind(&DtTheme::kGray17Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha0", std::bind(&DtTheme::kGrayAlpha0Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha1", std::bind(&DtTheme::kGrayAlpha1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha2", std::bind(&DtTheme::kGrayAlpha2Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha3", std::bind(&DtTheme::kGrayAlpha3Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha4", std::bind(&DtTheme::kGrayAlpha4Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha5", std::bind(&DtTheme::kGrayAlpha5Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha6", std::bind(&DtTheme::kGrayAlpha6Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha7", std::bind(&DtTheme::kGrayAlpha7Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha8", std::bind(&DtTheme::kGrayAlpha8Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha9", std::bind(&DtTheme::kGrayAlpha9Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha10", std::bind(&DtTheme::kGrayAlpha10Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha11", std::bind(&DtTheme::kGrayAlpha11Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha12", std::bind(&DtTheme::kGrayAlpha12Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGrayAlpha13", std::bind(&DtTheme::kGrayAlpha13Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontStrong", std::bind(&DtTheme::kFontStrongSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontPrimary", std::bind(&DtTheme::kFontPrimarySet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontPrimaryDisable", std::bind(&DtTheme::kFontPrimaryDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontSecondary", std::bind(&DtTheme::kFontSecondarySet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontSecondaryDisable", std::bind(&DtTheme::kFontSecondaryDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhite", std::bind(&DtTheme::kFontWhiteSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhiteDisable", std::bind(&DtTheme::kFontWhiteDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhiteSecondary", std::bind(&DtTheme::kFontWhiteSecondarySet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhiteSecondaryDisable", std::bind(&DtTheme::kFontWhiteSecondaryDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrandFocus", std::bind(&DtTheme::kBrandFocusSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSuccessNormal", std::bind(&DtTheme::kSuccessNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSuccessHover", std::bind(&DtTheme::kSuccessHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSuccessClick", std::bind(&DtTheme::kSuccessClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kWarningNormal", std::bind(&DtTheme::kWarningNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kWarningHover", std::bind(&DtTheme::kWarningHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kWarningClick", std::bind(&DtTheme::kWarningClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kErrorNormal", std::bind(&DtTheme::kErrorNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kErrorHover", std::bind(&DtTheme::kErrorHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kErrorClick", std::bind(&DtTheme::kErrorClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand1", std::bind(&DtTheme::kBrand1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand2", std::bind(&DtTheme::kBrand2Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand3", std::bind(&DtTheme::kBrand3Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand4", std::bind(&DtTheme::kBrand4Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand5", std::bind(&DtTheme::kBrand5Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand6", std::bind(&DtTheme::kBrand6Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand7", std::bind(&DtTheme::kBrand7Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainHover", std::bind(&DtTheme::kContainHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainClick", std::bind(&DtTheme::kContainClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainGeneralNormal", std::bind(&DtTheme::kContainGeneralNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainSecondaryNormal", std::bind(&DtTheme::kContainSecondaryNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainSecondaryAlphaNormal", std::bind(&DtTheme::kContainSecondaryAlphaNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentNormal", std::bind(&DtTheme::kComponentNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentHover", std::bind(&DtTheme::kComponentHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentClick", std::bind(&DtTheme::kComponentClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentDisable", std::bind(&DtTheme::kComponentDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentAlphaNormal", std::bind(&DtTheme::kComponentAlphaNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentAlphaHover", std::bind(&DtTheme::kComponentAlphaHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentAlphaClick", std::bind(&DtTheme::kComponentAlphaClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentAlphaDisable", std::bind(&DtTheme::kComponentAlphaDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWindowActive", std::bind(&DtTheme::kLineWindowActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineComponentNormal", std::bind(&DtTheme::kLineComponentNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineComponentHover", std::bind(&DtTheme::kLineComponentHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineComponentClick", std::bind(&DtTheme::kLineComponentClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineComponentDisable", std::bind(&DtTheme::kLineComponentDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kModalMask", std::bind(&DtTheme::kModalMaskSet, this, std::placeholders::_1));

    d->m_valueSet.insert("normalLine", std::bind(&DtTheme::normalLineSet, this, std::placeholders::_1));
    d->m_valueSet.insert("focusLine", std::bind(&DtTheme::focusLineSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kRadiusMin", std::bind(&DtTheme::kRadiusMinSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kRadiusNormal", std::bind(&DtTheme::kRadiusNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kRadiusMax", std::bind(&DtTheme::kRadiusMaxSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMarginMin", std::bind(&DtTheme::kMarginMinSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMarginNormal", std::bind(&DtTheme::kMarginNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMarginBig", std::bind(&DtTheme::kMarginBigSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMarginWindow", std::bind(&DtTheme::kMarginWindowSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMarginComponent", std::bind(&DtTheme::kMarginComponentSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingMinLeft", std::bind(&DtTheme::kPaddingMinLeftSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingMinTop", std::bind(&DtTheme::kPaddingMinTopSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingMinRight", std::bind(&DtTheme::kPaddingMinRightSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingMinBottom", std::bind(&DtTheme::kPaddingMinBottomSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingNormalLeft", std::bind(&DtTheme::kPaddingNormalLeftSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingNormalTop", std::bind(&DtTheme::kPaddingNormalTopSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingNormalRight", std::bind(&DtTheme::kPaddingNormalRightSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingNormalBottom", std::bind(&DtTheme::kPaddingNormalBottomSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingWindowLeft", std::bind(&DtTheme::kPaddingWindowLeftSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingWindowTop", std::bind(&DtTheme::kPaddingWindowTopSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingWindowRight", std::bind(&DtTheme::kPaddingWindowRightSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kPaddingWindowBottom", std::bind(&DtTheme::kPaddingWindowBottomSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kErrorDisable", std::bind(&DtTheme::kErrorDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kWarningDisable", std::bind(&DtTheme::kWarningDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineNormal", std::bind(&DtTheme::kLineNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineNormal", std::bind(&DtTheme::kLineNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainGeneralAlphaNormal", std::bind(&DtTheme::kContainGeneralAlphaNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSuccessDisable", std::bind(&DtTheme::kSuccessDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWindowInactive", std::bind(&DtTheme::kLineWindowInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainAlphaClick", std::bind(&DtTheme::kContainAlphaClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainAlphaHover", std::bind(&DtTheme::kContainAlphaHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineDisable", std::bind(&DtTheme::kLineDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kDivider", std::bind(&DtTheme::kDividerSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand8", std::bind(&DtTheme::kBrand8Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kBrand9", std::bind(&DtTheme::kBrand9Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSelectboxNormal", std::bind(&DtTheme::kLineSelectboxNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSelectboxHover", std::bind(&DtTheme::kLineSelectboxHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSelectboxClick", std::bind(&DtTheme::kLineSelectboxClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSelectboxSelected", std::bind(&DtTheme::kLineSelectboxSelectedSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSelectboxDisable", std::bind(&DtTheme::kLineSelectboxDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhitePlaceholderTextDisable", std::bind(&DtTheme::kFontWhitePlaceholderTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainGeneralInactive", std::bind(&DtTheme::kContainGeneralInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontPlaceholderTextDisable", std::bind(&DtTheme::kFontPlaceholderTextDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontWhitePlaceholderText", std::bind(&DtTheme::kFontWhitePlaceholderTextSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineInputDisable", std::bind(&DtTheme::kLineInputDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineDock", std::bind(&DtTheme::kLineDockSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineMenu", std::bind(&DtTheme::kLineMenuSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineTable", std::bind(&DtTheme::kLineTableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineInputNormal", std::bind(&DtTheme::kLineInputNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineInputHover", std::bind(&DtTheme::kLineInputHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineInputClick", std::bind(&DtTheme::kLineInputClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kOrange1", std::bind(&DtTheme::kOrange1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kGreen1", std::bind(&DtTheme::kGreen1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kRed1", std::bind(&DtTheme::kRed1Set, this, std::placeholders::_1));
    d->m_valueSet.insert("kDividerWhite", std::bind(&DtTheme::kDividerWhiteSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSuccessNormal", std::bind(&DtTheme::kLineSuccessNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSuccessHover", std::bind(&DtTheme::kLineSuccessHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSuccessClick", std::bind(&DtTheme::kLineSuccessClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineSuccessDisable", std::bind(&DtTheme::kLineSuccessDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineErrorNormal", std::bind(&DtTheme::kLineErrorNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineErrorHover", std::bind(&DtTheme::kLineErrorHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineErrorClick", std::bind(&DtTheme::kLineErrorClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWarningNormal", std::bind(&DtTheme::kLineWarningNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWarningHover", std::bind(&DtTheme::kLineWarningHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWarningClick", std::bind(&DtTheme::kLineWarningClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineWarningDisable", std::bind(&DtTheme::kLineWarningDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowPrimaryActive", std::bind(&DtTheme::kShadowPrimaryActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowPrimaryInactive", std::bind(&DtTheme::kShadowPrimaryInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowSecondaryActive", std::bind(&DtTheme::kShadowSecondaryActiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowSecondaryInactive", std::bind(&DtTheme::kShadowSecondaryInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowMin", std::bind(&DtTheme::kShadowMinSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowMenu", std::bind(&DtTheme::kShadowMenuSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kShadowComponent", std::bind(&DtTheme::kShadowComponentSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedNormal", std::bind(&DtTheme::kComponentSelectedNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedHover", std::bind(&DtTheme::kComponentSelectedHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedClick", std::bind(&DtTheme::kComponentSelectedClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedDisable", std::bind(&DtTheme::kComponentSelectedDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedAlphaNormal", std::bind(&DtTheme::kComponentSelectedAlphaNormalSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedAlphaHover", std::bind(&DtTheme::kComponentSelectedAlphaHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedAlphaClick", std::bind(&DtTheme::kComponentSelectedAlphaClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentSelectedAlphaDisable", std::bind(&DtTheme::kComponentSelectedAlphaDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentInput", std::bind(&DtTheme::kComponentInputSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kComponentInputAlpha", std::bind(&DtTheme::kComponentInputAlphaSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSelectAlphaWhiteDisable", std::bind(&DtTheme::kSelectAlphaWhiteDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSelectAlphaWhiteHover", std::bind(&DtTheme::kSelectAlphaWhiteHoverSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSelectAlphaWhiteClick", std::bind(&DtTheme::kSelectAlphaWhiteClickSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kMenu", std::bind(&DtTheme::kMenuSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kLineErrorDisable", std::bind(&DtTheme::kLineErrorDisableSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kContainSecondaryInactive", std::bind(&DtTheme::kContainSecondaryInactiveSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kSelectAlphaWhite", std::bind(&DtTheme::kSelectAlphaWhiteSet, this, std::placeholders::_1));
    d->m_valueSet.insert("kFontPlaceholderText", std::bind(&DtTheme::kFontPlaceholderTextSet, this, std::placeholders::_1));

}

qreal DtTheme::transparency() const
{
    return ThemeGlobalConfig::instance()->transparency();
}

qreal DtTheme::fontSize() const
{
    return ThemeGlobalConfig::instance()->fontSize();
}

QString DtTheme::fontFamily() const
{
    return ThemeGlobalConfig::instance()->fontFamily();
}

Qt::LayoutDirection DtTheme::layoutDirection() const
{
    return ThemeGlobalConfig::instance()->layoutDirection();
}

//强调色
void DtTheme::onThemeColorChanged()
{
    QString themeColor = ThemeGlobalConfig::instance()->themeColor();
    //兼容现有强调色切换逻辑
    if(themeColor == "daybreakBlue" || themeColor.contains("kBrand1")) {
        updateHighLightColor(d->m_kBrand1.pureColor());
    }else if (themeColor == "jamPurple" || themeColor.contains("kBrand2")) {
        updateHighLightColor(d->m_kBrand2.pureColor());
    } else if (themeColor == "magenta" || themeColor.contains("kBrand3")) {
        updateHighLightColor(d->m_kBrand3.pureColor());
    } else if (themeColor == "dustGold" || themeColor.contains("kBrand4")) {
        updateHighLightColor(d->m_kBrand4.pureColor());
    } else if (themeColor == "polarGreen" || themeColor.contains("kBrand5")) {
        updateHighLightColor(d->m_kBrand5.pureColor());
    } else if (themeColor == "sunRed" || themeColor.contains("kBrand6")) {
        updateHighLightColor(d->m_kBrand6.pureColor());
    } else if (themeColor == "sunsetOrange" || themeColor.contains("kBrand7")) {
        updateHighLightColor(d->m_kBrand7.pureColor());
    } else if (themeColor.contains("kBrand8")) {
        updateHighLightColor(d->m_kBrand8.pureColor());
    } else if (themeColor.contains("kBrand9")) {
        updateHighLightColor(d->m_kBrand9.pureColor());
    } else if(themeColor.startsWith("#")) {
        //兼容gsettings键值为#FFFFFF格式的颜色
        if(QColor::isValidColor(themeColor)) {
            updateHighLightColor(QColor(themeColor));
        }
    } else {
        //兼容rgba格式颜色
        QRegularExpression rgbaReg(R"((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d),\s*(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d),\s*(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d),\s*(0(\.\d+)?|1(\.0+)?|0|1))");
        QRegularExpression rgbReg(R"((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d),\s*(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d),\s*(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d))");
        QStringList rgbaList = rgbaReg.match(themeColor).hasMatch() ? rgbaReg.match(themeColor).capturedTexts()
                                                                    : rgbReg.match(themeColor).capturedTexts();
        if(rgbaList.size() >= 4) {
            QColor rgba;
            rgba.setRed(rgbaList.at(1).toInt());
            rgba.setGreen(rgbaList.at(2).toInt());
            rgba.setBlue(rgbaList.at(3).toInt());
            if(rgbaList.size() >= 5) {
                auto alpha = rgbaList.at(4).toDouble();
                rgba.setAlphaF(alpha > 1 ? alpha/255 : alpha);
            }
            updateHighLightColor(rgba);
        }
    }
}

void DtTheme::updateHighLightColor(QColor highlightColor)
{
    d->m_highlightActive.setPureColor(highlightColor);
    d->m_highlightInactive.setPureColor(highlightColor);
    d->m_kBrandNormal.setPureColor(highlightColor);
    d->m_linkActive.setPureColor(highlightColor);
    d->m_linkInactive.setPureColor(highlightColor);
    d->m_linkVisitedActive.setPureColor(highlightColor);
    d->m_linkVisitedInactive.setPureColor(highlightColor);

    //强调色禁用为当前高亮色*0.44透明度
    QColor color = highlightColor;
    color.setAlphaF(0.45);
    d->m_kBrandDisable.setPureColor(color);
    d->m_highlightDisable.setPureColor(color);
    d->m_linkDisable.setPureColor(color);
    d->m_linkVisitedDisable.setPureColor(color);

    //强调色悬浮需要在强调色基础上叠加一个0.1透明度黑色背景色（0，0，0，0.1）
    if(d->m_kBrandHover.colorType() == DtColorType::Gradient) {
        d->m_kBrandHover.setGradientBackground(highlightColor);
    } else {
        d->m_kBrandHover.setPureColor(d->m_kBrandHover.mixBackGroundColor(QColor(0,0,0,0.1*255),highlightColor, 1));
    }
    //强调色点击需要在强调色基础上叠加一个0.2透明度黑色背景色（0，0，0，0.2）
    if(d->m_kBrandClick.colorType() == DtColorType::Gradient) {
        d->m_kBrandClick.setGradientBackground(highlightColor);
    } else {
        d->m_kBrandClick.setPureColor(d->m_kBrandClick.mixBackGroundColor(QColor(0,0,0,0.2*255),highlightColor, 1));
    }
    //TODO 强调色描边需要根据主题不同，使用不同的公式计算悬停，点击，禁用
    //强调色描边需要在强调色的基础上乘以0.55透明度
    color.setAlphaF(0.55);
    d->m_kLineBrandNormal.setPureColor(color);
    //强调色描边悬浮在5.0主题下需要在强调色基础上叠加一个0.1透明度黑色背景色（0，0，0，0.1）
    if(d->m_kLineBrandHover.colorType() == DtColorType::Gradient) {
        d->m_kLineBrandHover.setGradientBackground(color);
    } else {
        d->m_kLineBrandHover.setPureColor(d->m_kLineBrandHover.mixBackGroundColor(QColor(0,0,0,0.1*255),color, 1));
    }
    //强调色描边点击在5.0主题下需要在强调色基础上叠加一个0.2透明度黑色背景色（0，0，0，0.2）
    if(d->m_kLineBrandClick.colorType() == DtColorType::Gradient) {
        d->m_kLineBrandClick.setGradientBackground(color);
    } else {
        d->m_kLineBrandClick.setPureColor(d->m_kLineBrandClick.mixBackGroundColor(QColor(0,0,0,0.2*255),color, 1));
    }
    //强调色描边不可用需要在强调色基础上再乘以0.45透明度
    color.setAlphaF(0.55*0.45);
    d->m_kLineBrandDisable.setPureColor(color);
}

void DtTheme::onWindowRadiusChanged()
{
    QString windowRadius = ThemeGlobalConfig::instance()->windowRadius();
    if(windowRadius.contains("bigRadius")) {
        kRadiusWindowSet(12);
        kRadiusMenuSet(8);
    } else if(windowRadius.contains("mediumRadius")) {
        kRadiusWindowSet(6);
        kRadiusMenuSet(4);
    } else if(windowRadius.contains("noRadius")) {
        kRadiusWindowSet(0);
        kRadiusMenuSet(0);
    } else {
        QRegularExpression radiusReg(R"(([0-9][0-9]|[0-9]),\s*([0-9][0-9]|[0-9]))");
        if(radiusReg.match(windowRadius).hasMatch()) {
            QStringList radiusList = radiusReg.match(windowRadius).capturedTexts();
            kRadiusWindowSet(radiusList.at(1).toInt());
            kRadiusMenuSet(radiusList.at(2).toInt());
        }
    }
}

bool DtTheme::isDarkTheme()
{
    return ThemeGlobalConfig::instance()->isDarkTheme();
}

COLOR_TOKEN_GETTER(windowTextActive)
COLOR_TOKEN_GETTER(windowTextInactive)
COLOR_TOKEN_GETTER(windowTextDisable)
COLOR_TOKEN_GETTER(buttonActive)
COLOR_TOKEN_GETTER(buttonInactive)
COLOR_TOKEN_GETTER(buttonDisable)
COLOR_TOKEN_GETTER(lightActive)
COLOR_TOKEN_GETTER(lightInactive)
COLOR_TOKEN_GETTER(lightDisable)
COLOR_TOKEN_GETTER(midLightActive)
COLOR_TOKEN_GETTER(midLightInactive)
COLOR_TOKEN_GETTER(midLightDisable)
COLOR_TOKEN_GETTER(darkActive)
COLOR_TOKEN_GETTER(darkInactive)
COLOR_TOKEN_GETTER(darkDisable)
COLOR_TOKEN_GETTER(midActive)
COLOR_TOKEN_GETTER(midInactive)
COLOR_TOKEN_GETTER(midDisable)
COLOR_TOKEN_GETTER(textActive)
COLOR_TOKEN_GETTER(textInactive)
COLOR_TOKEN_GETTER(textDisable)
COLOR_TOKEN_GETTER(brightTextActive)
COLOR_TOKEN_GETTER(brightTextInactive)
COLOR_TOKEN_GETTER(brightTextDisable)
COLOR_TOKEN_GETTER(buttonTextActive)
COLOR_TOKEN_GETTER(buttonTextInactive)
COLOR_TOKEN_GETTER(buttonTextDisable)
COLOR_TOKEN_GETTER(baseActive)
COLOR_TOKEN_GETTER(baseInactive)
COLOR_TOKEN_GETTER(baseDisable)
COLOR_TOKEN_GETTER(windowActive)
COLOR_TOKEN_GETTER(windowInactive)
COLOR_TOKEN_GETTER(windowDisable)
COLOR_TOKEN_GETTER(shadowActive)
COLOR_TOKEN_GETTER(shadowInactive)
COLOR_TOKEN_GETTER(shadowDisable)
COLOR_TOKEN_GETTER(highlightActive)
COLOR_TOKEN_GETTER(highlightInactive)
COLOR_TOKEN_GETTER(highlightDisable)
COLOR_TOKEN_GETTER(highlightedTextActive)
COLOR_TOKEN_GETTER(highlightedTextInactive)
COLOR_TOKEN_GETTER(highlightedTextDisable)
COLOR_TOKEN_GETTER(linkActive)
COLOR_TOKEN_GETTER(linkInactive)
COLOR_TOKEN_GETTER(linkDisable)

COLOR_TOKEN_GETTER(linkVisitedDisable)
COLOR_TOKEN_GETTER(alternateBaseActive)
COLOR_TOKEN_GETTER(alternateBaseInactive)
COLOR_TOKEN_GETTER(alternateBaseDisable)
COLOR_TOKEN_GETTER(noRoleActive)
COLOR_TOKEN_GETTER(noRoleInactive)
COLOR_TOKEN_GETTER(noRoleDisable)
COLOR_TOKEN_GETTER(toolTipBaseActive)
COLOR_TOKEN_GETTER(toolTipBaseInactive)
COLOR_TOKEN_GETTER(toolTipBaseDisable)
COLOR_TOKEN_GETTER(toolTipTextActive)
COLOR_TOKEN_GETTER(toolTipTextInactive)
COLOR_TOKEN_GETTER(toolTipTextDisable)
COLOR_TOKEN_GETTER(placeholderTextActive)
COLOR_TOKEN_GETTER(placeholderTextInactive)
COLOR_TOKEN_GETTER(placeholderTextDisable)

COLOR_TOKEN_GETTER(kWhite)
COLOR_TOKEN_GETTER(kBlack)
COLOR_TOKEN_GETTER(kGray0)
COLOR_TOKEN_GETTER(kGray1)
COLOR_TOKEN_GETTER(kGray2)
COLOR_TOKEN_GETTER(kGray3)
COLOR_TOKEN_GETTER(kGray4)
COLOR_TOKEN_GETTER(kGray5)
COLOR_TOKEN_GETTER(kGray6)
COLOR_TOKEN_GETTER(kGray7)
COLOR_TOKEN_GETTER(kGray8)
COLOR_TOKEN_GETTER(kGray9)
COLOR_TOKEN_GETTER(kGray10)
COLOR_TOKEN_GETTER(kGray11)
COLOR_TOKEN_GETTER(kGray12)
COLOR_TOKEN_GETTER(kGray13)
COLOR_TOKEN_GETTER(kGray14)
COLOR_TOKEN_GETTER(kGray15)
COLOR_TOKEN_GETTER(kGray16)
COLOR_TOKEN_GETTER(kGray17)
COLOR_TOKEN_GETTER(kGrayAlpha0)
COLOR_TOKEN_GETTER(kGrayAlpha1)
COLOR_TOKEN_GETTER(kGrayAlpha2)
COLOR_TOKEN_GETTER(kGrayAlpha3)
COLOR_TOKEN_GETTER(kGrayAlpha4)
COLOR_TOKEN_GETTER(kGrayAlpha5)
COLOR_TOKEN_GETTER(kGrayAlpha6)
COLOR_TOKEN_GETTER(kGrayAlpha7)
COLOR_TOKEN_GETTER(kGrayAlpha8)
COLOR_TOKEN_GETTER(kGrayAlpha9)
COLOR_TOKEN_GETTER(kGrayAlpha10)
COLOR_TOKEN_GETTER(kGrayAlpha11)
COLOR_TOKEN_GETTER(kGrayAlpha12)
COLOR_TOKEN_GETTER(kGrayAlpha13)

COLOR_TOKEN_GETTER(kFontStrong)
COLOR_TOKEN_GETTER(kFontPrimary)
COLOR_TOKEN_GETTER(kFontPrimaryDisable)
COLOR_TOKEN_GETTER(kFontSecondary)
COLOR_TOKEN_GETTER(kFontSecondaryDisable)
COLOR_TOKEN_GETTER(kFontWhite)
COLOR_TOKEN_GETTER(kFontWhiteDisable)
COLOR_TOKEN_GETTER(kFontWhiteSecondary)
COLOR_TOKEN_GETTER(kFontWhiteSecondaryDisable)

COLOR_TOKEN_GETTER(kBrandNormal)
COLOR_TOKEN_GETTER(kSuccessNormal)
COLOR_TOKEN_GETTER(kWarningNormal)
COLOR_TOKEN_GETTER(kErrorNormal)
COLOR_TOKEN_GETTER(kBrand1)
COLOR_TOKEN_GETTER(kBrand2)
COLOR_TOKEN_GETTER(kBrand3)
COLOR_TOKEN_GETTER(kBrand4)
COLOR_TOKEN_GETTER(kBrand5)
COLOR_TOKEN_GETTER(kBrand6)
COLOR_TOKEN_GETTER(kBrand7)

COLOR_TOKEN_GETTER(kContainGeneralNormal)
COLOR_TOKEN_GETTER(kContainSecondaryNormal)
COLOR_TOKEN_GETTER(kContainSecondaryAlphaNormal)
COLOR_TOKEN_GETTER(kComponentNormal)
COLOR_TOKEN_GETTER(kComponentDisable)
COLOR_TOKEN_GETTER(kComponentAlphaNormal)
COLOR_TOKEN_GETTER(kComponentAlphaDisable)
COLOR_TOKEN_GETTER(kLineWindowActive)
COLOR_TOKEN_GETTER(kLineComponentNormal)
COLOR_TOKEN_GETTER(kLineComponentHover)
COLOR_TOKEN_GETTER(kLineComponentClick)
COLOR_TOKEN_GETTER(kLineComponentDisable)
COLOR_TOKEN_GETTER(kLineBrandNormal)
COLOR_TOKEN_GETTER(kLineBrandHover)
COLOR_TOKEN_GETTER(kLineBrandClick)
COLOR_TOKEN_GETTER(kLineBrandDisable)
COLOR_TOKEN_GETTER(kModalMask)
COLOR_TOKEN_GETTER(linkVisitedActive)
COLOR_TOKEN_GETTER(linkVisitedInactive)
COLOR_TOKEN_GETTER(kBrandHover)
COLOR_TOKEN_GETTER(kBrandClick)
COLOR_TOKEN_GETTER(kBrandFocus)
COLOR_TOKEN_GETTER(kSuccessHover)
COLOR_TOKEN_GETTER(kSuccessClick)
COLOR_TOKEN_GETTER(kWarningHover)
COLOR_TOKEN_GETTER(kWarningClick)
COLOR_TOKEN_GETTER(kErrorHover)
COLOR_TOKEN_GETTER(kErrorClick)
COLOR_TOKEN_GETTER(kContainHover)
COLOR_TOKEN_GETTER(kContainClick)
COLOR_TOKEN_GETTER(kComponentHover)
COLOR_TOKEN_GETTER(kComponentClick)
COLOR_TOKEN_GETTER(kComponentAlphaHover)
COLOR_TOKEN_GETTER(kComponentAlphaClick)
COLOR_TOKEN_GETTER(kErrorDisable)
COLOR_TOKEN_GETTER(kWarningDisable)
COLOR_TOKEN_GETTER(kLineNormal)
COLOR_TOKEN_GETTER(kContainGeneralAlphaNormal)
COLOR_TOKEN_GETTER(kSuccessDisable)
COLOR_TOKEN_GETTER(kLineWindowInactive)
COLOR_TOKEN_GETTER(kContainAlphaClick)
COLOR_TOKEN_GETTER(kContainAlphaHover)
COLOR_TOKEN_GETTER(kBrandDisable)
COLOR_TOKEN_GETTER(kLineDisable)
COLOR_TOKEN_GETTER(kDivider)

COLOR_TOKEN_GETTER(kBrand8)
COLOR_TOKEN_GETTER(kBrand9)
COLOR_TOKEN_GETTER(kLineSelectboxNormal)
COLOR_TOKEN_GETTER(kLineSelectboxHover)
COLOR_TOKEN_GETTER(kLineSelectboxClick)
COLOR_TOKEN_GETTER(kLineSelectboxSelected)
COLOR_TOKEN_GETTER(kLineSelectboxDisable)
COLOR_TOKEN_GETTER(kFontWhitePlaceholderTextDisable)
COLOR_TOKEN_GETTER(kContainGeneralInactive)
COLOR_TOKEN_GETTER(kFontPlaceholderTextDisable)
COLOR_TOKEN_GETTER(kFontWhitePlaceholderText)
COLOR_TOKEN_GETTER(kLineInputDisable)
COLOR_TOKEN_GETTER(kLineDock)
COLOR_TOKEN_GETTER(kLineMenu)
COLOR_TOKEN_GETTER(kLineTable)
COLOR_TOKEN_GETTER(kLineInputNormal)
COLOR_TOKEN_GETTER(kLineInputHover)
COLOR_TOKEN_GETTER(kLineInputClick)
COLOR_TOKEN_GETTER(kOrange1)
COLOR_TOKEN_GETTER(kGreen1)
COLOR_TOKEN_GETTER(kRed1)
COLOR_TOKEN_GETTER(kDividerWhite)
COLOR_TOKEN_GETTER(kLineSuccessNormal)
COLOR_TOKEN_GETTER(kLineSuccessHover)
COLOR_TOKEN_GETTER(kLineSuccessClick)
COLOR_TOKEN_GETTER(kLineSuccessDisable)
COLOR_TOKEN_GETTER(kLineErrorNormal)
COLOR_TOKEN_GETTER(kLineErrorHover)
COLOR_TOKEN_GETTER(kLineErrorClick)
COLOR_TOKEN_GETTER(kLineWarningNormal)
COLOR_TOKEN_GETTER(kLineWarningHover)
COLOR_TOKEN_GETTER(kLineWarningClick)
COLOR_TOKEN_GETTER(kLineWarningDisable)
COLOR_TOKEN_GETTER(kComponentSelectedNormal)
COLOR_TOKEN_GETTER(kComponentSelectedHover)
COLOR_TOKEN_GETTER(kComponentSelectedClick)
COLOR_TOKEN_GETTER(kComponentSelectedDisable)
COLOR_TOKEN_GETTER(kComponentSelectedAlphaNormal)
COLOR_TOKEN_GETTER(kComponentSelectedAlphaHover)
COLOR_TOKEN_GETTER(kComponentSelectedAlphaClick)
COLOR_TOKEN_GETTER(kComponentSelectedAlphaDisable)
COLOR_TOKEN_GETTER(kComponentInput)
COLOR_TOKEN_GETTER(kComponentInputAlpha)
COLOR_TOKEN_GETTER(kSelectAlphaWhiteDisable)
COLOR_TOKEN_GETTER(kSelectAlphaWhiteHover)
COLOR_TOKEN_GETTER(kSelectAlphaWhiteClick)
COLOR_TOKEN_GETTER(kMenu)
COLOR_TOKEN_GETTER(kLineErrorDisable)
COLOR_TOKEN_GETTER(kContainSecondaryInactive)
COLOR_TOKEN_GETTER(kSelectAlphaWhite)
COLOR_TOKEN_GETTER(kFontPlaceholderText)

INT_TOKEN_GETTER(normalLine)
INT_TOKEN_GETTER(focusLine)
INT_TOKEN_GETTER(kRadiusMin)
INT_TOKEN_GETTER(kRadiusNormal)
INT_TOKEN_GETTER(kRadiusMax)
INT_TOKEN_GETTER(kRadiusMenu)
INT_TOKEN_GETTER(kRadiusWindow)
INT_TOKEN_GETTER(kMarginMin)
INT_TOKEN_GETTER(kMarginNormal)
INT_TOKEN_GETTER(kMarginBig)
INT_TOKEN_GETTER(kMarginWindow)
INT_TOKEN_GETTER(kMarginComponent)
INT_TOKEN_GETTER(kPaddingMinLeft)
INT_TOKEN_GETTER(kPaddingMinTop)
INT_TOKEN_GETTER(kPaddingMinRight)
INT_TOKEN_GETTER(kPaddingMinBottom)
INT_TOKEN_GETTER(kPaddingNormalLeft)
INT_TOKEN_GETTER(kPaddingNormalTop)
INT_TOKEN_GETTER(kPaddingNormalRight)
INT_TOKEN_GETTER(kPaddingNormalBottom)
INT_TOKEN_GETTER(kPadding8Left)
INT_TOKEN_GETTER(kPadding8Top)
INT_TOKEN_GETTER(kPadding8Right)
INT_TOKEN_GETTER(kPadding8Bottom)
INT_TOKEN_GETTER(kPaddingWindowLeft)
INT_TOKEN_GETTER(kPaddingWindowTop)
INT_TOKEN_GETTER(kPaddingWindowRight)
INT_TOKEN_GETTER(kPaddingWindowBottom)

SHADOW_TOKEN_GETTER(kShadowPrimaryActive)
SHADOW_TOKEN_GETTER(kShadowPrimaryInactive)
SHADOW_TOKEN_GETTER(kShadowSecondaryActive)
SHADOW_TOKEN_GETTER(kShadowSecondaryInactive)
SHADOW_TOKEN_GETTER(kShadowMin)
SHADOW_TOKEN_GETTER(kShadowMenu)
SHADOW_TOKEN_GETTER(kShadowComponent)


COLOR_TOKEN_SETTER(windowTextActive)
COLOR_TOKEN_SETTER(windowTextInactive)
COLOR_TOKEN_SETTER(windowTextDisable)
COLOR_TOKEN_SETTER(buttonActive)
COLOR_TOKEN_SETTER(buttonInactive)
COLOR_TOKEN_SETTER(buttonDisable)
COLOR_TOKEN_SETTER(lightActive)
COLOR_TOKEN_SETTER(lightInactive)
COLOR_TOKEN_SETTER(lightDisable)
COLOR_TOKEN_SETTER(midLightActive)
COLOR_TOKEN_SETTER(midLightInactive)
COLOR_TOKEN_SETTER(midLightDisable)
COLOR_TOKEN_SETTER(darkActive)
COLOR_TOKEN_SETTER(darkInactive)
COLOR_TOKEN_SETTER(darkDisable)
COLOR_TOKEN_SETTER(midActive)
COLOR_TOKEN_SETTER(midInactive)
COLOR_TOKEN_SETTER(midDisable)
COLOR_TOKEN_SETTER(textActive)
COLOR_TOKEN_SETTER(textInactive)
COLOR_TOKEN_SETTER(textDisable)
COLOR_TOKEN_SETTER(brightTextActive)
COLOR_TOKEN_SETTER(brightTextInactive)
COLOR_TOKEN_SETTER(brightTextDisable)
COLOR_TOKEN_SETTER(buttonTextActive)
COLOR_TOKEN_SETTER(buttonTextInactive)
COLOR_TOKEN_SETTER(buttonTextDisable)
COLOR_TOKEN_SETTER(baseActive)
COLOR_TOKEN_SETTER(baseInactive)
COLOR_TOKEN_SETTER(baseDisable)
COLOR_TOKEN_SETTER(windowActive)
COLOR_TOKEN_SETTER(windowInactive)
COLOR_TOKEN_SETTER(windowDisable)
COLOR_TOKEN_SETTER(shadowActive)
COLOR_TOKEN_SETTER(shadowInactive)
COLOR_TOKEN_SETTER(shadowDisable)
COLOR_TOKEN_SETTER(highlightActive)
COLOR_TOKEN_SETTER(highlightInactive)
COLOR_TOKEN_SETTER(highlightDisable)
COLOR_TOKEN_SETTER(highlightedTextActive)
COLOR_TOKEN_SETTER(highlightedTextInactive)
COLOR_TOKEN_SETTER(highlightedTextDisable)
COLOR_TOKEN_SETTER(linkActive)
COLOR_TOKEN_SETTER(linkInactive)
COLOR_TOKEN_SETTER(linkDisable)
COLOR_TOKEN_SETTER(linkVisitedDisable)
COLOR_TOKEN_SETTER(alternateBaseActive)
COLOR_TOKEN_SETTER(alternateBaseInactive)
COLOR_TOKEN_SETTER(alternateBaseDisable)
COLOR_TOKEN_SETTER(noRoleActive)
COLOR_TOKEN_SETTER(noRoleInactive)
COLOR_TOKEN_SETTER(noRoleDisable)
COLOR_TOKEN_SETTER(toolTipBaseActive)
COLOR_TOKEN_SETTER(toolTipBaseInactive)
COLOR_TOKEN_SETTER(toolTipBaseDisable)
COLOR_TOKEN_SETTER(toolTipTextActive)
COLOR_TOKEN_SETTER(toolTipTextInactive)
COLOR_TOKEN_SETTER(toolTipTextDisable)
COLOR_TOKEN_SETTER(placeholderTextActive)
COLOR_TOKEN_SETTER(placeholderTextInactive)
COLOR_TOKEN_SETTER(placeholderTextDisable)

COLOR_TOKEN_SETTER(kWhite)
COLOR_TOKEN_SETTER(kBlack)
COLOR_TOKEN_SETTER(kGray0)
COLOR_TOKEN_SETTER(kGray1)
COLOR_TOKEN_SETTER(kGray2)
COLOR_TOKEN_SETTER(kGray3)
COLOR_TOKEN_SETTER(kGray4)
COLOR_TOKEN_SETTER(kGray5)
COLOR_TOKEN_SETTER(kGray6)
COLOR_TOKEN_SETTER(kGray7)
COLOR_TOKEN_SETTER(kGray8)
COLOR_TOKEN_SETTER(kGray9)
COLOR_TOKEN_SETTER(kGray10)
COLOR_TOKEN_SETTER(kGray11)
COLOR_TOKEN_SETTER(kGray12)
COLOR_TOKEN_SETTER(kGray13)
COLOR_TOKEN_SETTER(kGray14)
COLOR_TOKEN_SETTER(kGray15)
COLOR_TOKEN_SETTER(kGray16)
COLOR_TOKEN_SETTER(kGray17)
COLOR_TOKEN_SETTER(kGrayAlpha0)
COLOR_TOKEN_SETTER(kGrayAlpha1)
COLOR_TOKEN_SETTER(kGrayAlpha2)
COLOR_TOKEN_SETTER(kGrayAlpha3)
COLOR_TOKEN_SETTER(kGrayAlpha4)
COLOR_TOKEN_SETTER(kGrayAlpha5)
COLOR_TOKEN_SETTER(kGrayAlpha6)
COLOR_TOKEN_SETTER(kGrayAlpha7)
COLOR_TOKEN_SETTER(kGrayAlpha8)
COLOR_TOKEN_SETTER(kGrayAlpha9)
COLOR_TOKEN_SETTER(kGrayAlpha10)
COLOR_TOKEN_SETTER(kGrayAlpha11)
COLOR_TOKEN_SETTER(kGrayAlpha12)
COLOR_TOKEN_SETTER(kGrayAlpha13)

COLOR_TOKEN_SETTER(kFontStrong)
COLOR_TOKEN_SETTER(kFontPrimary)
COLOR_TOKEN_SETTER(kFontPrimaryDisable)
COLOR_TOKEN_SETTER(kFontSecondary)
COLOR_TOKEN_SETTER(kFontSecondaryDisable)
COLOR_TOKEN_SETTER(kFontWhite)
COLOR_TOKEN_SETTER(kFontWhiteDisable)
COLOR_TOKEN_SETTER(kFontWhiteSecondary)
COLOR_TOKEN_SETTER(kFontWhiteSecondaryDisable)

COLOR_TOKEN_SETTER(kBrandNormal)
COLOR_TOKEN_SETTER(kSuccessNormal)
COLOR_TOKEN_SETTER(kWarningNormal)
COLOR_TOKEN_SETTER(kErrorNormal)
COLOR_TOKEN_SETTER(kBrand1)
COLOR_TOKEN_SETTER(kBrand2)
COLOR_TOKEN_SETTER(kBrand3)
COLOR_TOKEN_SETTER(kBrand4)
COLOR_TOKEN_SETTER(kBrand5)
COLOR_TOKEN_SETTER(kBrand6)
COLOR_TOKEN_SETTER(kBrand7)

COLOR_TOKEN_SETTER(kContainGeneralNormal)
COLOR_TOKEN_SETTER(kContainSecondaryNormal)
COLOR_TOKEN_SETTER(kContainSecondaryAlphaNormal)
COLOR_TOKEN_SETTER(kComponentNormal)
COLOR_TOKEN_SETTER(kComponentDisable)
COLOR_TOKEN_SETTER(kComponentAlphaNormal)
COLOR_TOKEN_SETTER(kComponentAlphaDisable)
COLOR_TOKEN_SETTER(kLineWindowActive)
COLOR_TOKEN_SETTER(kLineComponentNormal)
COLOR_TOKEN_SETTER(kLineComponentHover)
COLOR_TOKEN_SETTER(kLineComponentClick)
COLOR_TOKEN_SETTER(kLineComponentDisable)
COLOR_TOKEN_SETTER(kLineBrandNormal)
COLOR_TOKEN_SETTER(kLineBrandHover)
COLOR_TOKEN_SETTER(kLineBrandClick)
COLOR_TOKEN_SETTER(kLineBrandDisable)
COLOR_TOKEN_SETTER(kModalMask)
COLOR_TOKEN_SETTER(kComponentAlphaClick)
COLOR_TOKEN_SETTER(kComponentAlphaHover)
COLOR_TOKEN_SETTER(kComponentHover)
COLOR_TOKEN_SETTER(kComponentClick)
COLOR_TOKEN_SETTER(kContainHover)
COLOR_TOKEN_SETTER(kContainClick)
COLOR_TOKEN_SETTER(kBrandHover)
COLOR_TOKEN_SETTER(kBrandClick)
COLOR_TOKEN_SETTER(kBrandFocus)
COLOR_TOKEN_SETTER(kSuccessHover)
COLOR_TOKEN_SETTER(kSuccessClick)
COLOR_TOKEN_SETTER(kErrorHover)
COLOR_TOKEN_SETTER(kErrorClick)
COLOR_TOKEN_SETTER(kWarningHover)
COLOR_TOKEN_SETTER(kWarningClick)
COLOR_TOKEN_SETTER(linkVisitedActive)
COLOR_TOKEN_SETTER(linkVisitedInactive)
COLOR_TOKEN_SETTER(kErrorDisable)
COLOR_TOKEN_SETTER(kWarningDisable)
COLOR_TOKEN_SETTER(kLineNormal)
COLOR_TOKEN_SETTER(kContainGeneralAlphaNormal)
COLOR_TOKEN_SETTER(kSuccessDisable)
COLOR_TOKEN_SETTER(kLineWindowInactive)
COLOR_TOKEN_SETTER(kContainAlphaClick)
COLOR_TOKEN_SETTER(kContainAlphaHover)
COLOR_TOKEN_SETTER(kBrandDisable)
COLOR_TOKEN_SETTER(kLineDisable)
COLOR_TOKEN_SETTER(kDivider)

COLOR_TOKEN_SETTER(kBrand8)
COLOR_TOKEN_SETTER(kBrand9)
COLOR_TOKEN_SETTER(kLineSelectboxNormal)
COLOR_TOKEN_SETTER(kLineSelectboxHover)
COLOR_TOKEN_SETTER(kLineSelectboxClick)
COLOR_TOKEN_SETTER(kLineSelectboxSelected)
COLOR_TOKEN_SETTER(kLineSelectboxDisable)
COLOR_TOKEN_SETTER(kFontWhitePlaceholderTextDisable)
COLOR_TOKEN_SETTER(kContainGeneralInactive)
COLOR_TOKEN_SETTER(kFontPlaceholderTextDisable)
COLOR_TOKEN_SETTER(kFontWhitePlaceholderText)
COLOR_TOKEN_SETTER(kLineInputDisable)
COLOR_TOKEN_SETTER(kLineDock)
COLOR_TOKEN_SETTER(kLineMenu)
COLOR_TOKEN_SETTER(kLineTable)
COLOR_TOKEN_SETTER(kLineInputNormal)
COLOR_TOKEN_SETTER(kLineInputHover)
COLOR_TOKEN_SETTER(kLineInputClick)
COLOR_TOKEN_SETTER(kOrange1)
COLOR_TOKEN_SETTER(kGreen1)
COLOR_TOKEN_SETTER(kRed1)
COLOR_TOKEN_SETTER(kDividerWhite)
COLOR_TOKEN_SETTER(kLineSuccessNormal)
COLOR_TOKEN_SETTER(kLineSuccessHover)
COLOR_TOKEN_SETTER(kLineSuccessClick)
COLOR_TOKEN_SETTER(kLineSuccessDisable)
COLOR_TOKEN_SETTER(kLineErrorNormal)
COLOR_TOKEN_SETTER(kLineErrorHover)
COLOR_TOKEN_SETTER(kLineErrorClick)
COLOR_TOKEN_SETTER(kLineWarningNormal)
COLOR_TOKEN_SETTER(kLineWarningHover)
COLOR_TOKEN_SETTER(kLineWarningClick)
COLOR_TOKEN_SETTER(kLineWarningDisable)
COLOR_TOKEN_SETTER(kComponentSelectedNormal)
COLOR_TOKEN_SETTER(kComponentSelectedHover)
COLOR_TOKEN_SETTER(kComponentSelectedClick)
COLOR_TOKEN_SETTER(kComponentSelectedDisable)
COLOR_TOKEN_SETTER(kComponentSelectedAlphaNormal)
COLOR_TOKEN_SETTER(kComponentSelectedAlphaHover)
COLOR_TOKEN_SETTER(kComponentSelectedAlphaClick)
COLOR_TOKEN_SETTER(kComponentSelectedAlphaDisable)
COLOR_TOKEN_SETTER(kComponentInput)
COLOR_TOKEN_SETTER(kComponentInputAlpha)
COLOR_TOKEN_SETTER(kSelectAlphaWhiteDisable)
COLOR_TOKEN_SETTER(kSelectAlphaWhiteHover)
COLOR_TOKEN_SETTER(kSelectAlphaWhiteClick)
COLOR_TOKEN_SETTER(kMenu)
COLOR_TOKEN_SETTER(kLineErrorDisable)
COLOR_TOKEN_SETTER(kContainSecondaryInactive)
COLOR_TOKEN_SETTER(kSelectAlphaWhite)
COLOR_TOKEN_SETTER(kFontPlaceholderText)

INT_TOKEN_SETTER(normalLine)
INT_TOKEN_SETTER(focusLine)
INT_TOKEN_SETTER(kRadiusMin)
INT_TOKEN_SETTER(kRadiusNormal)
INT_TOKEN_SETTER(kRadiusMax)
INT_TOKEN_SETTER(kRadiusMenu)
INT_TOKEN_SETTER(kRadiusWindow)
INT_TOKEN_SETTER(kMarginMin)
INT_TOKEN_SETTER(kMarginNormal)
INT_TOKEN_SETTER(kMarginBig)
INT_TOKEN_SETTER(kMarginWindow)
INT_TOKEN_SETTER(kMarginComponent)
INT_TOKEN_SETTER(kPaddingMinLeft)
INT_TOKEN_SETTER(kPaddingMinTop)
INT_TOKEN_SETTER(kPaddingMinRight)
INT_TOKEN_SETTER(kPaddingMinBottom)
INT_TOKEN_SETTER(kPaddingNormalLeft)
INT_TOKEN_SETTER(kPaddingNormalTop)
INT_TOKEN_SETTER(kPaddingNormalRight)
INT_TOKEN_SETTER(kPaddingNormalBottom)
INT_TOKEN_SETTER(kPadding8Left)
INT_TOKEN_SETTER(kPadding8Top)
INT_TOKEN_SETTER(kPadding8Right)
INT_TOKEN_SETTER(kPadding8Bottom)
INT_TOKEN_SETTER(kPaddingWindowLeft)
INT_TOKEN_SETTER(kPaddingWindowTop)
INT_TOKEN_SETTER(kPaddingWindowRight)
INT_TOKEN_SETTER(kPaddingWindowBottom)

SHADOW_TOKEN_SETTER(kShadowPrimaryActive)
SHADOW_TOKEN_SETTER(kShadowPrimaryInactive)
SHADOW_TOKEN_SETTER(kShadowSecondaryActive)
SHADOW_TOKEN_SETTER(kShadowSecondaryInactive)
SHADOW_TOKEN_SETTER(kShadowMin)
SHADOW_TOKEN_SETTER(kShadowMenu)
SHADOW_TOKEN_SETTER(kShadowComponent)
} // UkuiQuick
