summaryrefslogtreecommitdiffstats
path: root/editor/themes/editor_theme_manager.h
diff options
context:
space:
mode:
authorYuri Sizov <yuris@humnom.net>2024-01-17 15:03:55 +0100
committerYuri Sizov <yuris@humnom.net>2024-01-17 15:16:53 +0100
commit45eedba1fa992d9ce8fe8e5624a4b8c93875207c (patch)
tree9a327c58264ebdf448079ddfaec117ef8a186b9d /editor/themes/editor_theme_manager.h
parent107f2961ccfac179af7682eb5f6e7ea91e80040c (diff)
downloadredot-engine-45eedba1fa992d9ce8fe8e5624a4b8c93875207c.tar.gz
Improve editor theme generation after the refactor
Diffstat (limited to 'editor/themes/editor_theme_manager.h')
-rw-r--r--editor/themes/editor_theme_manager.h36
1 files changed, 27 insertions, 9 deletions
diff --git a/editor/themes/editor_theme_manager.h b/editor/themes/editor_theme_manager.h
index 86188ec244..0b30a9c853 100644
--- a/editor/themes/editor_theme_manager.h
+++ b/editor/themes/editor_theme_manager.h
@@ -31,16 +31,25 @@
#ifndef EDITOR_THEME_MANAGER_H
#define EDITOR_THEME_MANAGER_H
+#include "editor/themes/editor_theme.h"
#include "scene/resources/style_box_flat.h"
-#include "scene/resources/theme.h"
class EditorThemeManager {
+ static int benchmark_run;
+
+ static String get_benchmark_key();
+
+ enum ColorMode {
+ AUTO_COLOR,
+ DARK_COLOR,
+ LIGHT_COLOR,
+ };
+
struct ThemeConfiguration {
// Basic properties.
String preset;
String spacing_preset;
- bool dark_theme = false;
Color base_color;
Color accent_color;
@@ -61,11 +70,14 @@ class EditorThemeManager {
bool increase_scrollbar_touch_area = false;
float gizmo_handle_scale = 1.0;
int color_picker_button_height = 28;
+ float subresource_hue_tint = 0.0;
float default_contrast = 1.0;
// Generated properties.
+ bool dark_theme = false;
+
int base_margin = 4;
int increased_margin = 4;
int separation_margin = 4;
@@ -127,22 +139,28 @@ class EditorThemeManager {
Ref<StyleBoxFlat> tree_panel_style;
Vector2 widget_margin;
+
+ uint32_t hash();
+ uint32_t hash_fonts();
+ uint32_t hash_icons();
};
- static Ref<Theme> _create_base_theme(const Ref<Theme> &p_old_theme = nullptr);
- static ThemeConfiguration _create_theme_config(const Ref<Theme> &p_theme);
+ static Ref<EditorTheme> _create_base_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
+ static ThemeConfiguration _create_theme_config(const Ref<EditorTheme> &p_theme);
- static void _create_shared_styles(const Ref<Theme> &p_theme, ThemeConfiguration &p_config);
- static void _populate_standard_styles(const Ref<Theme> &p_theme, ThemeConfiguration &p_config);
- static void _populate_editor_styles(const Ref<Theme> &p_theme, ThemeConfiguration &p_config);
+ static void _create_shared_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
+ static void _populate_standard_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
+ static void _populate_editor_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
static void _generate_text_editor_defaults(ThemeConfiguration &p_config);
- static void _populate_text_editor_styles(const Ref<Theme> &p_theme, ThemeConfiguration &p_config);
+ static void _populate_text_editor_styles(const Ref<EditorTheme> &p_theme, ThemeConfiguration &p_config);
public:
- static Ref<Theme> generate_theme(const Ref<Theme> &p_old_theme = nullptr);
+ static Ref<EditorTheme> generate_theme(const Ref<EditorTheme> &p_old_theme = nullptr);
static bool is_generated_theme_outdated();
+ static bool is_dark_theme();
+
static void initialize();
static void finalize();
};