xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
theme_colors.h
Go to the documentation of this file.
1 #pragma once
5 #include "theme_base.h"
6 #include "known_themed_color.h"
7 #include <string>
8 #include <vector>
9 #include <xtd/delegate.h>
10 #include <xtd/drawing/color.h>
12 namespace xtd {
14  namespace forms {
15  class forms_export_ theme_colors final : public theme_base {
16  public:
17  using color_getter = xtd::delegate<xtd::drawing::color(xtd::forms::known_themed_color)>;
18 
19  theme_colors() = default;
20  theme_colors(const xtd::ustring& name, const color_getter& kown_themed_color_to_color) : theme_base(name), color_getter_(kown_themed_color_to_color) {}
21  theme_colors(const xtd::ustring& name, xtd::forms::theme_style theme_style, const color_getter& color_getter) : theme_base(name, theme_style), color_getter_(color_getter) {}
23  theme_colors(const theme_colors&) = default;
24  theme_colors& operator=(const theme_colors&) = default;
25  bool operator==(const theme_colors& value) const {return theme_base::operator==(value);}
26  bool operator!=(const theme_colors& value) const {return !operator==(value);}
28 
29  static const theme_colors empty;
30 
31  xtd::drawing::color accent() const {return from_known_themed_color(xtd::forms::known_themed_color::accent);}
32  xtd::drawing::color accent_text() const {return from_known_themed_color(xtd::forms::known_themed_color::accent_text);}
37  xtd::drawing::color button_face() const {return from_known_themed_color(xtd::forms::known_themed_color::button_face);}
40  xtd::drawing::color control() const {return from_known_themed_color(xtd::forms::known_themed_color::control);}
41  xtd::drawing::color control_dark() const {return from_known_themed_color(xtd::forms::known_themed_color::control_dark);}
45  xtd::drawing::color control_text() const {return from_known_themed_color(xtd::forms::known_themed_color::control_text);}
46  xtd::drawing::color desktop() const {return from_known_themed_color(xtd::forms::known_themed_color::desktop);}
49  xtd::drawing::color gray_text() const {return from_known_themed_color(xtd::forms::known_themed_color::gray_text);}
50  xtd::drawing::color highlight() const {return from_known_themed_color(xtd::forms::known_themed_color::highlight);}
52  xtd::drawing::color hot_track() const {return from_known_themed_color(xtd::forms::known_themed_color::hot_track);}
56  xtd::drawing::color info() const {return from_known_themed_color(xtd::forms::known_themed_color::info);}
57  xtd::drawing::color info_text() const {return from_known_themed_color(xtd::forms::known_themed_color::info_text);}
58  xtd::drawing::color menu() const {return from_known_themed_color(xtd::forms::known_themed_color::menu);}
59  xtd::drawing::color menu_bar() const {return from_known_themed_color(xtd::forms::known_themed_color::menu_bar);}
61  xtd::drawing::color menu_text() const {return from_known_themed_color(xtd::forms::known_themed_color::menu_text);}
62  xtd::drawing::color scroll_bar() const {return from_known_themed_color(xtd::forms::known_themed_color::scroll_bar);}
63  xtd::drawing::color text_box() const {return from_known_themed_color(xtd::forms::known_themed_color::text_box);}
65  xtd::drawing::color window() const {return from_known_themed_color(xtd::forms::known_themed_color::window);}
66  xtd::drawing::color window_frame() const {return from_known_themed_color(xtd::forms::known_themed_color::window_frame);}
67  xtd::drawing::color window_text() const {return from_known_themed_color(xtd::forms::known_themed_color::window_text);}
68 
69  xtd::drawing::color from_known_themed_color(xtd::forms::known_themed_color known_themed_color) const {return color_getter_(known_themed_color);}
70 
71  static theme_colors current_theme() {
72  if (current_theme_ == theme_colors::empty) current_theme_ = default_theme();
73  return current_theme_;
74  }
75  static void current_theme(const theme_colors& theme_color) {current_theme_ = theme_color;}
76  static void current_theme(const xtd::ustring& name) {current_theme(theme_from_name(name));}
77 
78  static theme_colors default_theme() {return theme_from_name(default_theme_name());}
79 
80  static theme_colors theme_from_name(const xtd::ustring& theme_color_name);
81 
82  private:
83  theme_colors(const xtd::ustring& name, xtd::forms::theme_style theme_style, const color_getter& color_getter, bool is_default) : theme_base(name, theme_style, is_default), color_getter_(color_getter) {}
84  color_getter color_getter_;
85  static theme_colors current_theme_;
86  };
87  }
88 }
The system-defined color of a menu&#39;s text.
The system-defined color of the text of a ToolTip.
Contains xtd::delegate delegate.
The system-defined color of the accent text color (macos specific. On other platform is same as highl...
The system-defined color of the text in the client area of a window.
The system-defined color of the background of selected items. This includes selected menu items as we...
The system-defined color of text in a 3-D element.
The system-defined highlight color of a 3-D element. The highlight color is applied to the parts of a...
The system-defined color that is the shadow color of a 3-D element. This color is applied to parts of...
The system-defined face color of a 3-D element.
The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more.
Definition: system_report.h:17
The system-defined color of the background of a menu bar.
The system-defined color of the accent color (macos specific. On other platform is same as menu_highl...
The system-defined color of the text of selected items.
The system-defined color of the text in the active window&#39;s title bar.
Represents text as a sequence of UTF-8 code units.
Definition: ustring.h:48
Definition: theme_colors.h:15
The system-defined color of the desktop.
The system-defined color of the lightest color in the color gradient of an inactive window&#39;s title ba...
The system-defined color that is the highlight color of a 3-D element. This color is applied to parts...
The system-defined color of the active window&#39;s border.
Represents an ARGB (alpha, red, green, blue) color.
Definition: color.h:39
The system-defined color of dimmed text. Items in a list that are disabled are displayed in dimmed te...
The CTRL modifier key.
The system-defined color that is the light color of a 3-D element. The light color is applied to part...
The system-defined color used to designate a hot-tracked item. Single-clicking a hot-tracked item exe...
Contains xtd::forms::known_themed_color enum class.
theme_style
Specifies the style of theme.
Definition: theme_style.h:16
The system-defined color of the background of a scroll bar.
The system-defined color of the accent color (macos specific. On other platform is same as window)...
known_themed_color
Specifies the known system colors.
Definition: known_themed_color.h:18
The system-defined color of a window frame.
Contains xtd::drawing::color class.
The system-defined color of the background of an inactive window&#39;s title bar.
The system-defined color of the background in the client area of a window.
The system-defined color of the lightest color in the color gradient of an active window&#39;s title bar...
The system-defined color of the text in an inactive window&#39;s title bar.
The system-defined color of the application workspace. The application workspace is the area in a mul...
Contains xtd::forms::theme_base class.
The system-defined color of the background of a ToolTip.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The system-defined shadow color of a 3-D element. The shadow color is applied to parts of a 3-D eleme...
Definition: theme_base.h:15
The system-defined color of a menu&#39;s background.
The system-defined color of the accent text color (macos specific. On other platform is same as windo...
The system-defined color that is the dark shadow color of a 3-D element. The dark shadow color is app...
The system-defined color of the background of the active window&#39;s title bar.
The system-defined color of an inactive window&#39;s border.
The system-defined color used to highlight menu items when the menu appears as a flat menu...
The system-defined face color of a 3-D element.