Removed most of the custom colors from the interface.

This commit is contained in:
Daniel J. Ramirez 2017-09-25 21:43:20 -05:00
parent f577efd47e
commit b622c92fad
12 changed files with 50 additions and 36 deletions

View File

@ -165,7 +165,7 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
TreeItem *item = search_options->create_item(parent); TreeItem *item = search_options->create_item(parent);
item->set_text(0, p_type); item->set_text(0, p_type);
if (!ClassDB::can_instance(p_type)) { if (!ClassDB::can_instance(p_type)) {
item->set_custom_color(0, Color(0.5, 0.5, 0.5)); item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
item->set_selectable(0, false); item->set_selectable(0, false);
} else { } else {

View File

@ -197,7 +197,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
String res_path = "res://" + path; String res_path = "res://" + path;
if (FileAccess::exists(res_path)) { if (FileAccess::exists(res_path)) {
ti->set_custom_color(0, Color(1, 0.3, 0.2)); ti->set_custom_color(0, get_color("error_color", "Editor"));
ti->set_tooltip(0, res_path + " (Already Exists)"); ti->set_tooltip(0, res_path + " (Already Exists)");
ti->set_checked(0, false); ti->set_checked(0, false);
} else { } else {

View File

@ -3468,7 +3468,7 @@ void EditorNode::_dock_select_draw() {
Color used = Color(0.6, 0.6, 0.6, 0.8); Color used = Color(0.6, 0.6, 0.6, 0.8);
Color used_selected = Color(0.8, 0.8, 0.8, 0.8); Color used_selected = Color(0.8, 0.8, 0.8, 0.8);
Color tab_selected = Color(1, 1, 1, 1); Color tab_selected = theme_base->get_color("mono_color", "Editor");
Color unused = used; Color unused = used;
unused.a = 0.4; unused.a = 0.4;
Color unusable = unused; Color unusable = unused;

View File

@ -127,10 +127,10 @@ void EditorPluginSettings::update_plugins() {
item->set_editable(3, true); item->set_editable(3, true);
if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) { if (EditorNode::get_singleton()->is_addon_plugin_enabled(d)) {
item->set_custom_color(3, Color(0.2, 1, 0.2)); item->set_custom_color(3, get_color("success_color", "Editor"));
item->set_range(3, 1); item->set_range(3, 1);
} else { } else {
item->set_custom_color(3, Color(1, 0.2, 0.2)); item->set_custom_color(3, get_color("disabled_font_color", "Editor"));
item->set_range(3, 0); item->set_range(3, 0);
} }
} }
@ -160,9 +160,9 @@ void EditorPluginSettings::_plugin_activity_changed() {
} }
if (is_active) if (is_active)
ti->set_custom_color(3, Color(0.2, 1, 0.2)); ti->set_custom_color(3, get_color("success_color", "Editor"));
else else
ti->set_custom_color(3, Color(1, 0.2, 0.2)); ti->set_custom_color(3, get_color("disabled_font_color", "Editor"));
} }
void EditorPluginSettings::_bind_methods() { void EditorPluginSettings::_bind_methods() {

View File

@ -296,6 +296,7 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
const Color highlight_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.2); const Color highlight_color = Color(mono_color.r, mono_color.g, mono_color.b, 0.2);
theme->set_color("accent_color", "Editor", accent_color); theme->set_color("accent_color", "Editor", accent_color);
theme->set_color("highlight_color", "Editor", highlight_color);
theme->set_color("base_color", "Editor", base_color); theme->set_color("base_color", "Editor", base_color);
theme->set_color("dark_color_1", "Editor", dark_color_1); theme->set_color("dark_color_1", "Editor", dark_color_1);
theme->set_color("dark_color_2", "Editor", dark_color_2); theme->set_color("dark_color_2", "Editor", dark_color_2);
@ -304,17 +305,27 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("contrast_color_2", "Editor", contrast_color_2); theme->set_color("contrast_color_2", "Editor", contrast_color_2);
theme->set_color("font_color", "Editor", font_color); theme->set_color("font_color", "Editor", font_color);
theme->set_color("disabled_font_color", "Editor", font_color_disabled);
Color success_color = accent_color.linear_interpolate(Color(.6, 1, .6), 0.8); theme->set_color("mono_color", "Editor", mono_color);
Color warning_color = accent_color.linear_interpolate(Color(1, 1, .2), 0.8);
Color error_color = accent_color.linear_interpolate(Color(1, .2, .2), 0.8); Color success_color = accent_color.linear_interpolate(Color(0.2, 1, 0.2), 0.6) * 1.2;
Color warning_color = accent_color.linear_interpolate(Color(1, 1, 0), 0.7);
Color error_color = accent_color.linear_interpolate(Color(1, 0, 0), 0.8) * 1.7;
if (!dark_theme) {
// yellow on white themes is a P.I.T.A.
warning_color = accent_color.linear_interpolate(Color(1, 0.8, 0), 0.9);
warning_color = warning_color.linear_interpolate(mono_color, 0.2);
success_color = success_color.linear_interpolate(mono_color, 0.2);
error_color = error_color.linear_interpolate(mono_color, 0.2);
}
theme->set_color("success_color", "Editor", success_color); theme->set_color("success_color", "Editor", success_color);
theme->set_color("warning_color", "Editor", warning_color); theme->set_color("warning_color", "Editor", warning_color);
theme->set_color("error_color", "Editor", error_color); theme->set_color("error_color", "Editor", error_color);
// 2d grid color // 2d grid color
const Color grid_minor_color = Color(font_color.r, font_color.g, font_color.b, 0.1); const Color grid_minor_color = mono_color * Color(1.0, 1.0, 1.0, 0.07);
const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.05); const Color grid_major_color = Color(font_color_disabled.r, font_color_disabled.g, font_color_disabled.b, 0.15);
theme->set_color("grid_major_color", "Editor", grid_major_color); theme->set_color("grid_major_color", "Editor", grid_major_color);
theme->set_color("grid_minor_color", "Editor", grid_minor_color); theme->set_color("grid_minor_color", "Editor", grid_minor_color);
@ -693,6 +704,8 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("focus", "TextEdit", style_widget_hover); theme->set_stylebox("focus", "TextEdit", style_widget_hover);
theme->set_constant("side_margin", "TabContainer", 0); theme->set_constant("side_margin", "TabContainer", 0);
theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons")); theme->set_icon("tab", "TextEdit", theme->get_icon("GuiTab", "EditorIcons"));
theme->set_color("font_color", "TextEdit", font_color);
theme->set_color("caret_color", "TextEdit", highlight_color);
// H/VSplitContainer // H/VSplitContainer
theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1)); theme->set_stylebox("bg", "VSplitContainer", make_stylebox(theme->get_icon("GuiVsplitBg", "EditorIcons"), 1, 1, 1, 1));

View File

@ -73,7 +73,7 @@ void ExportTemplateManager::_update_template_list() {
current_hb->add_child(current); current_hb->add_child(current);
if (templates.has(current_version)) { if (templates.has(current_version)) {
current->add_color_override("font_color", Color(0.5, 1, 0.5)); current->add_color_override("font_color", get_color("success_color", "Editor"));
Button *redownload = memnew(Button); Button *redownload = memnew(Button);
redownload->set_text(TTR("Re-Download")); redownload->set_text(TTR("Re-Download"));
current_hb->add_child(redownload); current_hb->add_child(redownload);
@ -86,7 +86,7 @@ void ExportTemplateManager::_update_template_list() {
uninstall->connect("pressed", this, "_uninstall_template", varray(current_version)); uninstall->connect("pressed", this, "_uninstall_template", varray(current_version));
} else { } else {
current->add_color_override("font_color", Color(1.0, 0.5, 0.5)); current->add_color_override("font_color", get_color("error_color", "Editor"));
Button *redownload = memnew(Button); Button *redownload = memnew(Button);
redownload->set_text(TTR("Download")); redownload->set_text(TTR("Download"));
redownload->connect("pressed", this, "_download_template", varray(current_version)); redownload->connect("pressed", this, "_download_template", varray(current_version));
@ -98,7 +98,7 @@ void ExportTemplateManager::_update_template_list() {
HBoxContainer *hbc = memnew(HBoxContainer); HBoxContainer *hbc = memnew(HBoxContainer);
Label *version = memnew(Label); Label *version = memnew(Label);
version->set_modulate(Color(1, 1, 1, 0.7)); version->set_modulate(get_color("disabled_font_color", "Editor"));
String text = E->get(); String text = E->get();
if (text == current_version) { if (text == current_version) {
text += " " + TTR("(Current)"); text += " " + TTR("(Current)");
@ -299,7 +299,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file) {
void ExportTemplateManager::popup_manager() { void ExportTemplateManager::popup_manager() {
_update_template_list(); _update_template_list();
popup_centered_minsize(Size2(400, 600) * EDSCALE); popup_centered_minsize(Size2(400, 400) * EDSCALE);
} }
void ExportTemplateManager::ok_pressed() { void ExportTemplateManager::ok_pressed() {

View File

@ -1434,7 +1434,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
error_hb = memnew(HBoxContainer); error_hb = memnew(HBoxContainer);
library_main->add_child(error_hb); library_main->add_child(error_hb);
error_label = memnew(Label); error_label = memnew(Label);
error_label->add_color_override("color", Color(1, 0.4, 0.3)); error_label->add_color_override("color", get_color("error_color", "Editor"));
error_hb->add_child(error_label); error_hb->add_child(error_label);
description = NULL; description = NULL;

View File

@ -613,8 +613,8 @@ void CurveEditor::_draw() {
Vector2 min_edge = get_world_pos(Vector2(0, view_size.y)); Vector2 min_edge = get_world_pos(Vector2(0, view_size.y));
Vector2 max_edge = get_world_pos(Vector2(view_size.x, 0)); Vector2 max_edge = get_world_pos(Vector2(view_size.x, 0));
const Color grid_color0(0, 0, 0, 0.5); const Color grid_color0 = get_color("grid_major_color", "Editor");
const Color grid_color1(0, 0, 0, 0.15); const Color grid_color1 = get_color("grid_minor_color", "Editor");
draw_line(Vector2(min_edge.x, curve.get_min_value()), Vector2(max_edge.x, curve.get_min_value()), grid_color0); draw_line(Vector2(min_edge.x, curve.get_min_value()), Vector2(max_edge.x, curve.get_min_value()), grid_color0);
draw_line(Vector2(max_edge.x, curve.get_max_value()), Vector2(min_edge.x, curve.get_max_value()), grid_color0); draw_line(Vector2(max_edge.x, curve.get_max_value()), Vector2(min_edge.x, curve.get_max_value()), grid_color0);
draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color0); draw_line(Vector2(0, min_edge.y), Vector2(0, max_edge.y), grid_color0);
@ -636,7 +636,7 @@ void CurveEditor::_draw() {
Ref<Font> font = get_font("font", "Label"); Ref<Font> font = get_font("font", "Label");
float font_height = font->get_height(); float font_height = font->get_height();
const Color text_color(1, 1, 1, 0.3); const Color text_color = get_color("font_color", "Editor");
{ {
// X axis // X axis
@ -664,7 +664,7 @@ void CurveEditor::_draw() {
if (_selected_point >= 0) { if (_selected_point >= 0) {
const Color tangent_color(0.5, 0.5, 1, 1); const Color tangent_color = get_color("accent_color", "Editor");
int i = _selected_point; int i = _selected_point;
Vector2 pos = curve.get_point_position(i); Vector2 pos = curve.get_point_position(i);
@ -686,8 +686,8 @@ void CurveEditor::_draw() {
draw_set_transform_matrix(_world_to_view); draw_set_transform_matrix(_world_to_view);
const Color line_color(1, 1, 1, 0.85); const Color line_color = get_color("highlight_color", "Editor");
const Color edge_line_color(1, 1, 1, 0.4); const Color edge_line_color = get_color("font_color", "Editor");
CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color); CanvasItemPlotCurve plot_func(*this, line_color, edge_line_color);
plot_curve_accurate(curve, 4.f / view_size.x, plot_func); plot_curve_accurate(curve, 4.f / view_size.x, plot_func);
@ -714,8 +714,8 @@ void CurveEditor::_draw() {
draw_set_transform_matrix(Transform2D()); draw_set_transform_matrix(Transform2D());
const Color point_color(1, 1, 1); const Color point_color = get_color("font_color", "Editor");
const Color selected_point_color(1, 0.5, 0.5); const Color selected_point_color = get_color("accent_color", "Editor");
for (int i = 0; i < curve.get_point_count(); ++i) { for (int i = 0; i < curve.get_point_count(); ++i) {
Vector2 pos = curve.get_point_position(i); Vector2 pos = curve.get_point_position(i);

View File

@ -39,7 +39,7 @@
void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) { void draw_margin_line(Control *edit_draw, Vector2 from, Vector2 to) {
Vector2 line = (to - from).normalized() * 10; Vector2 line = (to - from).normalized() * 10;
while ((to - from).length_squared() > 200) { while ((to - from).length_squared() > 200) {
edit_draw->draw_line(from, from + line, Color(0.97, 0.2, 0.2), 2); edit_draw->draw_line(from, from + line, EditorNode::get_singleton()->get_theme_base()->get_color("mono_color", "Editor"), 2);
from += line * 2; from += line * 2;
} }
} }
@ -66,6 +66,7 @@ void TextureRegionEditor::_region_draw() {
VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D()); VS::get_singleton()->canvas_item_add_set_transform(edit_draw->get_canvas_item(), Transform2D());
if (snap_mode == SNAP_GRID) { if (snap_mode == SNAP_GRID) {
Color grid_color = get_color("grid_major_color", "Editor");
Size2 s = edit_draw->get_size(); Size2 s = edit_draw->get_size();
int last_cell = 0; int last_cell = 0;
@ -76,7 +77,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0) if (i == 0)
last_cell = cell; last_cell = cell;
if (last_cell != cell) if (last_cell != cell)
edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), Color(0.3, 0.7, 1, 0.3)); edit_draw->draw_line(Point2(i, 0), Point2(i, s.height), grid_color);
last_cell = cell; last_cell = cell;
} }
else else
@ -85,7 +86,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0) if (i == 0)
last_cell = cell; last_cell = cell;
if (last_cell != cell) if (last_cell != cell)
edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), Color(0.3, 0.7, 1, 0.3)); edit_draw->draw_rect(Rect2(i - snap_separation.x * draw_zoom, 0, snap_separation.x * draw_zoom, s.height), grid_color);
last_cell = cell; last_cell = cell;
} }
} }
@ -97,7 +98,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0) if (i == 0)
last_cell = cell; last_cell = cell;
if (last_cell != cell) if (last_cell != cell)
edit_draw->draw_line(Point2(0, i), Point2(s.width, i), Color(0.3, 0.7, 1, 0.3)); edit_draw->draw_line(Point2(0, i), Point2(s.width, i), grid_color);
last_cell = cell; last_cell = cell;
} }
else else
@ -106,7 +107,7 @@ void TextureRegionEditor::_region_draw() {
if (i == 0) if (i == 0)
last_cell = cell; last_cell = cell;
if (last_cell != cell) if (last_cell != cell)
edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), Color(0.3, 0.7, 1, 0.3)); edit_draw->draw_rect(Rect2(0, i - snap_separation.y * draw_zoom, s.width, snap_separation.y * draw_zoom), grid_color);
last_cell = cell; last_cell = cell;
} }
} }
@ -137,7 +138,7 @@ void TextureRegionEditor::_region_draw() {
mtx.basis_xform(rect.position + rect.size), mtx.basis_xform(rect.position + rect.size),
mtx.basis_xform(rect.position + Vector2(0, rect.size.y)) mtx.basis_xform(rect.position + Vector2(0, rect.size.y))
}; };
Color color(0.9, 0.5, 0.5); Color color = get_color("mono_color", "Editor");
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
int prev = (i + 3) % 4; int prev = (i + 3) % 4;

View File

@ -929,7 +929,7 @@ ProjectExportDialog::ProjectExportDialog() {
export_error = memnew(Label); export_error = memnew(Label);
main_vb->add_child(export_error); main_vb->add_child(export_error);
export_error->hide(); export_error->hide();
export_error->add_color_override("font_color", Color(1, 0.5, 0.5)); export_error->add_color_override("font_color", get_color("error_color", "Editor"));
export_templates_error = memnew(HBoxContainer); export_templates_error = memnew(HBoxContainer);
main_vb->add_child(export_templates_error); main_vb->add_child(export_templates_error);
@ -937,7 +937,7 @@ ProjectExportDialog::ProjectExportDialog() {
Label *export_error2 = memnew(Label); Label *export_error2 = memnew(Label);
export_templates_error->add_child(export_error2); export_templates_error->add_child(export_error2);
export_error2->add_color_override("font_color", Color(1, 0.5, 0.5)); export_error2->add_color_override("font_color", get_color("error_color", "Editor"));
export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " "); export_error2->set_text(" - " + TTR("Export templates for this platform are missing:") + " ");
LinkButton *download_templates = memnew(LinkButton); LinkButton *download_templates = memnew(LinkButton);

View File

@ -2433,7 +2433,7 @@ bool PropertyEditor::_is_drop_valid(const Dictionary &p_drag_data, const Diction
void PropertyEditor::_mark_drop_fields(TreeItem *p_at) { void PropertyEditor::_mark_drop_fields(TreeItem *p_at) {
if (_is_drop_valid(get_viewport()->gui_get_drag_data(), p_at->get_metadata(0))) if (_is_drop_valid(get_viewport()->gui_get_drag_data(), p_at->get_metadata(0)))
p_at->set_custom_bg_color(1, Color(0.7, 0.5, 0.2), true); p_at->set_custom_bg_color(1, get_color("accent_color", "Editor"), true);
if (p_at->get_children()) { if (p_at->get_children()) {
_mark_drop_fields(p_at->get_children()); _mark_drop_fields(p_at->get_children());

View File

@ -185,7 +185,7 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) {
if (part_of_subscene) { if (part_of_subscene) {
//item->set_selectable(0,marked_selectable); //item->set_selectable(0,marked_selectable);
item->set_custom_color(0, get_color("error_color", "Editor").linear_interpolate(get_color("warning_color", "Editor"), 0.4)); item->set_custom_color(0, get_color("disabled_font_color", "Editor"));
} else if (marked.has(p_node)) { } else if (marked.has(p_node)) {
@ -345,7 +345,7 @@ void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {
Color color(1, 1, 1, 1); Color color(1, 1, 1, 1);
bool visible_on_screen = p_node->call("is_visible_in_tree"); bool visible_on_screen = p_node->call("is_visible_in_tree");
if (!visible_on_screen) { if (!visible_on_screen) {
color = Color(0.6, 0.6, 0.6, 1); color.a = 0.6;
} }
int idx = p_item->get_button_by_id(0, BUTTON_VISIBILITY); int idx = p_item->get_button_by_id(0, BUTTON_VISIBILITY);
p_item->set_button_color(0, idx, color); p_item->set_button_color(0, idx, color);