Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the default theme colors. #61

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7061,6 +7061,7 @@ EditorNode::EditorNode() {
scene_root_parent->set_v_size_flags(Control::SIZE_EXPAND_FILL);

scene_root = memnew(SubViewport);
scene_root->set_transparent_background(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this line being added?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for the CanvasItemEditor viewport background color, without it, the background will always be gray and will not follow the theme colors when we change it, we can't override the default_clear_color for the viewport with every release, so it's better to use a transparent background instead for the 2D editor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a fine reason. I am curious if it would have any impact on performance or battery life when using the editor on mobile though.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shouldn't have any impact on performance, the rendering server will not draw a clear color for the CanvasItemEditor SubViewport.

scene_root->set_embedding_subwindows(true);
scene_root->set_disable_3d(true);
scene_root->set_disable_input(true);
Expand Down
6 changes: 3 additions & 3 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,10 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/preset", "Default", "Default,Blazium,Breeze Dark,Godot,Godot 2,Gray,Indigo,Light,Redot,Solarized (Dark),Solarized (Light),Black (OLED),Custom")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_ENUM, "interface/theme/spacing_preset", "Default", "Compact,Default,Spacious,Custom")
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/theme/icon_and_font_color", 0, "Auto,Dark,Light")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/base_color", Color(0.2, 0.23, 0.31), "")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/accent_color", Color(0.41, 0.61, 0.91), "")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/base_color", Color(0.141, 0.157, 0.231), "")
EDITOR_SETTING(Variant::COLOR, PROPERTY_HINT_NONE, "interface/theme/accent_color", Color(0.733, 0.604, 0.969), "")
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/theme/use_system_accent_color", false, "")
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/contrast", 0.3, "-1,1,0.01")
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/contrast", 0.24, "-1,1,0.01")
EDITOR_SETTING(Variant::BOOL, PROPERTY_HINT_NONE, "interface/theme/draw_extra_borders", false, "")
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/icon_saturation", 1.0, "0,2,0.01")
EDITOR_SETTING(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/theme/relationship_line_opacity", 0.1, "0.00,1,0.01")
Expand Down
24 changes: 8 additions & 16 deletions editor/themes/editor_theme_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
config.color_picker_button_height = 28 * EDSCALE;
config.subresource_hue_tint = EDITOR_GET("docks/property_editor/subresource_hue_tint");

config.default_contrast = 0.3; // Make sure to keep this in sync with the editor settings definition.
config.default_contrast = 0.24; // Make sure to keep this in sync with the editor settings definition.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multiple themes use the default contrast, please adjust them accordingly so they do not have unintended visual changes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave the other themes that was using the default contrast a 0.3 value, also removed redot and blazium presets, we already are the default so we don't need to add a preset.


// Handle main theme preset.
{
Expand Down Expand Up @@ -284,26 +284,22 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
bool preset_draw_extra_borders = false;

// Please use alphabetical order if you're adding a new theme here.
if (config.preset == "Blazium") {
preset_accent_color = Color(0.506, 0.188, 0.949);
preset_base_color = Color(0.18, 0.18, 0.18);
preset_contrast = config.default_contrast;
} else if (config.preset == "Breeze Dark") {
if (config.preset == "Breeze Dark") {
preset_accent_color = Color(0.26, 0.76, 1.00);
preset_base_color = Color(0.24, 0.26, 0.28);
preset_contrast = config.default_contrast;
} else if (config.preset == "Godot") {
preset_accent_color = Color(0.44, 0.73, 0.98);
preset_base_color = Color(0.21, 0.24, 0.29);
preset_contrast = config.default_contrast;
preset_contrast = 0.3;
} else if (config.preset == "Godot 2") {
preset_accent_color = Color(0.53, 0.67, 0.89);
preset_base_color = Color(0.24, 0.23, 0.27);
preset_contrast = config.default_contrast;
preset_contrast = 0.3;
} else if (config.preset == "Gray") {
preset_accent_color = Color(0.44, 0.73, 0.98);
preset_base_color = Color(0.24, 0.24, 0.24);
preset_contrast = config.default_contrast;
preset_contrast = 0.3;
} else if (config.preset == "Indigo") {
preset_accent_color = Color(0.37, 0.54, 0.91);
preset_base_color = Color(0.17, 0.17, 0.20);
Expand All @@ -313,14 +309,10 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
preset_base_color = Color(0.9, 0.9, 0.9);
// A negative contrast rate looks better for light themes, since it better follows the natural order of UI "elevation".
preset_contrast = -0.06;
} else if (config.preset == "Redot") {
preset_accent_color = Color(0.87, 0.22, 0.29);
preset_base_color = Color(0.14, 0.12, 0.12);
preset_contrast = config.default_contrast;
} else if (config.preset == "Solarized (Dark)") {
preset_accent_color = Color(0.15, 0.55, 0.82);
preset_base_color = Color(0.04, 0.23, 0.27);
preset_contrast = config.default_contrast;
preset_contrast = 0.3;
} else if (config.preset == "Solarized (Light)") {
preset_accent_color = Color(0.15, 0.55, 0.82);
preset_base_color = Color(0.89, 0.86, 0.79);
Expand All @@ -333,8 +325,8 @@ EditorThemeManager::ThemeConfiguration EditorThemeManager::_create_theme_config(
preset_contrast = 0.0;
preset_draw_extra_borders = true;
} else { // Default
preset_accent_color = Color(0.506, 0.188, 0.949);
preset_base_color = Color(0.18, 0.18, 0.18);
preset_base_color = Color(0.141, 0.157, 0.231);
preset_accent_color = Color(0.733, 0.604, 0.969);
preset_contrast = config.default_contrast;
}

Expand Down
Loading