From 326e68059fe4e7c5ca0570ff7427275404859be5 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Tue, 31 Oct 2023 11:52:03 +0100
Subject: [PATCH] UI: Remove the theme thing and only use the one given by the
 system

---
 src/UI/ScriptDocumentView.cc |   2 +
 src/UI/ScriptDocumentView.hh |   2 -
 src/UI/Theme/Theme.cc        | 373 --------------------------
 src/UI/Theme/Theme.hh        | 503 -----------------------------------
 src/UI/Theme/ThemeMac.hh     |   6 -
 src/UI/Theme/ThemeMac.mm     |  21 --
 src/VivyApplication.cc       |  38 ---
 src/VivyApplication.hh       |   8 -
 8 files changed, 2 insertions(+), 951 deletions(-)
 delete mode 100644 src/UI/Theme/Theme.cc
 delete mode 100644 src/UI/Theme/Theme.hh
 delete mode 100644 src/UI/Theme/ThemeMac.hh
 delete mode 100644 src/UI/Theme/ThemeMac.mm

diff --git a/src/UI/ScriptDocumentView.cc b/src/UI/ScriptDocumentView.cc
index 9587b869..d7932ebb 100644
--- a/src/UI/ScriptDocumentView.cc
+++ b/src/UI/ScriptDocumentView.cc
@@ -1,6 +1,8 @@
 #include "PreCompiledHeaders.hh"
 #include "UI/ScriptDocumentView.hh"
 #include "UI/MainWindow.hh"
+#include "Lib/Utils.hh"
+#include "Lib/Log.hh"
 #include "VivyApplication.hh"
 
 using namespace Vivy;
diff --git a/src/UI/ScriptDocumentView.hh b/src/UI/ScriptDocumentView.hh
index 2b92fa28..76a42790 100644
--- a/src/UI/ScriptDocumentView.hh
+++ b/src/UI/ScriptDocumentView.hh
@@ -7,8 +7,6 @@
 
 #include "PreCompiledHeaders.hh"
 #include "VivyApplication.hh"
-#include "Lib/Utils.hh"
-#include "Lib/Log.hh"
 #include "Lib/Script/ScriptDocument.hh"
 #include "UI/AbstractDocumentView.hh"
 
diff --git a/src/UI/Theme/Theme.cc b/src/UI/Theme/Theme.cc
deleted file mode 100644
index c68fbd5b..00000000
--- a/src/UI/Theme/Theme.cc
+++ /dev/null
@@ -1,373 +0,0 @@
-#include "PreCompiledHeaders.hh"
-#include "UI/Theme/Theme.hh"
-#include "VivyApplication.hh"
-#include "Lib/HostOsInfo.hh"
-#if VIVY_MACOS
-#import "ThemeMac.hh"
-#endif
-
-namespace Vivy
-{
-struct Theme::Private {
-    Private() noexcept;
-
-    ThemeType classType{ ThemeType::System };
-    VivyThemeType preferedColor{ VivyThemeType::Dark };
-
-    QString id;
-    QString fileName;
-    QString displayName;
-    QStringList preferredStyles;
-    QString defaultTextEditorColorScheme;
-    QVector<QPair<QColor, QString>> colors;
-    QVector<QString> imageFiles;
-    QVector<QGradientStops> gradients;
-    QVector<bool> flags;
-    QMap<QString, QColor> palette;
-};
-
-// If you copy QPalette, default values stay at default, even if that default is different
-// within the context of different widgets. Create deep copy.
-static QPalette
-copyPalette(const QPalette &p) noexcept
-{
-    QPalette res;
-    for (int group = 0; group < QPalette::NColorGroups; ++group) {
-        for (int role = 0; role < QPalette::NColorRoles; ++role) {
-            res.setBrush(QPalette::ColorGroup(group), QPalette::ColorRole(role),
-                         p.brush(QPalette::ColorGroup(group), QPalette::ColorRole(role)));
-        }
-    }
-    return res;
-}
-
-[[maybe_unused]] static bool
-systemUsesDarkMode() noexcept
-{
-    if (Utils::HostOsInfo::isWindowsHost()) {
-        constexpr char regkey[] =
-            "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize";
-        bool ok;
-        const auto setting =
-            QSettings(regkey, QSettings::NativeFormat).value("AppsUseLightTheme").toInt(&ok);
-        return ok && setting == 0;
-    }
-
-    else if constexpr (Utils::HostOsInfo::isMacHost())
-        return false;
-
-    else if constexpr (Utils::HostOsInfo::isLinuxHost())
-        return true;
-
-    return false;
-}
-
-static QPalette
-initialPalette() noexcept
-{
-    static QPalette palette = copyPalette(QApplication::palette());
-    return palette;
-}
-
-Theme::Private::Private() noexcept
-{
-    const QMetaObject &m = Theme::staticMetaObject;
-    colors.resize(m.enumerator(m.indexOfEnumerator("Color")).keyCount());
-    imageFiles.resize(m.enumerator(m.indexOfEnumerator("ImageFile")).keyCount());
-    gradients.resize(m.enumerator(m.indexOfEnumerator("Gradient")).keyCount());
-    flags.resize(m.enumerator(m.indexOfEnumerator("Flag")).keyCount());
-}
-
-void
-Theme::applyToApplication() const noexcept
-{
-    if (d->classType == ThemeType::QssFile) {
-        QFile stylesheet(d->fileName);
-        if (!stylesheet.exists()) {
-            qFatal("Missing stylesheet");
-        } else {
-            stylesheet.open(QFile::ReadOnly | QFile::Text);
-            QTextStream stylesheetStream(&stylesheet);
-            vivyApp->setStyleSheet(stylesheetStream.readAll());
-        }
-    }
-
-    else {
-#if VIVY_MACOS
-        // Match the native UI theme and palette with the creator
-        // theme by forcing light aqua for light creator themes.
-        if (!flag(Theme::DarkUserInterface))
-            Utils::forceMacOSLightAquaApperance();
-#endif
-        QApplication::setPalette(palette());
-    }
-}
-
-Theme::Theme(const QString &id, QObject *parent) noexcept
-    : QObject(parent)
-    , d(new Private)
-{
-    d->id = id;
-}
-
-Theme::~Theme() noexcept { delete d; }
-
-QStringList
-Theme::preferredStyles() const noexcept
-{
-    return d->preferredStyles;
-}
-
-QString
-Theme::defaultTextEditorColorScheme() const noexcept
-{
-    return d->defaultTextEditorColorScheme;
-}
-
-QString
-Theme::id() const noexcept
-{
-    return d->id;
-}
-
-bool
-Theme::flag(Theme::Flag f) const noexcept
-{
-    return d->flags[f];
-}
-
-QColor
-Theme::color(Theme::Color role) const noexcept
-{
-    return d->colors[role].first;
-}
-
-QString
-Theme::imageFile(Theme::ImageFile imageFile, const QString &fallBack) const noexcept
-{
-    const QString &file = d->imageFiles.at(imageFile);
-    return file.isEmpty() ? fallBack : file;
-}
-
-QGradientStops
-Theme::gradient(Theme::Gradient role) const noexcept
-{
-    return d->gradients[role];
-}
-
-QPair<QColor, QString>
-Theme::readNamedColor(const QString &color) const
-{
-    if (d->palette.contains(color))
-        return qMakePair(d->palette[color], color);
-    if (color == QLatin1String("style"))
-        return qMakePair(QColor(), QString());
-
-    const QColor col('#' + color);
-    if (!col.isValid()) {
-        logWarning() << "Color " << VIVY_LOG_QUOTED(qPrintable(color))
-                     << " is neither a named color nor a valid color";
-        return qMakePair(Qt::black, QString());
-    }
-    return qMakePair(col, QString());
-}
-
-QString
-Theme::filePath() const noexcept
-{
-    return d->fileName;
-}
-
-QString
-Theme::displayName() const noexcept
-{
-    return d->displayName;
-}
-
-void
-Theme::setDisplayName(const QString &name) noexcept
-{
-    d->displayName = name;
-}
-
-Theme *
-Theme::fromQssFile(const QString &id, const QString &file) noexcept
-{
-    Theme *ret        = new Theme(id);
-    ret->d->fileName  = file;
-    ret->d->classType = ThemeType::QssFile;
-    ret->setDisplayName(QFileInfo(file).baseName());
-    return ret;
-}
-
-Theme *
-Theme::fromSettings(const QString &id, QSettings *const settings) noexcept
-{
-    Theme *ret = new Theme(id);
-    ret->readSettings(settings);
-    return ret;
-}
-
-Theme *
-Theme::fromVivyTheme(const QString &id, const VivyThemeType which) noexcept
-{
-    Theme *ret = fromQssFile(id, which == VivyThemeType::Dark
-                                     ? QStringLiteral(":qdarkstyle/dark/style.qss")
-                                     : QStringLiteral(":qdarkstyle/light/style.qss"));
-    ret->setDisplayName(QStringLiteral("Vivy Theme"));
-    return ret;
-}
-
-const Theme::HighlightingTheme &
-Theme::getHighlightingTheme() const noexcept
-{
-    return highlightingTheme[Utils::toUnderlying(d->preferedColor)];
-}
-
-void
-Theme::readSettings(QSettings *const settings) noexcept
-{
-    d->fileName          = settings->fileName();
-    d->classType         = ThemeType::QtCreator;
-    const QMetaObject &m = *metaObject();
-
-    {
-        d->displayName =
-            settings->value(QLatin1String("ThemeName"), QLatin1String("unnamed")).toString();
-        d->preferredStyles = settings->value(QLatin1String("PreferredStyles")).toStringList();
-        d->preferredStyles.removeAll(QString());
-        d->defaultTextEditorColorScheme =
-            settings->value(QLatin1String("DefaultTextEditorColorScheme")).toString();
-    }
-    {
-        settings->beginGroup(QLatin1String("Palette"));
-        const QStringList allKeys = settings->allKeys();
-        for (const QString &key : allKeys)
-            d->palette[key] = readNamedColor(settings->value(key).toString()).first;
-        settings->endGroup();
-    }
-    {
-        settings->beginGroup(QLatin1String("Colors"));
-        QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color"));
-        for (int i = 0, total = e.keyCount(); i < total; ++i) {
-            const QString key = QLatin1String(e.key(i));
-            if (!settings->contains(key)) {
-                if (i < PaletteWindow || i > PalettePlaceholderTextDisabled)
-                    logWarning()
-                        << "Theme " << VIVY_LOG_QUOTED(qPrintable(d->fileName))
-                        << " misses color setting for key " << VIVY_LOG_QUOTED(qPrintable(key));
-                continue;
-            }
-            d->colors[i] = readNamedColor(settings->value(key).toString());
-        }
-        settings->endGroup();
-    }
-    {
-        settings->beginGroup(QLatin1String("ImageFiles"));
-        QMetaEnum e = m.enumerator(m.indexOfEnumerator("ImageFile"));
-        for (int i = 0, total = e.keyCount(); i < total; ++i) {
-            const QString key = QLatin1String(e.key(i));
-            d->imageFiles[i]  = settings->value(key).toString();
-        }
-        settings->endGroup();
-    }
-    {
-        settings->beginGroup(QLatin1String("Gradients"));
-        QMetaEnum e = m.enumerator(m.indexOfEnumerator("Gradient"));
-        for (int i = 0, total = e.keyCount(); i < total; ++i) {
-            const QString key = QLatin1String(e.key(i));
-            QGradientStops stops;
-            int size = settings->beginReadArray(key);
-            for (int j = 0; j < size; ++j) {
-                settings->setArrayIndex(j);
-                VIVY_ASSERT(settings->contains(QLatin1String("pos")));
-                VIVY_ASSERT(settings->contains(QLatin1String("color")));
-                const double pos = settings->value(QLatin1String("pos")).toDouble();
-                const QColor c('#' + settings->value(QLatin1String("color")).toString());
-                stops.append(qMakePair(pos, c));
-            }
-            settings->endArray();
-            d->gradients[i] = stops;
-        }
-        settings->endGroup();
-    }
-    {
-        settings->beginGroup(QLatin1String("Flags"));
-        QMetaEnum e = m.enumerator(m.indexOfEnumerator("Flag"));
-        for (int i = 0, total = e.keyCount(); i < total; ++i) {
-            const QString key = QLatin1String(e.key(i));
-            VIVY_ASSERT(settings->contains(key));
-            d->flags[i] = settings->value(key).toBool();
-        }
-        settings->endGroup();
-    }
-}
-
-QPalette
-Theme::palette() const noexcept
-{
-    QPalette pal = initialPalette();
-
-    const static struct {
-        Color themeColor;
-        QPalette::ColorRole paletteColorRole;
-        QPalette::ColorGroup paletteColorGroup;
-        bool setColorRoleAsBrush;
-    } mapping[] = {
-        { PaletteWindow, QPalette::Window, QPalette::All, false },
-        { PaletteWindowDisabled, QPalette::Window, QPalette::Disabled, false },
-        { PaletteWindowText, QPalette::WindowText, QPalette::All, true },
-        { PaletteWindowTextDisabled, QPalette::WindowText, QPalette::Disabled, true },
-        { PaletteBase, QPalette::Base, QPalette::All, false },
-        { PaletteBaseDisabled, QPalette::Base, QPalette::Disabled, false },
-        { PaletteAlternateBase, QPalette::AlternateBase, QPalette::All, false },
-        { PaletteAlternateBaseDisabled, QPalette::AlternateBase, QPalette::Disabled, false },
-        { PaletteToolTipBase, QPalette::ToolTipBase, QPalette::All, true },
-        { PaletteToolTipBaseDisabled, QPalette::ToolTipBase, QPalette::Disabled, true },
-        { PaletteToolTipText, QPalette::ToolTipText, QPalette::All, false },
-        { PaletteToolTipTextDisabled, QPalette::ToolTipText, QPalette::Disabled, false },
-        { PaletteText, QPalette::Text, QPalette::All, true },
-        { PaletteTextDisabled, QPalette::Text, QPalette::Disabled, true },
-        { PaletteButton, QPalette::Button, QPalette::All, false },
-        { PaletteButtonDisabled, QPalette::Button, QPalette::Disabled, false },
-        { PaletteButtonText, QPalette::ButtonText, QPalette::All, true },
-        { PaletteButtonTextDisabled, QPalette::ButtonText, QPalette::Disabled, true },
-        { PaletteBrightText, QPalette::BrightText, QPalette::All, false },
-        { PaletteBrightTextDisabled, QPalette::BrightText, QPalette::Disabled, false },
-        { PaletteHighlight, QPalette::Highlight, QPalette::All, true },
-        { PaletteHighlightDisabled, QPalette::Highlight, QPalette::Disabled, true },
-        { PaletteHighlightedText, QPalette::HighlightedText, QPalette::All, true },
-        { PaletteHighlightedTextDisabled, QPalette::HighlightedText, QPalette::Disabled, true },
-        { PaletteLink, QPalette::Link, QPalette::All, false },
-        { PaletteLinkDisabled, QPalette::Link, QPalette::Disabled, false },
-        { PaletteLinkVisited, QPalette::LinkVisited, QPalette::All, false },
-        { PaletteLinkVisitedDisabled, QPalette::LinkVisited, QPalette::Disabled, false },
-        { PaletteLight, QPalette::Light, QPalette::All, false },
-        { PaletteLightDisabled, QPalette::Light, QPalette::Disabled, false },
-        { PaletteMidlight, QPalette::Midlight, QPalette::All, false },
-        { PaletteMidlightDisabled, QPalette::Midlight, QPalette::Disabled, false },
-        { PaletteDark, QPalette::Dark, QPalette::All, false },
-        { PaletteDarkDisabled, QPalette::Dark, QPalette::Disabled, false },
-        { PaletteMid, QPalette::Mid, QPalette::All, false },
-        { PaletteMidDisabled, QPalette::Mid, QPalette::Disabled, false },
-        { PaletteShadow, QPalette::Shadow, QPalette::All, false },
-        { PaletteShadowDisabled, QPalette::Shadow, QPalette::Disabled, false },
-        { PalettePlaceholderText, QPalette::PlaceholderText, QPalette::All, false },
-        { PalettePlaceholderTextDisabled, QPalette::PlaceholderText, QPalette::Disabled, false },
-    };
-
-    for (auto entry : mapping) {
-        const QColor themeColor = color(entry.themeColor);
-        // Use original color if color is not defined in theme.
-        if (themeColor.isValid()) {
-            if (entry.setColorRoleAsBrush)
-                // TODO: Find out why sometimes setBrush is used
-                pal.setBrush(entry.paletteColorGroup, entry.paletteColorRole, themeColor);
-            else
-                pal.setColor(entry.paletteColorGroup, entry.paletteColorRole, themeColor);
-        }
-    }
-
-    return pal;
-}
-}
diff --git a/src/UI/Theme/Theme.hh b/src/UI/Theme/Theme.hh
deleted file mode 100644
index 5716ec2c..00000000
--- a/src/UI/Theme/Theme.hh
+++ /dev/null
@@ -1,503 +0,0 @@
-#pragma once
-
-#include "PreCompiledHeaders.hh"
-#include "VivyApplication.hh"
-#include "Lib/Utils.hh"
-#include "Lib/Log.hh"
-
-namespace Vivy
-{
-class Private;
-class Theme;
-
-class Theme final : public QObject {
-    Q_OBJECT
-    VIVY_APP_LOGGABLE_OBJECT(Theme, logger)
-
-public:
-    struct HighlightingTheme final {
-        const QBrush functionForeground;
-        const QBrush keywordForeground;
-        const QBrush valueForeground;
-        const QBrush commentForeground;
-        const QBrush memberForeground;
-        const QBrush enumForeground;
-    };
-
-private:
-    struct Private;
-
-    Theme(const QString &id, QObject *parent = nullptr) noexcept;
-    void readSettings(QSettings *const settings) noexcept;
-
-public:
-    ~Theme() noexcept override;
-
-    [[nodiscard("free")]] static Theme *fromQssFile(const QString &, const QString &) noexcept;
-    [[nodiscard("free")]] static Theme *fromSettings(const QString &, QSettings *const) noexcept;
-    [[nodiscard("free")]] static Theme *fromVivyTheme(const QString &,
-                                                      const VivyThemeType) noexcept;
-
-    void applyToApplication() const noexcept;
-    [[nodiscard]] const HighlightingTheme &getHighlightingTheme() const noexcept;
-
-    enum Color {
-        BackgroundColorAlternate,
-        BackgroundColorDark,
-        BackgroundColorHover,
-        BackgroundColorNormal,
-        BackgroundColorSelected,
-        BackgroundColorDisabled,
-        BadgeLabelBackgroundColorChecked,
-        BadgeLabelBackgroundColorUnchecked,
-        BadgeLabelTextColorChecked,
-        BadgeLabelTextColorUnchecked,
-        CanceledSearchTextColor,
-        ComboBoxArrowColor,
-        ComboBoxArrowColorDisabled,
-        ComboBoxTextColor,
-        DetailsButtonBackgroundColorHover,
-        DetailsWidgetBackgroundColor,
-        DockWidgetResizeHandleColor,
-        DoubleTabWidget1stSeparatorColor,
-        DoubleTabWidget1stTabActiveTextColor,
-        DoubleTabWidget1stTabBackgroundColor,
-        DoubleTabWidget1stTabInactiveTextColor,
-        DoubleTabWidget2ndSeparatorColor,
-        DoubleTabWidget2ndTabActiveTextColor,
-        DoubleTabWidget2ndTabBackgroundColor,
-        DoubleTabWidget2ndTabInactiveTextColor,
-        EditorPlaceholderColor,
-        FancyToolBarSeparatorColor,
-        FancyTabBarBackgroundColor,
-        FancyTabBarSelectedBackgroundColor,
-        FancyTabWidgetDisabledSelectedTextColor,
-        FancyTabWidgetDisabledUnselectedTextColor,
-        FancyTabWidgetEnabledSelectedTextColor,
-        FancyTabWidgetEnabledUnselectedTextColor,
-        FancyToolButtonHoverColor,
-        FancyToolButtonSelectedColor,
-        FutureProgressBackgroundColor,
-        InfoBarBackground,
-        InfoBarText, // TODO: Deprecate. Unused.
-        MenuBarEmptyAreaBackgroundColor,
-        MenuBarItemBackgroundColor,
-        MenuBarItemTextColorDisabled,
-        MenuBarItemTextColorNormal,
-        MenuItemTextColorDisabled,
-        MenuItemTextColorNormal,
-        MiniProjectTargetSelectorBackgroundColor, // TODO: Deprecate. -> Utils::StyleHelper().baseColor()
-        MiniProjectTargetSelectorBorderColor,
-        MiniProjectTargetSelectorSummaryBackgroundColor, // TODO: Deprecate. -> Utils::StyleHelper().baseColor()
-        MiniProjectTargetSelectorTextColor,
-        OutputPaneButtonFlashColor,
-        OutputPaneToggleButtonTextColorChecked,
-        OutputPaneToggleButtonTextColorUnchecked,
-        PanelStatusBarBackgroundColor,
-        PanelsWidgetSeparatorLineColor, // TODO: Deprecate. Unused.
-        PanelTextColorDark,
-        PanelTextColorMid,
-        PanelTextColorLight,
-        ProgressBarColorError,
-        ProgressBarColorFinished,
-        ProgressBarColorNormal,
-        ProgressBarTitleColor,
-        ProgressBarBackgroundColor,
-        SplitterColor,
-        TextColorDisabled,
-        TextColorError,
-        TextColorHighlight,
-        TextColorHighlightBackground,
-        TextColorLink,
-        TextColorLinkVisited,
-        TextColorNormal,
-        ToggleButtonBackgroundColor,
-        ToolBarBackgroundColor,
-        TreeViewArrowColorNormal,
-        TreeViewArrowColorSelected,
-
-        /* Palette for QPalette */
-
-        PaletteWindow,
-        PaletteWindowText,
-        PaletteBase,
-        PaletteAlternateBase,
-        PaletteToolTipBase,
-        PaletteToolTipText,
-        PaletteText,
-        PaletteButton,
-        PaletteButtonText,
-        PaletteBrightText,
-        PaletteHighlight,
-        PaletteHighlightedText,
-        PaletteLink,
-        PaletteLinkVisited,
-
-        PaletteLight,
-        PaletteMidlight,
-        PaletteDark,
-        PaletteMid,
-        PaletteShadow,
-
-        PaletteWindowDisabled,
-        PaletteWindowTextDisabled,
-        PaletteBaseDisabled,
-        PaletteAlternateBaseDisabled,
-        PaletteToolTipBaseDisabled,
-        PaletteToolTipTextDisabled,
-        PaletteTextDisabled,
-        PaletteButtonDisabled,
-        PaletteButtonTextDisabled,
-        PaletteBrightTextDisabled,
-        PaletteHighlightDisabled,
-        PaletteHighlightedTextDisabled,
-        PaletteLinkDisabled,
-        PaletteLinkVisitedDisabled,
-
-        PaletteLightDisabled,
-        PaletteMidlightDisabled,
-        PaletteDarkDisabled,
-        PaletteMidDisabled,
-        PaletteShadowDisabled,
-
-        PalettePlaceholderText,
-        PalettePlaceholderTextDisabled,
-
-        /* Icons */
-
-        IconsBaseColor,
-        IconsDisabledColor,
-        IconsInfoColor,
-        IconsInfoToolBarColor,
-        IconsWarningColor,
-        IconsWarningToolBarColor,
-        IconsErrorColor,
-        IconsErrorToolBarColor,
-        IconsRunColor,
-        IconsRunToolBarColor,
-        IconsStopColor,
-        IconsStopToolBarColor,
-        IconsInterruptColor,
-        IconsInterruptToolBarColor,
-        IconsDebugColor,
-        IconsNavigationArrowsColor,
-        IconsBuildHammerHandleColor,
-        IconsBuildHammerHeadColor,
-        IconsModeWelcomeActiveColor,
-        IconsModeEditActiveColor,
-        IconsModeDesignActiveColor,
-        IconsModeDebugActiveColor,
-        IconsModeProjectActiveColor,
-        IconsModeAnalyzeActiveColor,
-        IconsModeHelpActiveColor,
-
-        /* Code model Icons */
-
-        IconsCodeModelKeywordColor,
-        IconsCodeModelClassColor,
-        IconsCodeModelStructColor,
-        IconsCodeModelFunctionColor,
-        IconsCodeModelVariableColor,
-        IconsCodeModelEnumColor,
-        IconsCodeModelMacroColor,
-        IconsCodeModelAttributeColor,
-        IconsCodeModelUniformColor,
-        IconsCodeModelVaryingColor,
-        IconsCodeModelOverlayBackgroundColor,
-        IconsCodeModelOverlayForegroundColor,
-
-        /* Code model text marks */
-
-        CodeModel_Error_TextMarkColor,
-        CodeModel_Warning_TextMarkColor,
-
-        /* Output panes */
-
-        OutputPanes_DebugTextColor,
-        OutputPanes_ErrorMessageTextColor,
-        OutputPanes_MessageOutput,
-        OutputPanes_NormalMessageTextColor,
-        OutputPanes_StdErrTextColor,
-        OutputPanes_StdOutTextColor,
-        OutputPanes_WarningMessageTextColor,
-        OutputPanes_TestPassTextColor,
-        OutputPanes_TestFailTextColor,
-        OutputPanes_TestXFailTextColor,
-        OutputPanes_TestXPassTextColor,
-        OutputPanes_TestSkipTextColor,
-        OutputPanes_TestWarnTextColor,
-        OutputPanes_TestFatalTextColor,
-        OutputPanes_TestDebugTextColor,
-
-        /* Debugger Log Window */
-
-        Debugger_LogWindow_LogInput,
-        Debugger_LogWindow_LogStatus,
-        Debugger_LogWindow_LogTime,
-
-        /* Debugger Watch Item */
-
-        Debugger_WatchItem_ValueNormal,
-        Debugger_WatchItem_ValueInvalid,
-        Debugger_WatchItem_ValueChanged,
-
-        /* Welcome Plugin */
-
-        Welcome_TextColor,
-        Welcome_ForegroundPrimaryColor,
-        Welcome_ForegroundSecondaryColor,
-        Welcome_BackgroundColor,
-        Welcome_ButtonBackgroundColor,
-        Welcome_DividerColor,
-        Welcome_LinkColor,
-        Welcome_HoverColor,
-        Welcome_DisabledLinkColor,
-
-        /* Timeline Library */
-        Timeline_TextColor,
-        Timeline_BackgroundColor1,
-        Timeline_BackgroundColor2,
-        Timeline_DividerColor,
-        Timeline_HighlightColor,
-        Timeline_PanelBackgroundColor,
-        Timeline_PanelHeaderColor,
-        Timeline_HandleColor,
-        Timeline_RangeColor,
-
-        /* VcsBase Plugin */
-        VcsBase_FileStatusUnknown_TextColor,
-        VcsBase_FileAdded_TextColor,
-        VcsBase_FileModified_TextColor,
-        VcsBase_FileDeleted_TextColor,
-        VcsBase_FileRenamed_TextColor,
-        VcsBase_FileUnmerged_TextColor,
-
-        /* Bookmarks Plugin */
-        Bookmarks_TextMarkColor,
-
-        /* TextEditor Plugin */
-        TextEditor_SearchResult_ScrollBarColor,
-        TextEditor_CurrentLine_ScrollBarColor,
-
-        /* Debugger Plugin */
-        Debugger_Breakpoint_TextMarkColor,
-
-        /* ProjectExplorer Plugin */
-        ProjectExplorer_TaskError_TextMarkColor,
-        ProjectExplorer_TaskWarn_TextMarkColor,
-
-        /* QmlDesigner Plugin */
-        QmlDesigner_BackgroundColor,
-        QmlDesigner_HighlightColor,
-        QmlDesigner_FormEditorSelectionColor,
-        QmlDesigner_FormEditorForegroundColor,
-        QmlDesigner_BackgroundColorDarker,
-        QmlDesigner_BackgroundColorDarkAlternate,
-        QmlDesigner_TabLight,
-        QmlDesigner_TabDark,
-        QmlDesigner_ButtonColor,
-        QmlDesigner_BorderColor,
-        QmlDesigner_FormeditorBackgroundColor,
-        QmlDesigner_AlternateBackgroundColor,
-        QmlDesigner_ScrollBarHandleColor,
-
-        /* Palette for DS Controls */
-
-        DSpanelBackground,
-        DSinteraction,
-        DSerrorColor,
-        DSdisabledColor,
-        DScontrolBackground,
-        DScontrolBackgroundInteraction,
-        DScontrolBackgroundDisabled,
-        DScontrolBackgroundGlobalHover,
-        DScontrolBackgroundHover,
-        DScontrolOutline,
-        DScontrolOutlineInteraction,
-        DScontrolOutlineDisabled,
-        DStextColor,
-        DStextColorDisabled,
-        DStextSelectionColor,
-        DStextSelectedTextColor,
-
-        DSplaceholderTextColor,
-        DSplaceholderTextColorInteraction,
-
-        DSiconColor,
-        DSiconColorHover,
-        DSiconColorInteraction,
-        DSiconColorDisabled,
-        DSiconColorSelected,
-        DSlinkIndicatorColor,
-        DSlinkIndicatorColorHover,
-        DSlinkIndicatorColorInteraction,
-        DSlinkIndicatorColorDisabled,
-        DSpopupBackground,
-        DSpopupOverlayColor,
-        DSsliderActiveTrack,
-        DSsliderActiveTrackHover,
-        DSsliderActiveTrackFocus,
-        DSsliderInactiveTrack,
-        DSsliderInactiveTrackHover,
-        DSsliderInactiveTrackFocus,
-        DSsliderHandle,
-        DSsliderHandleHover,
-        DSsliderHandleFocus,
-        DSsliderHandleInteraction,
-        DSscrollBarTrack,
-        DSscrollBarHandle,
-        DSsectionHeadBackground,
-        DSstateDefaultHighlight,
-        DSstateSeparatorColor,
-        DSstateBackgroundColor,
-        DSstatePreviewOutline,
-        DSchangedStateText,
-        DS3DAxisXColor,
-        DS3DAxisYColor,
-        DS3DAxisZColor,
-        DSactionBinding,
-        DSactionAlias,
-        DSactionKeyframe,
-        DSactionJIT,
-
-        DStableHeaderBackground,
-        DStableHeaderText,
-
-        DSdockContainerBackground,
-        DSdockContainerSplitter,
-        DSdockAreaBackground,
-
-        DSdockWidgetBackground,
-        DSdockWidgetSplitter,
-        DSdockWidgetTitleBar,
-
-        DStitleBarText,
-        DStitleBarIcon,
-        DStitleBarButtonHover,
-        DStitleBarButtonPress,
-
-        DStabContainerBackground,
-        DStabSplitter,
-
-        DStabInactiveBackground,
-        DStabInactiveText,
-        DStabInactiveIcon,
-        DStabInactiveButtonHover,
-        DStabInactiveButtonPress,
-
-        DStabActiveBackground,
-        DStabActiveText,
-        DStabActiveIcon,
-        DStabActiveButtonHover,
-        DStabActiveButtonPress,
-
-        DStabFocusBackground,
-        DStabFocusText,
-        DStabFocusIcon,
-        DStabFocusButtonHover,
-        DStabFocusButtonPress,
-
-        DSnavigatorBranch,
-        DSnavigatorBranchIndicator,
-        DSnavigatorItemBackground,
-        DSnavigatorItemBackgroundHover,
-        DSnavigatorItemBackgroundSelected,
-        DSnavigatorText,
-        DSnavigatorTextHover,
-        DSnavigatorTextSelected,
-        DSnavigatorIcon,
-        DSnavigatorIconHover,
-        DSnavigatorIconSelected,
-        DSnavigatorAliasIconChecked,
-        DSnavigatorDropIndicatorBackground,
-        DSnavigatorDropIndicatorOutline,
-
-        DSheaderViewBackground,
-        DStableViewAlternateBackground,
-
-        DStoolTipBackground,
-        DStoolTipOutline,
-        DStoolTipText,
-
-        DSUnimportedModuleColor
-    };
-
-    enum Gradient {
-        DetailsWidgetHeaderGradient,
-    };
-
-    enum ImageFile {
-        IconOverlayCSource,
-        IconOverlayCppHeader,
-        IconOverlayCppSource,
-        IconOverlayPri,
-        IconOverlayPrf,
-        IconOverlayPro,
-        StandardPixmapFileIcon,
-        StandardPixmapDirIcon
-    };
-
-    enum Flag {
-        DrawTargetSelectorBottom,
-        DrawSearchResultWidgetFrame,
-        DrawIndicatorBranch,
-        DrawToolBarHighlights,
-        DrawToolBarBorders,
-        ComboBoxDrawTextShadow,
-        DerivePaletteFromTheme,
-        ApplyThemePaletteGlobally,
-        FlatToolBars,
-        FlatSideBarIcons,
-        FlatProjectsMode,
-        FlatMenuBar,
-        ToolBarIconShadow,
-        WindowColorAsBase,
-        DarkUserInterface
-    };
-
-    Q_ENUM(Color)
-    Q_ENUM(ImageFile)
-    Q_ENUM(Gradient)
-    Q_ENUM(Flag)
-
-    Q_INVOKABLE bool flag(Flag f) const noexcept;
-    Q_INVOKABLE QColor color(Color role) const noexcept;
-    QString imageFile(ImageFile imageFile, const QString &fallBack) const noexcept;
-    QGradientStops gradient(Gradient role) const noexcept;
-    QPalette palette() const noexcept;
-    QStringList preferredStyles() const noexcept;
-    QString defaultTextEditorColorScheme() const noexcept;
-
-    QString id() const noexcept;
-    QString filePath() const noexcept;
-    QString displayName() const noexcept;
-    void setDisplayName(const QString &displayName) noexcept;
-
-private:
-    QPair<QColor, QString> readNamedColor(const QString &color) const;
-    Private *const d;
-
-    const Theme::HighlightingTheme darkHighlightingTheme = {
-        .functionForeground = Qt::darkCyan,
-        .keywordForeground  = Qt::darkYellow,
-        .valueForeground    = QColor(Qt::cyan).darker(120),
-        .commentForeground  = QColor(Qt::darkGray).darker(120),
-        .memberForeground   = QColor(Qt::darkGray).lighter(160),
-        .enumForeground     = QColor(Qt::magenta).darker(170),
-    };
-
-    const Theme::HighlightingTheme lightHighlightingTheme = {
-        .functionForeground = Qt::blue,
-        .keywordForeground  = Qt::darkBlue,
-        .valueForeground    = Qt::red,
-        .commentForeground  = QColor(Qt::darkGray).darker(120),
-        .memberForeground   = QColor(Qt::darkGray).lighter(120),
-        .enumForeground     = Qt::darkMagenta,
-    };
-
-    const Theme::HighlightingTheme highlightingTheme[Utils::toUnderlying(VivyThemeType::___COUNT)] = {
-        darkHighlightingTheme,
-        lightHighlightingTheme,
-    };
-};
-}
diff --git a/src/UI/Theme/ThemeMac.hh b/src/UI/Theme/ThemeMac.hh
deleted file mode 100644
index 93d1e0ea..00000000
--- a/src/UI/Theme/ThemeMac.hh
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-namespace Vivy::Utils
-{
-void forceMacOSLightAquaApperance();
-}
diff --git a/src/UI/Theme/ThemeMac.mm b/src/UI/Theme/ThemeMac.mm
deleted file mode 100644
index 9b2d3d6f..00000000
--- a/src/UI/Theme/ThemeMac.mm
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "ThemeMac.hh"
-#include <AppKit/AppKit.h>
-
-#if !QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_14)
-@interface NSApplication (MojaveForwardDeclarations)
-@property (strong) NSAppearance *appearance NS_AVAILABLE_MAC(10_14);
-@end
-#endif
-
-namespace Vivy::Utils {
-void forceMacOSLightAquaApperance()
-{
-#if __has_builtin(__builtin_available)
-    if (__builtin_available(macOS 10.14, *))
-#else // Xcode 8
-    if (QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::MacOS, 10, 14, 0))
-#endif
-        NSApp.appearance = [NSAppearance appearanceNamed:NSAppearanceNameAqua];
-}
-
-}
diff --git a/src/VivyApplication.cc b/src/VivyApplication.cc
index 6d6cd9d0..ad671152 100644
--- a/src/VivyApplication.cc
+++ b/src/VivyApplication.cc
@@ -3,7 +3,6 @@
 #include "UI/MainWindow.hh"
 #include "UI/DockWidgetTitleBar.hh"
 #include "UI/LogConsole.hh"
-#include "UI/Theme/Theme.hh"
 #include "Lib/Document/VivyDocumentStore.hh"
 #include "Lib/Document/VivyDocument.hh"
 #include "Lib/Script/ScriptStore.hh"
@@ -42,28 +41,6 @@ VivyApplication::VivyApplication(int &argc, char **argv)
 
 VivyApplication::~VivyApplication() noexcept {}
 
-void
-VivyApplication::setTheme(ThemeType theme, VivyThemeType preferedColor) noexcept
-{
-    if (theme == ThemeType::System) {
-        return;
-    }
-
-    else if (theme == ThemeType::QtCreator) {
-        QSettings settings(QStringLiteral(":theme/design.creatortheme"), QSettings::IniFormat);
-        qtCreatorThemePtr.reset(Vivy::Theme::fromSettings("QtCreator", &settings));
-        qtCreatorThemePtr->applyToApplication();
-        return;
-    }
-
-    if (theme != ThemeType::QssFile) {
-        qFatal("Unknown Theme type");
-    }
-
-    qtCreatorThemePtr.reset(Vivy::Theme::fromVivyTheme("VivyTheme", preferedColor));
-    qtCreatorThemePtr->applyToApplication();
-}
-
 int
 VivyApplication::exec() noexcept
 {
@@ -82,9 +59,6 @@ VivyApplication::exec() noexcept
     setAttribute(Qt::AA_DontShowIconsInMenus, false);
     setAttribute(Qt::AA_DontShowShortcutsInContextMenus, false);
     setFont(getApplicationFont(Font::Default));
-    setTheme(ThemeType::QtCreator, VivyThemeType::Dark);
-
-    // Cursor blinking
     setCursorFlashTime(0);
 
     // Show the main window, also set up the log console
@@ -144,15 +118,3 @@ VivyApplication::getCurrentDocument() const
         throw std::logic_error("No main window in the graphic VivyApplication");
     return mainWindowPtr.get()->getCurrentDocument();
 }
-
-bool
-VivyApplication::getUseFakeVimEditor() const noexcept
-{
-    return useFakeVim;
-}
-
-void
-VivyApplication::setUseFakeVimEditor(bool ok) noexcept
-{
-    useFakeVim = ok;
-}
diff --git a/src/VivyApplication.hh b/src/VivyApplication.hh
index 75b1f1d1..ef8408ba 100644
--- a/src/VivyApplication.hh
+++ b/src/VivyApplication.hh
@@ -56,7 +56,6 @@ class VivyDocumentStore;
 class AbstractDocument;
 class ScriptDocument;
 class VivyDocument;
-class Theme;
 
 // Vivy application class
 class VivyApplication : public QApplication {
@@ -88,9 +87,7 @@ private:
     int fontIdBold;
     int fontIdBoldItalic;
 
-    std::unique_ptr<Vivy::Theme> qtCreatorThemePtr{ nullptr };
     std::unique_ptr<MainWindow> mainWindowPtr{ nullptr };
-    bool useFakeVim{ false };
 
     // ApplicationType::CLI Only!
     std::shared_ptr<ScriptDocument> selectedScriptDoc{ nullptr };
@@ -105,12 +102,7 @@ public:
     [[nodiscard]] QFont getApplicationFont(Font) const noexcept;
     [[nodiscard]] MainWindow *getMainWindow() const;
     [[nodiscard]] AbstractDocument *getCurrentDocument() const;
-    [[nodiscard]] bool getUseFakeVimEditor() const noexcept;
-    [[nodiscard]] const Theme *getTheme() const noexcept { return qtCreatorThemePtr.get(); }
     [[nodiscard]] std::shared_ptr<LogSink> getLogSink() noexcept { return logSink; }
-
-    void setUseFakeVimEditor(bool) noexcept;
-    void setTheme(ThemeType, VivyThemeType) noexcept;
 };
 
 }
-- 
GitLab