diff options
Diffstat (limited to 'editor/editor_themes.cpp')
-rw-r--r-- | editor/editor_themes.cpp | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 9e983839f9..edbd2dd62f 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -191,25 +191,6 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1, return style; } -static Ref<Texture2D> flip_icon(Ref<Texture2D> p_texture, bool p_flip_y = false, bool p_flip_x = false) { - if (!p_flip_y && !p_flip_x) { - return p_texture; - } - - Ref<Image> img = p_texture->get_image(); - ERR_FAIL_NULL_V(img, Ref<Texture2D>()); - img = img->duplicate(); - - if (p_flip_y) { - img->flip_y(); - } - if (p_flip_x) { - img->flip_x(); - } - - return ImageTexture::create_from_image(img); -} - #ifdef MODULE_SVG_ENABLED // See also `generate_icon()` in `scene/resources/default_theme.cpp`. static Ref<ImageTexture> editor_generate_icon(int p_index, float p_scale, float p_saturation, const HashMap<Color, Color> &p_convert_colors = HashMap<Color, Color>()) { @@ -447,6 +428,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { // Colors bool dark_theme = EditorSettings::get_singleton()->is_dark_theme(); +#ifdef MODULE_SVG_ENABLED + if (dark_theme) { + ImageLoaderSVG::set_forced_color_map(HashMap<Color, Color>()); + } else { + ImageLoaderSVG::set_forced_color_map(EditorColorMap::get()); + } +#endif + // Ensure base colors are in the 0..1 luminance range to avoid 8-bit integer overflow or text rendering issues. // Some places in the editor use 8-bit integer colors. const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast).clamp(); @@ -1559,14 +1548,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_stylebox("camera", "GraphEditMinimap", style_minimap_camera); theme->set_stylebox("node", "GraphEditMinimap", style_minimap_node); - Ref<Texture2D> minimap_resizer_icon = theme->get_icon(SNAME("GuiResizer"), SNAME("EditorIcons")); Color minimap_resizer_color; if (dark_theme) { minimap_resizer_color = Color(1, 1, 1, 0.65); } else { minimap_resizer_color = Color(0, 0, 0, 0.65); } - theme->set_icon("resizer", "GraphEditMinimap", flip_icon(minimap_resizer_icon, true, true)); + theme->set_icon("resizer", "GraphEditMinimap", theme->get_icon(SNAME("GuiResizerTopLeft"), SNAME("EditorIcons"))); theme->set_color("resizer_color", "GraphEditMinimap", minimap_resizer_color); // GraphNode |