window_themes_embedded.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. This file is part of Telegram Desktop,
  3. the official desktop application for the Telegram messaging service.
  4. For license and copyright information please follow this link:
  5. https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
  6. */
  7. #pragma once
  8. namespace style {
  9. struct colorizer;
  10. } // namespace style
  11. namespace Window {
  12. namespace Theme {
  13. enum class EmbeddedType {
  14. DayBlue,
  15. Default,
  16. Night,
  17. NightGreen,
  18. };
  19. struct EmbeddedScheme {
  20. EmbeddedType type = EmbeddedType();
  21. QColor background;
  22. QColor sent;
  23. QColor received;
  24. QColor radiobuttonInactive;
  25. QColor radiobuttonActive;
  26. rpl::producer<QString> name;
  27. QString path;
  28. QColor accentColor;
  29. };
  30. class AccentColors final {
  31. public:
  32. [[nodiscard]] QByteArray serialize() const;
  33. bool setFromSerialized(const QByteArray &serialized);
  34. void set(EmbeddedType type, const QColor &value);
  35. void clear(EmbeddedType type);
  36. [[nodiscard]] std::optional<QColor> get(EmbeddedType type) const;
  37. private:
  38. base::flat_map<EmbeddedType, QColor> _data;
  39. };
  40. [[nodiscard]] style::colorizer ColorizerFrom(
  41. const EmbeddedScheme &scheme,
  42. const QColor &color);
  43. [[nodiscard]] style::colorizer ColorizerForTheme(const QString &absolutePath);
  44. void Colorize(
  45. EmbeddedScheme &scheme,
  46. const style::colorizer &colorizer);
  47. [[nodiscard]] std::vector<EmbeddedScheme> EmbeddedThemes();
  48. [[nodiscard]] std::vector<QColor> DefaultAccentColors(EmbeddedType type);
  49. [[nodiscard]] Fn<void(style::palette&)> PreparePaletteCallback(
  50. bool dark,
  51. std::optional<QColor> accent);
  52. [[nodiscard]] Fn<void(style::palette&)> PrepareCurrentPaletteCallback();
  53. } // namespace Theme
  54. } // namespace Window