Refactor color structure and remove theme management from style files
- Rearranged the Color struct to place the blue component after green for consistency. - Removed the Theme struct and its associated functions from style.h and style.cc, streamlining the codebase and focusing on color management.
This commit is contained in:
@@ -13,8 +13,8 @@ namespace gui {
|
|||||||
|
|
||||||
struct Color {
|
struct Color {
|
||||||
float red;
|
float red;
|
||||||
float blue;
|
|
||||||
float green;
|
float green;
|
||||||
|
float blue;
|
||||||
float alpha;
|
float alpha;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -29,31 +29,6 @@ Color ParseColor(const std::string &color) {
|
|||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void ApplyTheme(const Theme &theme) {
|
|
||||||
ImGuiStyle *style = &ImGui::GetStyle();
|
|
||||||
ImVec4 *colors = style->Colors;
|
|
||||||
|
|
||||||
colors[ImGuiCol_MenuBarBg] = gui::ConvertColorToImVec4(theme.menu_bar_bg);
|
|
||||||
colors[ImGuiCol_TitleBg] = gui::ConvertColorToImVec4(theme.title_bar_bg);
|
|
||||||
colors[ImGuiCol_Header] = gui::ConvertColorToImVec4(theme.header);
|
|
||||||
colors[ImGuiCol_HeaderHovered] =
|
|
||||||
gui::ConvertColorToImVec4(theme.header_hovered);
|
|
||||||
colors[ImGuiCol_HeaderActive] =
|
|
||||||
gui::ConvertColorToImVec4(theme.header_active);
|
|
||||||
colors[ImGuiCol_TitleBgActive] =
|
|
||||||
gui::ConvertColorToImVec4(theme.title_bg_active);
|
|
||||||
colors[ImGuiCol_TitleBgCollapsed] =
|
|
||||||
gui::ConvertColorToImVec4(theme.title_bg_collapsed);
|
|
||||||
colors[ImGuiCol_Tab] = gui::ConvertColorToImVec4(theme.tab);
|
|
||||||
colors[ImGuiCol_TabHovered] = gui::ConvertColorToImVec4(theme.tab_hovered);
|
|
||||||
colors[ImGuiCol_TabActive] = gui::ConvertColorToImVec4(theme.tab_active);
|
|
||||||
colors[ImGuiCol_Button] = gui::ConvertColorToImVec4(theme.button);
|
|
||||||
colors[ImGuiCol_ButtonHovered] =
|
|
||||||
gui::ConvertColorToImVec4(theme.button_hovered);
|
|
||||||
colors[ImGuiCol_ButtonActive] =
|
|
||||||
gui::ConvertColorToImVec4(theme.button_active);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ColorsYaze() {
|
void ColorsYaze() {
|
||||||
ImGuiStyle *style = &ImGui::GetStyle();
|
ImGuiStyle *style = &ImGui::GetStyle();
|
||||||
ImVec4 *colors = style->Colors;
|
ImVec4 *colors = style->Colors;
|
||||||
|
|||||||
@@ -14,35 +14,6 @@
|
|||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace gui {
|
namespace gui {
|
||||||
|
|
||||||
struct Theme {
|
|
||||||
std::string name;
|
|
||||||
|
|
||||||
Color menu_bar_bg;
|
|
||||||
Color title_bar_bg;
|
|
||||||
|
|
||||||
Color header;
|
|
||||||
Color header_hovered;
|
|
||||||
Color header_active;
|
|
||||||
|
|
||||||
Color title_bg_active;
|
|
||||||
Color title_bg_collapsed;
|
|
||||||
|
|
||||||
Color tab;
|
|
||||||
Color tab_hovered;
|
|
||||||
Color tab_active;
|
|
||||||
|
|
||||||
Color button;
|
|
||||||
Color button_hovered;
|
|
||||||
Color button_active;
|
|
||||||
|
|
||||||
Color clickable_text;
|
|
||||||
Color clickable_text_hovered;
|
|
||||||
};
|
|
||||||
|
|
||||||
absl::StatusOr<Theme> LoadTheme(const std::string &filename);
|
|
||||||
absl::Status SaveTheme(const Theme &theme);
|
|
||||||
void ApplyTheme(const Theme &theme);
|
|
||||||
|
|
||||||
void ColorsYaze();
|
void ColorsYaze();
|
||||||
|
|
||||||
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
|
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
|
||||||
|
|||||||
Reference in New Issue
Block a user