diff --git a/KeyBorad/KeyBorad/APP/AppTheme.cpp b/KeyBorad/KeyBorad/APP/AppTheme.cpp index 97de382..2b35d1f 100644 --- a/KeyBorad/KeyBorad/APP/AppTheme.cpp +++ b/KeyBorad/KeyBorad/APP/AppTheme.cpp @@ -1,6 +1,86 @@ #include "APP/AppTheme.h" -App_Theme App_Theme_Default() +namespace APP { - return App_Theme(); + +namespace +{ + +QString App_Func_RgbText(const QColor& Color) +{ + return QStringLiteral("rgb(%1, %2, %3)") + .arg(Color.red()) + .arg(Color.green()) + .arg(Color.blue()); } + +} // namespace + +App_ThemePalette App_Theme_DefaultPalette() +{ + return App_ThemePalette(); +} + +QString App_Theme_BuildWindowStyleSheet() +{ + const App_ThemePalette Palette = App_Theme_DefaultPalette(); + + return QStringLiteral( + "QWidget {" + " background:%1;" + " color:%2;" + "}" + "QTabWidget::pane {" + " border:1px solid %3;" + " border-radius:12px;" + " background:%4;" + "}" + "QTabBar::tab {" + " background:%4;" + " color:%5;" + " padding:10px 16px;" + " margin-right:6px;" + " border:1px solid %3;" + " border-bottom:none;" + " border-top-left-radius:10px;" + " border-top-right-radius:10px;" + "}" + "QTabBar::tab:selected {" + " color:%2;" + " background:%1;" + "}" + ) + .arg(App_Func_RgbText(Palette.Window)) + .arg(App_Func_RgbText(Palette.TextPrimary)) + .arg(App_Func_RgbText(Palette.Border)) + .arg(App_Func_RgbText(Palette.Surface)) + .arg(App_Func_RgbText(Palette.TextMuted)); +} + +QString App_Theme_BuildCardStyleSheet() +{ + const App_ThemePalette Palette = App_Theme_DefaultPalette(); + + return QStringLiteral( + "QFrame {" + " background:%1;" + " border:1px solid %2;" + " border-radius:14px;" + "}" + "QLabel[role=\"title\"] {" + " color:%3;" + " font-size:20px;" + " font-weight:600;" + "}" + "QLabel[role=\"body\"] {" + " color:%4;" + " font-size:13px;" + "}" + ) + .arg(App_Func_RgbText(Palette.Surface)) + .arg(App_Func_RgbText(Palette.Border)) + .arg(App_Func_RgbText(Palette.TextPrimary)) + .arg(App_Func_RgbText(Palette.TextMuted)); +} + +} // namespace APP diff --git a/KeyBorad/KeyBorad/APP/AppTheme.h b/KeyBorad/KeyBorad/APP/AppTheme.h index f2c6c8f..21f8684 100644 --- a/KeyBorad/KeyBorad/APP/AppTheme.h +++ b/KeyBorad/KeyBorad/APP/AppTheme.h @@ -1,14 +1,24 @@ #pragma once -#include +#include +#include -struct App_Theme +namespace APP { - quint32 AccentRgb = 0x4CC9F0; - quint32 BackgroundRgb = 0x0F172A; - quint32 SurfaceRgb = 0x111827; - quint32 BorderRgb = 0x334155; - quint32 TextRgb = 0xE2E8F0; + +struct App_ThemePalette +{ + QColor Window = QColor(15, 23, 42); + QColor Surface = QColor(17, 24, 39); + QColor Border = QColor(51, 65, 85); + QColor TextPrimary = QColor(226, 232, 240); + QColor TextMuted = QColor(148, 163, 184); + QColor Accent = QColor(76, 201, 240); + QColor AccentSoft = QColor(34, 197, 94); }; -App_Theme App_Theme_Default(); +App_ThemePalette App_Theme_DefaultPalette(); +QString App_Theme_BuildWindowStyleSheet(); +QString App_Theme_BuildCardStyleSheet(); + +} // namespace APP