diff options
Diffstat (limited to 'editor/themes/editor_theme_manager.cpp')
-rw-r--r-- | editor/themes/editor_theme_manager.cpp | 102 |
1 files changed, 69 insertions, 33 deletions
diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index 6151cb4b74..ddacce6270 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -2036,36 +2036,6 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme // Editor inspector. { - // Sub-inspectors. - for (int i = 0; i < 16; i++) { - Color si_base_color = p_config.accent_color; - - float hue_rotate = (i * 2 % 16) / 16.0; - si_base_color.set_hsv(Math::fmod(float(si_base_color.get_h() + hue_rotate), float(1.0)), si_base_color.get_s(), si_base_color.get_v()); - si_base_color = p_config.accent_color.lerp(si_base_color, p_config.subresource_hue_tint); - - // Sub-inspector background. - Ref<StyleBoxFlat> sub_inspector_bg = p_config.base_style->duplicate(); - sub_inspector_bg->set_bg_color(p_config.dark_color_1.lerp(si_base_color, 0.08)); - sub_inspector_bg->set_border_width_all(2 * EDSCALE); - sub_inspector_bg->set_border_color(si_base_color * Color(0.7, 0.7, 0.7, 0.8)); - sub_inspector_bg->set_content_margin_all(4 * EDSCALE); - sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0); - sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0); - - p_theme->set_stylebox("sub_inspector_bg" + itos(i), EditorStringName(Editor), sub_inspector_bg); - - // EditorProperty background while it has a sub-inspector open. - Ref<StyleBoxFlat> bg_color = make_flat_stylebox(si_base_color * Color(0.7, 0.7, 0.7, 0.8), 0, 0, 0, 0, p_config.corner_radius); - bg_color->set_anti_aliased(false); - bg_color->set_corner_radius(CORNER_BOTTOM_LEFT, 0); - bg_color->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); - - p_theme->set_stylebox("sub_inspector_property_bg" + itos(i), EditorStringName(Editor), bg_color); - } - - p_theme->set_color("sub_inspector_property_color", EditorStringName(Editor), p_config.dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)); - // EditorProperty. Ref<StyleBoxFlat> style_property_bg = p_config.base_style->duplicate(); @@ -2125,13 +2095,79 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme p_theme->set_constant("inspector_margin", EditorStringName(Editor), 12 * EDSCALE); + // Colored EditorProperty. + for (int i = 0; i < 16; i++) { + Color si_base_color = p_config.accent_color; + + float hue_rotate = (i * 2 % 16) / 16.0; + si_base_color.set_hsv(Math::fmod(float(si_base_color.get_h() + hue_rotate), float(1.0)), si_base_color.get_s(), si_base_color.get_v()); + si_base_color = p_config.accent_color.lerp(si_base_color, p_config.subresource_hue_tint); + + // Sub-inspector background. + Ref<StyleBoxFlat> sub_inspector_bg = p_config.base_style->duplicate(); + sub_inspector_bg->set_bg_color(p_config.dark_color_1.lerp(si_base_color, 0.08)); + sub_inspector_bg->set_border_width_all(2 * EDSCALE); + sub_inspector_bg->set_border_color(si_base_color * Color(0.7, 0.7, 0.7, 0.8)); + sub_inspector_bg->set_content_margin_all(4 * EDSCALE); + sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0); + sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0); + + p_theme->set_stylebox("sub_inspector_bg" + itos(i + 1), EditorStringName(EditorStyles), sub_inspector_bg); + + // EditorProperty background while it has a sub-inspector open. + Ref<StyleBoxFlat> bg_color = make_flat_stylebox(si_base_color * Color(0.7, 0.7, 0.7, 0.8), 0, 0, 0, 0, p_config.corner_radius); + bg_color->set_anti_aliased(false); + bg_color->set_corner_radius(CORNER_BOTTOM_LEFT, 0); + bg_color->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); + + p_theme->set_stylebox("sub_inspector_property_bg" + itos(i + 1), EditorStringName(EditorStyles), bg_color); + + // Dictionary editor add item. + // Expand to the left and right by 4px to compensate for the dictionary editor margins. + + Color style_dictionary_bg_color = p_config.dark_color_3.lerp(si_base_color, 0.08); + Ref<StyleBoxFlat> style_dictionary_add_item = make_flat_stylebox(style_dictionary_bg_color, 0, 4, 0, 4, p_config.corner_radius); + style_dictionary_add_item->set_expand_margin(SIDE_LEFT, 2 * EDSCALE); + style_dictionary_add_item->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE); + p_theme->set_stylebox("DictionaryAddItem" + itos(i + 1), EditorStringName(EditorStyles), style_dictionary_add_item); + } + Color si_base_color = p_config.accent_color; + + // Sub-inspector background. + Ref<StyleBoxFlat> sub_inspector_bg = p_config.base_style->duplicate(); + sub_inspector_bg->set_bg_color(Color(1, 1, 1, 0)); + sub_inspector_bg->set_border_width_all(2 * EDSCALE); + sub_inspector_bg->set_border_color(p_config.dark_color_1.lerp(si_base_color, 0.15)); + sub_inspector_bg->set_content_margin_all(4 * EDSCALE); + sub_inspector_bg->set_corner_radius(CORNER_TOP_LEFT, 0); + sub_inspector_bg->set_corner_radius(CORNER_TOP_RIGHT, 0); + + p_theme->set_stylebox("sub_inspector_bg0", EditorStringName(EditorStyles), sub_inspector_bg); + + // Sub-inspector background no border. + + Ref<StyleBoxFlat> sub_inspector_bg_no_border = p_config.base_style->duplicate(); + sub_inspector_bg_no_border->set_content_margin_all(2 * EDSCALE); + sub_inspector_bg_no_border->set_bg_color(p_config.dark_color_2.lerp(p_config.dark_color_3, 0.15)); + p_theme->set_stylebox("sub_inspector_bg_no_border", EditorStringName(EditorStyles), sub_inspector_bg_no_border); + + // EditorProperty background while it has a sub-inspector open. + Ref<StyleBoxFlat> bg_color = make_flat_stylebox(p_config.dark_color_1.lerp(si_base_color, 0.15), 0, 0, 0, 0, p_config.corner_radius); + bg_color->set_anti_aliased(false); + bg_color->set_corner_radius(CORNER_BOTTOM_LEFT, 0); + bg_color->set_corner_radius(CORNER_BOTTOM_RIGHT, 0); + + p_theme->set_stylebox("sub_inspector_property_bg0", EditorStringName(EditorStyles), bg_color); + + p_theme->set_color("sub_inspector_property_color", EditorStringName(EditorStyles), p_config.dark_theme ? Color(1, 1, 1, 1) : Color(0, 0, 0, 1)); + // Dictionary editor. // Expand to the left and right by 4px to compensate for the dictionary editor margins. Ref<StyleBoxFlat> style_dictionary_add_item = make_flat_stylebox(prop_subsection_color, 0, 4, 0, 4, p_config.corner_radius); - style_dictionary_add_item->set_expand_margin(SIDE_LEFT, 4 * EDSCALE); - style_dictionary_add_item->set_expand_margin(SIDE_RIGHT, 4 * EDSCALE); - p_theme->set_stylebox("DictionaryAddItem", EditorStringName(EditorStyles), style_dictionary_add_item); + style_dictionary_add_item->set_expand_margin(SIDE_LEFT, 2 * EDSCALE); + style_dictionary_add_item->set_expand_margin(SIDE_RIGHT, 2 * EDSCALE); + p_theme->set_stylebox("DictionaryAddItem0", EditorStringName(EditorStyles), style_dictionary_add_item); } // Editor help. |