summaryrefslogtreecommitdiff
path: root/editor/editor_themes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_themes.cpp')
-rw-r--r--editor/editor_themes.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index ac902854b7..ace106cd3e 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -86,7 +86,6 @@ static Ref<StyleBoxLine> make_line_stylebox(Color p_color, int p_thickness = 1,
}
Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float p_scale = EDSCALE, bool p_force_filter = false) {
-
Ref<ImageTexture> icon = memnew(ImageTexture);
Ref<Image> img = memnew(Image);
@@ -106,7 +105,6 @@ Ref<ImageTexture> editor_generate_icon(int p_index, bool p_convert_color, float
#endif
void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme = true, int p_thumb_size = 32, bool p_only_thumbs = false) {
-
#ifdef MODULE_SVG_ENABLED
// The default icon theme is designed to be used for a dark theme.
// This dictionary stores color codes to convert to other colors
@@ -248,14 +246,13 @@ void editor_register_and_generate_icons(Ref<Theme> p_theme, bool p_dark_theme =
}
}
- ImageLoaderSVG::set_convert_colors(NULL);
+ ImageLoaderSVG::set_convert_colors(nullptr);
#else
WARN_PRINT("SVG support disabled, editor icons won't be rendered.");
#endif
}
Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
-
Ref<Theme> theme = Ref<Theme>(memnew(Theme));
const float default_contrast = 0.25;
@@ -337,24 +334,24 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//Colors
bool dark_theme = EditorSettings::get_singleton()->is_dark_theme();
- const Color dark_color_1 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast);
- const Color dark_color_2 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 1.5);
- const Color dark_color_3 = base_color.linear_interpolate(Color(0, 0, 0, 1), contrast * 2);
+ const Color dark_color_1 = base_color.lerp(Color(0, 0, 0, 1), contrast);
+ const Color dark_color_2 = base_color.lerp(Color(0, 0, 0, 1), contrast * 1.5);
+ const Color dark_color_3 = base_color.lerp(Color(0, 0, 0, 1), contrast * 2);
const Color background_color = dark_color_2;
// white (dark theme) or black (light theme), will be used to generate the rest of the colors
const Color mono_color = dark_theme ? Color(1, 1, 1) : Color(0, 0, 0);
- const Color contrast_color_1 = base_color.linear_interpolate(mono_color, MAX(contrast, default_contrast));
- const Color contrast_color_2 = base_color.linear_interpolate(mono_color, MAX(contrast * 1.5, default_contrast * 1.5));
+ const Color contrast_color_1 = base_color.lerp(mono_color, MAX(contrast, default_contrast));
+ const Color contrast_color_2 = base_color.lerp(mono_color, MAX(contrast * 1.5, default_contrast * 1.5));
- const Color font_color = mono_color.linear_interpolate(base_color, 0.25);
- const Color font_color_hl = mono_color.linear_interpolate(base_color, 0.15);
+ const Color font_color = mono_color.lerp(base_color, 0.25);
+ const Color font_color_hl = mono_color.lerp(base_color, 0.15);
const Color font_color_disabled = Color(mono_color.r, mono_color.g, mono_color.b, 0.3);
const Color font_color_selection = accent_color * Color(1, 1, 1, 0.4);
- const Color color_disabled = mono_color.inverted().linear_interpolate(base_color, 0.7);
- const Color color_disabled_bg = mono_color.inverted().linear_interpolate(base_color, 0.9);
+ const Color color_disabled = mono_color.inverted().lerp(base_color, 0.7);
+ const Color color_disabled_bg = mono_color.inverted().lerp(base_color, 0.9);
Color icon_color_hover = Color(1, 1, 1) * (dark_theme ? 1.15 : 1.45);
icon_color_hover.a = 1.0;
@@ -391,13 +388,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
Color success_color = Color(0.45, 0.95, 0.5);
Color warning_color = Color(1, 0.87, 0.4);
Color error_color = Color(1, 0.47, 0.42);
- Color property_color = font_color.linear_interpolate(Color(0.5, 0.5, 0.5), 0.5);
+ Color property_color = font_color.lerp(Color(0.5, 0.5, 0.5), 0.5);
if (!dark_theme) {
// Darken some colors to be readable on a light background
- success_color = success_color.linear_interpolate(mono_color, 0.35);
- warning_color = warning_color.linear_interpolate(mono_color, 0.35);
- error_color = error_color.linear_interpolate(mono_color, 0.25);
+ success_color = success_color.lerp(mono_color, 0.35);
+ warning_color = warning_color.lerp(mono_color, 0.35);
+ error_color = error_color.lerp(mono_color, 0.25);
}
theme->set_color("success_color", "Editor", success_color);
@@ -418,7 +415,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
//Register icons + font
// the resolution and the icon color (dark_theme bool) has not changed, so we do not regenerate the icons
- if (p_theme != NULL && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) {
+ if (p_theme != nullptr && fabs(p_theme->get_constant("scale", "Editor") - EDSCALE) < 0.00001 && (bool)p_theme->get_constant("dark_theme", "Editor") == dark_theme) {
// register already generated icons
for (int i = 0; i < editor_icons_count; i++) {
theme->set_icon(editor_icons_names[i], "EditorIcons", p_theme->get_icon(editor_icons_names[i], "EditorIcons"));
@@ -427,14 +424,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
editor_register_and_generate_icons(theme, dark_theme, thumb_size);
}
// thumbnail size has changed, so we regenerate the medium sizes
- if (p_theme != NULL && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) {
+ if (p_theme != nullptr && fabs((double)p_theme->get_constant("thumb_size", "Editor") - thumb_size) > 0.00001) {
editor_register_and_generate_icons(p_theme, dark_theme, thumb_size, true);
}
editor_register_fonts(theme);
// Highlighted tabs and border width
- Color tab_color = highlight_tabs ? base_color.linear_interpolate(font_color, contrast) : base_color;
+ Color tab_color = highlight_tabs ? base_color.lerp(font_color, contrast) : base_color;
const int border_width = CLAMP(border_size, 0, 3) * EDSCALE;
const int default_margin_size = 4;
@@ -686,7 +683,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon("GuiVisibilityXray", "EditorIcons"));
theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE);
- Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1.linear_interpolate(accent_color, 0.08), 2, 0, 2, 2);
+ Ref<StyleBoxFlat> sub_inspector_bg = make_flat_stylebox(dark_color_1.lerp(accent_color, 0.08), 2, 0, 2, 2);
sub_inspector_bg->set_border_width(MARGIN_LEFT, 2);
sub_inspector_bg->set_border_width(MARGIN_RIGHT, 2);
sub_inspector_bg->set_border_width(MARGIN_BOTTOM, 2);
@@ -763,9 +760,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("title_button_hover", "Tree", style_tree_title);
theme->set_stylebox("title_button_pressed", "Tree", style_tree_title);
- Color prop_category_color = dark_color_1.linear_interpolate(mono_color, 0.12);
- Color prop_section_color = dark_color_1.linear_interpolate(mono_color, 0.09);
- Color prop_subsection_color = dark_color_1.linear_interpolate(mono_color, 0.06);
+ Color prop_category_color = dark_color_1.lerp(mono_color, 0.12);
+ Color prop_section_color = dark_color_1.lerp(mono_color, 0.09);
+ Color prop_subsection_color = dark_color_1.lerp(mono_color, 0.06);
theme->set_color("prop_category", "Editor", prop_category_color);
theme->set_color("prop_section", "Editor", prop_section_color);
theme->set_color("prop_subsection", "Editor", prop_subsection_color);
@@ -961,12 +958,14 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("grabber", "HSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
theme->set_stylebox("slider", "HSlider", make_flat_stylebox(dark_color_3, 0, default_margin_size / 2, 0, default_margin_size / 2));
theme->set_stylebox("grabber_area", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2));
+ theme->set_stylebox("grabber_area_highlight", "HSlider", make_flat_stylebox(contrast_color_1, 0, default_margin_size / 2, 0, default_margin_size / 2));
// VSlider
theme->set_icon("grabber", "VSlider", theme->get_icon("GuiSliderGrabber", "EditorIcons"));
theme->set_icon("grabber_highlight", "VSlider", theme->get_icon("GuiSliderGrabberHl", "EditorIcons"));
theme->set_stylebox("slider", "VSlider", make_flat_stylebox(dark_color_3, default_margin_size / 2, 0, default_margin_size / 2, 0));
theme->set_stylebox("grabber_area", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
+ theme->set_stylebox("grabber_area_highlight", "VSlider", make_flat_stylebox(contrast_color_1, default_margin_size / 2, 0, default_margin_size / 2, 0));
//RichTextLabel
theme->set_color("default_color", "RichTextLabel", font_color);
@@ -977,8 +976,6 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("focus", "RichTextLabel", make_empty_stylebox());
theme->set_stylebox("normal", "RichTextLabel", style_tree_bg);
- theme->set_stylebox("panel", "EditorHelpBit", make_flat_stylebox(dark_color_1, 6, 4, 6, 4));
-
theme->set_color("headline_color", "EditorHelp", mono_color);
// Panel
@@ -997,6 +994,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// LinkButton
theme->set_stylebox("focus", "LinkButton", style_empty);
theme->set_color("font_color", "LinkButton", font_color);
+ theme->set_color("font_color_hover", "LinkButton", font_color_hl);
+ theme->set_color("font_color_pressed", "LinkButton", accent_color);
+ theme->set_color("font_color_disabled", "LinkButton", font_color_disabled);
// TooltipPanel
Ref<StyleBoxFlat> style_tooltip = style_popup->duplicate();
@@ -1121,7 +1121,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("toggle_hidden", "FileDialog", theme->get_icon("GuiVisibilityVisible", "EditorIcons"));
// Use a different color for folder icons to make them easier to distinguish from files.
// On a light theme, the icon will be dark, so we need to lighten it before blending it with the accent color.
- theme->set_color("folder_icon_modulate", "FileDialog", (dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).linear_interpolate(accent_color, 0.7));
+ theme->set_color("folder_icon_modulate", "FileDialog", (dark_theme ? Color(1, 1, 1) : Color(4.25, 4.25, 4.25)).lerp(accent_color, 0.7));
theme->set_color("files_disabled", "FileDialog", font_color_disabled);
// color picker
@@ -1155,13 +1155,13 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// editor main color
const Color main_color = dark_theme ? Color(0.34, 0.7, 1.0) : Color(0.02, 0.5, 1.0);
- const Color symbol_color = Color(0.34, 0.57, 1.0).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+ const Color symbol_color = Color(0.34, 0.57, 1.0).lerp(mono_color, dark_theme ? 0.5 : 0.3);
const Color keyword_color = Color(1.0, 0.44, 0.52);
const Color basetype_color = dark_theme ? Color(0.26, 1.0, 0.76) : Color(0.0, 0.76, 0.38);
- const Color type_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.4 : 0.3);
- const Color usertype_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.7 : 0.5);
+ const Color type_color = basetype_color.lerp(mono_color, dark_theme ? 0.4 : 0.3);
+ const Color usertype_color = basetype_color.lerp(mono_color, dark_theme ? 0.7 : 0.5);
const Color comment_color = dim_color;
- const Color string_color = (dark_theme ? Color(1.0, 0.85, 0.26) : Color(1.0, 0.82, 0.09)).linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+ const Color string_color = (dark_theme ? Color(1.0, 0.85, 0.26) : Color(1.0, 0.82, 0.09)).lerp(mono_color, dark_theme ? 0.5 : 0.3);
const Color te_background_color = dark_theme ? background_color : base_color;
const Color completion_background_color = dark_theme ? base_color : background_color;
@@ -1180,9 +1180,9 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color current_line_color = alpha1;
const Color line_length_guideline_color = dark_theme ? base_color : background_color;
const Color word_highlighted_color = alpha1;
- const Color number_color = basetype_color.linear_interpolate(mono_color, dark_theme ? 0.5 : 0.3);
+ const Color number_color = basetype_color.lerp(mono_color, dark_theme ? 0.5 : 0.3);
const Color function_color = main_color;
- const Color member_variable_color = main_color.linear_interpolate(mono_color, 0.6);
+ const Color member_variable_color = main_color.lerp(mono_color, 0.6);
const Color mark_color = Color(error_color.r, error_color.g, error_color.b, 0.3);
const Color bookmark_color = Color(0.08, 0.49, 0.98);
const Color breakpoint_color = error_color;