theme.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #ifndef THEME_H
  2. #define THEME_H
  3. #include <QColor>
  4. #include <QObject>
  5. #include <QQmlEngine>
  6. #include <QVariantList>
  7. #include <QVariantMap>
  8. class Theme : public QObject {
  9. Q_OBJECT
  10. Q_PROPERTY(QColor bg READ bg CONSTANT)
  11. Q_PROPERTY(QColor bgShade READ bgShade CONSTANT)
  12. Q_PROPERTY(QColor dim READ dim CONSTANT)
  13. Q_PROPERTY(QColor panelBase READ panelBase CONSTANT)
  14. Q_PROPERTY(QColor panelBr READ panelBr CONSTANT)
  15. Q_PROPERTY(QColor panelBorder READ panelBorder CONSTANT)
  16. Q_PROPERTY(QColor cardBase READ cardBase CONSTANT)
  17. Q_PROPERTY(QColor cardBaseA READ cardBaseA CONSTANT)
  18. Q_PROPERTY(QColor cardBaseB READ cardBaseB CONSTANT)
  19. Q_PROPERTY(QColor cardBorder READ cardBorder CONSTANT)
  20. Q_PROPERTY(QColor hover READ hover CONSTANT)
  21. Q_PROPERTY(QColor hoverBg READ hoverBg CONSTANT)
  22. Q_PROPERTY(QColor selected READ selected CONSTANT)
  23. Q_PROPERTY(QColor selectedBg READ selectedBg CONSTANT)
  24. Q_PROPERTY(QColor selectedBr READ selectedBr CONSTANT)
  25. Q_PROPERTY(QColor thumbBr READ thumbBr CONSTANT)
  26. Q_PROPERTY(QColor border READ border CONSTANT)
  27. Q_PROPERTY(QColor textMain READ textMain CONSTANT)
  28. Q_PROPERTY(QColor textBright READ textBright CONSTANT)
  29. Q_PROPERTY(QColor textSub READ textSub CONSTANT)
  30. Q_PROPERTY(QColor textSubLite READ textSubLite CONSTANT)
  31. Q_PROPERTY(QColor textDim READ textDim CONSTANT)
  32. Q_PROPERTY(QColor textHint READ textHint CONSTANT)
  33. Q_PROPERTY(QColor accent READ accent CONSTANT)
  34. Q_PROPERTY(QColor accentBright READ accentBright CONSTANT)
  35. Q_PROPERTY(QColor addColor READ addColor CONSTANT)
  36. Q_PROPERTY(QColor removeColor READ removeColor CONSTANT)
  37. Q_PROPERTY(int spacingTiny READ spacingTiny CONSTANT)
  38. Q_PROPERTY(int spacingSmall READ spacingSmall CONSTANT)
  39. Q_PROPERTY(int spacingMedium READ spacingMedium CONSTANT)
  40. Q_PROPERTY(int spacingLarge READ spacingLarge CONSTANT)
  41. Q_PROPERTY(int spacingXLarge READ spacingXLarge CONSTANT)
  42. Q_PROPERTY(int radiusSmall READ radiusSmall CONSTANT)
  43. Q_PROPERTY(int radiusMedium READ radiusMedium CONSTANT)
  44. Q_PROPERTY(int radiusLarge READ radiusLarge CONSTANT)
  45. Q_PROPERTY(int radiusPanel READ radiusPanel CONSTANT)
  46. Q_PROPERTY(int animFast READ animFast CONSTANT)
  47. Q_PROPERTY(int animNormal READ animNormal CONSTANT)
  48. Q_PROPERTY(int animSlow READ animSlow CONSTANT)
  49. Q_PROPERTY(int fontSizeTiny READ fontSizeTiny CONSTANT)
  50. Q_PROPERTY(int fontSizeSmall READ fontSizeSmall CONSTANT)
  51. Q_PROPERTY(int fontSizeMedium READ fontSizeMedium CONSTANT)
  52. Q_PROPERTY(int fontSizeLarge READ fontSizeLarge CONSTANT)
  53. Q_PROPERTY(int fontSizeTitle READ fontSizeTitle CONSTANT)
  54. Q_PROPERTY(int fontSizeHero READ fontSizeHero CONSTANT)
  55. Q_PROPERTY(QVariantList playerColors READ playerColors CONSTANT)
  56. Q_PROPERTY(QVariantList teamIcons READ teamIcons CONSTANT)
  57. Q_PROPERTY(QVariantList factions READ factions CONSTANT)
  58. Q_PROPERTY(QVariantMap unitIcons READ unitIcons CONSTANT)
  59. public:
  60. static auto instance() -> Theme *;
  61. static auto create(QQmlEngine *engine, QJSEngine *scriptEngine) -> Theme *;
  62. [[nodiscard]] static auto bg() -> QColor { return {"#071018"}; }
  63. [[nodiscard]] static auto bgShade() -> QColor { return {"#061214"}; }
  64. [[nodiscard]] static auto dim() -> QColor { return {0, 0, 0, 115}; }
  65. [[nodiscard]] static auto panelBase() -> QColor { return {"#071018"}; }
  66. [[nodiscard]] static auto panelBr() -> QColor { return {"#0f2430"}; }
  67. [[nodiscard]] static auto panelBorder() -> QColor { return {"#0f2430"}; }
  68. [[nodiscard]] static auto cardBase() -> QColor { return {"#061214"}; }
  69. [[nodiscard]] static auto cardBaseA() -> QColor { return {"#061214AA"}; }
  70. [[nodiscard]] static auto cardBaseB() -> QColor { return {"#061214"}; }
  71. [[nodiscard]] static auto cardBorder() -> QColor { return {"#12323a"}; }
  72. [[nodiscard]] static auto hover() -> QColor { return {"#184c7a"}; }
  73. [[nodiscard]] static auto hoverBg() -> QColor { return {"#184c7a"}; }
  74. [[nodiscard]] static auto selected() -> QColor { return {"#1f8bf5"}; }
  75. [[nodiscard]] static auto selectedBg() -> QColor { return {"#1f8bf5"}; }
  76. [[nodiscard]] static auto selectedBr() -> QColor { return {"#1b74d1"}; }
  77. [[nodiscard]] static auto thumbBr() -> QColor { return {"#2A4E56"}; }
  78. [[nodiscard]] static auto border() -> QColor { return {"#0f2b34"}; }
  79. [[nodiscard]] static auto textMain() -> QColor { return {"#eaf6ff"}; }
  80. [[nodiscard]] static auto textBright() -> QColor { return {"#dff0ff"}; }
  81. [[nodiscard]] static auto textSub() -> QColor { return {"#86a7b6"}; }
  82. [[nodiscard]] static auto textSubLite() -> QColor { return {"#79a6b7"}; }
  83. [[nodiscard]] static auto textDim() -> QColor { return {"#4f6a75"}; }
  84. [[nodiscard]] static auto textHint() -> QColor { return {"#2a5e6e"}; }
  85. [[nodiscard]] static auto accent() -> QColor { return {"#9fd9ff"}; }
  86. [[nodiscard]] static auto accentBright() -> QColor { return {"#d0e8ff"}; }
  87. [[nodiscard]] static auto addColor() -> QColor { return {"#3A9CA8"}; }
  88. [[nodiscard]] static auto removeColor() -> QColor { return {"#D04040"}; }
  89. [[nodiscard]] static auto spacingTiny() -> int { return 4; }
  90. [[nodiscard]] static auto spacingSmall() -> int { return 8; }
  91. [[nodiscard]] static auto spacingMedium() -> int { return 12; }
  92. [[nodiscard]] static auto spacingLarge() -> int { return 16; }
  93. [[nodiscard]] static auto spacingXLarge() -> int { return 20; }
  94. [[nodiscard]] static auto radiusSmall() -> int { return 4; }
  95. [[nodiscard]] static auto radiusMedium() -> int { return 6; }
  96. [[nodiscard]] static auto radiusLarge() -> int { return 8; }
  97. [[nodiscard]] static auto radiusPanel() -> int { return 14; }
  98. [[nodiscard]] static auto animFast() -> int { return 120; }
  99. [[nodiscard]] static auto animNormal() -> int { return 160; }
  100. [[nodiscard]] static auto animSlow() -> int { return 200; }
  101. [[nodiscard]] static auto fontSizeTiny() -> int { return 11; }
  102. [[nodiscard]] static auto fontSizeSmall() -> int { return 12; }
  103. [[nodiscard]] static auto fontSizeMedium() -> int { return 14; }
  104. [[nodiscard]] static auto fontSizeLarge() -> int { return 16; }
  105. [[nodiscard]] static auto fontSizeTitle() -> int { return 18; }
  106. [[nodiscard]] static auto fontSizeHero() -> int { return 28; }
  107. [[nodiscard]] static auto playerColors() -> QVariantList;
  108. [[nodiscard]] static auto teamIcons() -> QVariantList;
  109. [[nodiscard]] static auto factions() -> QVariantList;
  110. [[nodiscard]] static auto unitIcons() -> QVariantMap;
  111. private:
  112. explicit Theme(QObject *parent = nullptr);
  113. static Theme *m_instance;
  114. };
  115. #endif