diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-07-08 20:03:06 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2019-07-08 21:17:10 +0200 |
commit | 28d3a6051ce197579817fb56521f539f2951d7e1 (patch) | |
tree | dad336849527e088eeace537e8befcc4fe82b14e /scene | |
parent | 56269e2db835e50a4cf2681bb73c44ae41fcca10 (diff) |
Use base `Color()` constructors instead of `Color::html()`
This results in slightly smaller binaries (-17 KB for an editor binary)
as no strings need to be allocated.
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/rich_text_label.cpp | 32 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 36 |
2 files changed, 34 insertions, 34 deletions
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index 5b91299de6..d6c0981ebc 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1942,37 +1942,37 @@ Error RichTextLabel::append_bbcode(const String &p_bbcode) { if (col.begins_with("#")) color = Color::html(col); else if (col == "aqua") - color = Color::html("#00FFFF"); + color = Color(0, 1, 1); else if (col == "black") - color = Color::html("#000000"); + color = Color(0, 0, 0); else if (col == "blue") - color = Color::html("#0000FF"); + color = Color(0, 0, 1); else if (col == "fuchsia") - color = Color::html("#FF00FF"); + color = Color(1, 0, 1); else if (col == "gray" || col == "grey") - color = Color::html("#808080"); + color = Color(0.5, 0.5, 0.5); else if (col == "green") - color = Color::html("#008000"); + color = Color(0, 0.5, 0); else if (col == "lime") - color = Color::html("#00FF00"); + color = Color(0, 1, 0); else if (col == "maroon") - color = Color::html("#800000"); + color = Color(0.5, 0, 0); else if (col == "navy") - color = Color::html("#000080"); + color = Color(0, 0, 0.5); else if (col == "olive") - color = Color::html("#808000"); + color = Color(0.5, 0.5, 0); else if (col == "purple") - color = Color::html("#800080"); + color = Color(0.5, 0, 0.5); else if (col == "red") - color = Color::html("#FF0000"); + color = Color(1, 0, 0); else if (col == "silver") - color = Color::html("#C0C0C0"); + color = Color(0.75, 0.75, 0.75); else if (col == "teal") - color = Color::html("#008008"); + color = Color(0, 0.5, 0.5); else if (col == "white") - color = Color::html("#FFFFFF"); + color = Color(1, 1, 1); else if (col == "yellow") - color = Color::html("#FFFF00"); + color = Color(1, 1, 0); else color = base_color; diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index cf6ce3a5ef..fb0fb4f8e3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -177,13 +177,13 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const // Font Colors - Color control_font_color = Color::html("e0e0e0"); - Color control_font_color_lower = Color::html("a0a0a0"); - Color control_font_color_low = Color::html("b0b0b0"); - Color control_font_color_hover = Color::html("f0f0f0"); + Color control_font_color = Color(0.88, 0.88, 0.88); + Color control_font_color_lower = Color(0.63, 0.63, 0.63); + Color control_font_color_low = Color(0.69, 0.69, 0.69); + Color control_font_color_hover = Color(0.94, 0.94, 0.94); Color control_font_color_disabled = Color(0.9, 0.9, 0.9, 0.2); - Color control_font_color_pressed = Color::html("ffffff"); - Color font_color_selection = Color::html("7d7d7d"); + Color control_font_color_pressed = Color(1, 1, 1); + Color font_color_selection = Color(0.49, 0.49, 0.49); // Panel @@ -432,12 +432,12 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_font("font", "TextEdit", default_font); - theme->set_color("background_color", "TextEdit", Color(0, 0, 0, 0)); - theme->set_color("completion_background_color", "TextEdit", Color::html("2C2A32")); - theme->set_color("completion_selected_color", "TextEdit", Color::html("434244")); - theme->set_color("completion_existing_color", "TextEdit", Color::html("21dfdfdf")); + theme->set_color("background_color", "TextEdit", Color(0, 0, 0)); + theme->set_color("completion_background_color", "TextEdit", Color(0.17, 0.16, 0.2)); + theme->set_color("completion_selected_color", "TextEdit", Color(0.26, 0.26, 0.27)); + theme->set_color("completion_existing_color", "TextEdit", Color(0.87, 0.87, 0.87, 0.13)); theme->set_color("completion_scroll_color", "TextEdit", control_font_color_pressed); - theme->set_color("completion_font_color", "TextEdit", Color::html("aaaaaa")); + theme->set_color("completion_font_color", "TextEdit", Color(0.67, 0.67, 0.67)); theme->set_color("font_color", "TextEdit", control_font_color); theme->set_color("font_color_selected", "TextEdit", Color(0, 0, 0)); theme->set_color("font_color_readonly", "TextEdit", Color(control_font_color.r, control_font_color.g, control_font_color.b, 0.5f)); @@ -449,14 +449,14 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("code_folding_color", "TextEdit", Color(0.8, 0.8, 0.8, 0.8)); theme->set_color("current_line_color", "TextEdit", Color(0.25, 0.25, 0.26, 0.8)); theme->set_color("caret_color", "TextEdit", control_font_color); - theme->set_color("caret_background_color", "TextEdit", Color::html("000000")); + theme->set_color("caret_background_color", "TextEdit", Color(0, 0, 0)); theme->set_color("symbol_color", "TextEdit", control_font_color_hover); theme->set_color("brace_mismatch_color", "TextEdit", Color(1, 0.2, 0.2)); - theme->set_color("line_number_color", "TextEdit", Color::html("66aaaaaa")); - theme->set_color("safe_line_number_color", "TextEdit", Color::html("99aac8aa")); - theme->set_color("function_color", "TextEdit", Color::html("66a2ce")); - theme->set_color("member_variable_color", "TextEdit", Color::html("e64e59")); - theme->set_color("number_color", "TextEdit", Color::html("EB9532")); + theme->set_color("line_number_color", "TextEdit", Color(0.67, 0.67, 0.67, 0.4)); + theme->set_color("safe_line_number_color", "TextEdit", Color(0.67, 0.78, 0.67, 0.6)); + theme->set_color("function_color", "TextEdit", Color(0.4, 0.64, 0.81)); + theme->set_color("member_variable_color", "TextEdit", Color(0.9, 0.31, 0.35)); + theme->set_color("number_color", "TextEdit", Color(0.92, 0.58, 0.2)); theme->set_color("word_highlighted_color", "TextEdit", Color(0.8, 0.9, 0.9, 0.15)); theme->set_constant("completion_lines", "TextEdit", 7); @@ -651,7 +651,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("cursor_color", "Tree", Color(0, 0, 0)); theme->set_color("guide_color", "Tree", Color(0, 0, 0, 0.1)); theme->set_color("drop_position_color", "Tree", Color(1, 0.3, 0.2)); - theme->set_color("relationship_line_color", "Tree", Color::html("464646")); + theme->set_color("relationship_line_color", "Tree", Color(0.27, 0.27, 0.27)); theme->set_color("custom_button_font_highlight", "Tree", control_font_color_hover); theme->set_constant("hseparation", "Tree", 4 * scale); |