yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
theme_manager.h
Go to the documentation of this file.
1#ifndef YAZE_APP_GUI_THEME_MANAGER_H
2#define YAZE_APP_GUI_THEME_MANAGER_H
3
4#include <map>
5#include <string>
6#include <vector>
7
8#include "absl/status/status.h"
9#include "absl/status/statusor.h"
10#include "app/gui/color.h"
11#include "imgui/imgui.h"
12
13namespace yaze {
14namespace gui {
15
21 std::string name;
22 std::string description;
23 std::string author;
24
25 // Primary colors
35
36 // Text colors
40
41 // Window colors
46
47 // Interactive elements
54
55 // Navigation and selection
66
67 // Borders and separators
73
74 // Scrollbars and controls
79
80 // Special elements
86
87 // Complete ImGui color support
109
110 // Additional ImGui colors for complete coverage
117
118 // Enhanced theme system - semantic colors
119 Color text_highlight; // For selected text, highlighted items
120 Color link_hover; // For hover state of links
121 Color code_background; // For code blocks, monospace text backgrounds
122 Color success_light; // Lighter variant of success color
123 Color warning_light; // Lighter variant of warning color
124 Color error_light; // Lighter variant of error color
125 Color info_light; // Lighter variant of info color
126
127 // UI state colors
128 Color active_selection; // For active/selected UI elements
129 Color hover_highlight; // General hover state
130 Color focus_border; // For focused input elements
131 Color disabled_overlay; // Semi-transparent overlay for disabled elements
132
133 // Editor-specific colors
134 Color editor_background; // Main editor canvas background
135 Color editor_grid; // Grid lines in editors
136 Color editor_cursor; // Cursor/selection in editors
137 Color editor_selection; // Selected area in editors
138
144
145 // Style parameters
146 float window_rounding = 0.0f;
147 float frame_rounding = 5.0f;
148 float scrollbar_rounding = 5.0f;
149 float grab_rounding = 3.0f;
150 float tab_rounding = 0.0f;
151 float window_border_size = 0.0f;
152 float frame_border_size = 0.0f;
153
154 // Animation and effects
155 bool enable_animations = true;
156 float animation_speed = 1.0f;
158
159 // Helper methods
160 void ApplyToImGui() const;
161};
162
168public:
169 static ThemeManager& Get();
170
171 // Theme management
172 absl::Status LoadTheme(const std::string& theme_name);
173 absl::Status SaveTheme(const EnhancedTheme& theme, const std::string& filename);
174 absl::Status LoadThemeFromFile(const std::string& filepath);
175 absl::Status SaveThemeToFile(const EnhancedTheme& theme, const std::string& filepath) const;
176
177 // Dynamic theme discovery - replaces hardcoded theme lists with automatic discovery
178 // This works across development builds, macOS app bundles, and other deployment scenarios
179 std::vector<std::string> DiscoverAvailableThemeFiles() const;
180 absl::Status LoadAllAvailableThemes();
181 absl::Status RefreshAvailableThemes(); // Public method to refresh at runtime
182
183 // Built-in themes
185 std::vector<std::string> GetAvailableThemes() const;
186 const EnhancedTheme* GetTheme(const std::string& name) const;
188 const std::string& GetCurrentThemeName() const { return current_theme_name_; }
189
190 // Theme application
191 void ApplyTheme(const std::string& theme_name);
192 void ApplyTheme(const EnhancedTheme& theme);
193 void ApplyClassicYazeTheme(); // Apply original ColorsYaze() function
194
195 // Theme creation and editing
196 EnhancedTheme CreateCustomTheme(const std::string& name);
197 void ShowThemeEditor(bool* p_open);
198 void ShowThemeSelector(bool* p_open);
199 void ShowSimpleThemeEditor(bool* p_open);
200
201 // Integration with welcome screen
205
206private:
208
209 std::map<std::string, EnhancedTheme> themes_;
211 std::string current_theme_name_ = "Classic YAZE";
212
214 absl::Status ParseThemeFile(const std::string& content, EnhancedTheme& theme);
215 Color ParseColorFromString(const std::string& color_str) const;
216 std::string SerializeTheme(const EnhancedTheme& theme) const;
217
218 // Helper methods for path resolution
219 std::vector<std::string> GetThemeSearchPaths() const;
220 std::string GetThemesDirectory() const;
221 std::string GetCurrentThemeFilePath() const;
222};
223
224} // namespace gui
225} // namespace yaze
226
227#endif // YAZE_APP_GUI_THEME_MANAGER_H
Manages themes, loading, saving, and switching.
Color ParseColorFromString(const std::string &color_str) const
const EnhancedTheme * GetTheme(const std::string &name) const
absl::Status ParseThemeFile(const std::string &content, EnhancedTheme &theme)
void ShowThemeEditor(bool *p_open)
Color GetWelcomeScreenBackground() const
std::string GetCurrentThemeFilePath() const
EnhancedTheme current_theme_
absl::Status LoadTheme(const std::string &theme_name)
absl::Status LoadThemeFromFile(const std::string &filepath)
void ApplyTheme(const std::string &theme_name)
std::string GetThemesDirectory() const
std::string current_theme_name_
Color GetWelcomeScreenAccent() const
absl::Status SaveTheme(const EnhancedTheme &theme, const std::string &filename)
std::vector< std::string > DiscoverAvailableThemeFiles() const
absl::Status LoadAllAvailableThemes()
EnhancedTheme CreateCustomTheme(const std::string &name)
std::vector< std::string > GetThemeSearchPaths() const
std::string SerializeTheme(const EnhancedTheme &theme) const
static ThemeManager & Get()
absl::Status SaveThemeToFile(const EnhancedTheme &theme, const std::string &filepath) const
const std::string & GetCurrentThemeName() const
void ShowThemeSelector(bool *p_open)
absl::Status RefreshAvailableThemes()
const EnhancedTheme & GetCurrentTheme() const
Color GetWelcomeScreenBorder() const
void ShowSimpleThemeEditor(bool *p_open)
std::vector< std::string > GetAvailableThemes() const
std::map< std::string, EnhancedTheme > themes_
Main namespace for the application.
Comprehensive theme structure for YAZE.