theme.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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 accentBr READ accentBr CONSTANT)
  36. Q_PROPERTY(QColor addColor READ addColor CONSTANT)
  37. Q_PROPERTY(QColor removeColor READ removeColor CONSTANT)
  38. Q_PROPERTY(QColor dangerBg READ dangerBg CONSTANT)
  39. Q_PROPERTY(QColor dangerBr READ dangerBr CONSTANT)
  40. Q_PROPERTY(QColor successBg READ successBg CONSTANT)
  41. Q_PROPERTY(QColor successBr READ successBr CONSTANT)
  42. Q_PROPERTY(QColor successText READ successText CONSTANT)
  43. Q_PROPERTY(QColor disabledBg READ disabledBg CONSTANT)
  44. Q_PROPERTY(QColor infoBg READ infoBg CONSTANT)
  45. Q_PROPERTY(QColor infoBr READ infoBr CONSTANT)
  46. Q_PROPERTY(QColor infoText READ infoText CONSTANT)
  47. Q_PROPERTY(QColor warningText READ warningText CONSTANT)
  48. Q_PROPERTY(int spacingTiny READ spacingTiny CONSTANT)
  49. Q_PROPERTY(int spacingSmall READ spacingSmall CONSTANT)
  50. Q_PROPERTY(int spacingMedium READ spacingMedium CONSTANT)
  51. Q_PROPERTY(int spacingLarge READ spacingLarge CONSTANT)
  52. Q_PROPERTY(int spacingXLarge READ spacingXLarge CONSTANT)
  53. Q_PROPERTY(int radiusSmall READ radiusSmall CONSTANT)
  54. Q_PROPERTY(int radiusMedium READ radiusMedium CONSTANT)
  55. Q_PROPERTY(int radiusLarge READ radiusLarge CONSTANT)
  56. Q_PROPERTY(int radiusPanel READ radiusPanel CONSTANT)
  57. Q_PROPERTY(int animFast READ animFast CONSTANT)
  58. Q_PROPERTY(int animNormal READ animNormal CONSTANT)
  59. Q_PROPERTY(int animSlow READ animSlow CONSTANT)
  60. Q_PROPERTY(int fontSizeTiny READ fontSizeTiny CONSTANT)
  61. Q_PROPERTY(int fontSizeSmall READ fontSizeSmall CONSTANT)
  62. Q_PROPERTY(int fontSizeMedium READ fontSizeMedium CONSTANT)
  63. Q_PROPERTY(int fontSizeLarge READ fontSizeLarge CONSTANT)
  64. Q_PROPERTY(int fontSizeTitle READ fontSizeTitle CONSTANT)
  65. Q_PROPERTY(int fontSizeHero READ fontSizeHero CONSTANT)
  66. Q_PROPERTY(QVariantList playerColors READ playerColors CONSTANT)
  67. Q_PROPERTY(QVariantList teamIcons READ teamIcons CONSTANT)
  68. Q_PROPERTY(QVariantList factions READ factions CONSTANT)
  69. Q_PROPERTY(QVariantMap unitIcons READ unitIcons CONSTANT)
  70. Q_PROPERTY(QVariantMap nationEmblems READ nationEmblems CONSTANT)
  71. public:
  72. static auto instance() -> Theme *;
  73. static auto create(QQmlEngine *engine, QJSEngine *scriptEngine) -> Theme *;
  74. [[nodiscard]] static auto bg() -> QColor { return {"#071018"}; }
  75. [[nodiscard]] static auto bgShade() -> QColor { return {"#061214"}; }
  76. [[nodiscard]] static auto dim() -> QColor { return {0, 0, 0, 115}; }
  77. [[nodiscard]] static auto panelBase() -> QColor { return {"#071018"}; }
  78. [[nodiscard]] static auto panelBr() -> QColor { return {"#0f2430"}; }
  79. [[nodiscard]] static auto panelBorder() -> QColor { return {"#0f2430"}; }
  80. [[nodiscard]] static auto cardBase() -> QColor { return {"#061214"}; }
  81. [[nodiscard]] static auto cardBaseA() -> QColor { return {"#061214AA"}; }
  82. [[nodiscard]] static auto cardBaseB() -> QColor { return {"#061214"}; }
  83. [[nodiscard]] static auto cardBorder() -> QColor { return {"#12323a"}; }
  84. [[nodiscard]] static auto hover() -> QColor { return {"#184c7a"}; }
  85. [[nodiscard]] static auto hoverBg() -> QColor { return {"#184c7a"}; }
  86. [[nodiscard]] static auto selected() -> QColor { return {"#1f8bf5"}; }
  87. [[nodiscard]] static auto selectedBg() -> QColor { return {"#1f8bf5"}; }
  88. [[nodiscard]] static auto selectedBr() -> QColor { return {"#1b74d1"}; }
  89. [[nodiscard]] static auto thumbBr() -> QColor { return {"#2A4E56"}; }
  90. [[nodiscard]] static auto border() -> QColor { return {"#0f2b34"}; }
  91. [[nodiscard]] static auto textMain() -> QColor { return {"#eaf6ff"}; }
  92. [[nodiscard]] static auto textBright() -> QColor { return {"#dff0ff"}; }
  93. [[nodiscard]] static auto textSub() -> QColor { return {"#86a7b6"}; }
  94. [[nodiscard]] static auto textSubLite() -> QColor { return {"#79a6b7"}; }
  95. [[nodiscard]] static auto textDim() -> QColor { return {"#4f6a75"}; }
  96. [[nodiscard]] static auto textHint() -> QColor { return {"#2a5e6e"}; }
  97. [[nodiscard]] static auto accent() -> QColor { return {"#9fd9ff"}; }
  98. [[nodiscard]] static auto accentBright() -> QColor { return {"#d0e8ff"}; }
  99. [[nodiscard]] static auto accentBr() -> QColor { return {"#7eb8db"}; }
  100. [[nodiscard]] static auto addColor() -> QColor { return {"#3A9CA8"}; }
  101. [[nodiscard]] static auto removeColor() -> QColor { return {"#D04040"}; }
  102. [[nodiscard]] static auto dangerBg() -> QColor { return {"#4a1e1e"}; }
  103. [[nodiscard]] static auto dangerBr() -> QColor { return {"#6b2d2d"}; }
  104. [[nodiscard]] static auto successBg() -> QColor { return {"#1e4a2c"}; }
  105. [[nodiscard]] static auto successBr() -> QColor { return {"#2d6b3f"}; }
  106. [[nodiscard]] static auto successText() -> QColor { return {"#8fdc9f"}; }
  107. [[nodiscard]] static auto disabledBg() -> QColor { return {"#1a2a32"}; }
  108. [[nodiscard]] static auto infoBg() -> QColor { return {"#1a3a5a"}; }
  109. [[nodiscard]] static auto infoBr() -> QColor { return {"#2a5a8a"}; }
  110. [[nodiscard]] static auto infoText() -> QColor { return {"#7ab8e8"}; }
  111. [[nodiscard]] static auto warningText() -> QColor { return {"#f5a623"}; }
  112. [[nodiscard]] static auto spacingTiny() -> int { return 4; }
  113. [[nodiscard]] static auto spacingSmall() -> int { return 8; }
  114. [[nodiscard]] static auto spacingMedium() -> int { return 12; }
  115. [[nodiscard]] static auto spacingLarge() -> int { return 16; }
  116. [[nodiscard]] static auto spacingXLarge() -> int { return 20; }
  117. [[nodiscard]] static auto radiusSmall() -> int { return 4; }
  118. [[nodiscard]] static auto radiusMedium() -> int { return 6; }
  119. [[nodiscard]] static auto radiusLarge() -> int { return 8; }
  120. [[nodiscard]] static auto radiusPanel() -> int { return 14; }
  121. [[nodiscard]] static auto animFast() -> int { return 120; }
  122. [[nodiscard]] static auto animNormal() -> int { return 160; }
  123. [[nodiscard]] static auto animSlow() -> int { return 200; }
  124. [[nodiscard]] static auto fontSizeTiny() -> int { return 11; }
  125. [[nodiscard]] static auto fontSizeSmall() -> int { return 12; }
  126. [[nodiscard]] static auto fontSizeMedium() -> int { return 14; }
  127. [[nodiscard]] static auto fontSizeLarge() -> int { return 16; }
  128. [[nodiscard]] static auto fontSizeTitle() -> int { return 18; }
  129. [[nodiscard]] static auto fontSizeHero() -> int { return 28; }
  130. [[nodiscard]] static auto playerColors() -> QVariantList;
  131. [[nodiscard]] static auto teamIcons() -> QVariantList;
  132. [[nodiscard]] static auto factions() -> QVariantList;
  133. [[nodiscard]] static auto unitIcons() -> QVariantMap;
  134. [[nodiscard]] static auto nationEmblems() -> QVariantMap;
  135. private:
  136. explicit Theme(QObject *parent = nullptr);
  137. static Theme *m_instance;
  138. };
  139. #endif