UI: Use alternating row theme color in file browser

The outliner already uses the alternating row theme color as an
overlay for every other row. This uses the same color for the file
browser, instead of a hardcoded shading.

The file browser background color is slightly tweaked to match the
outliner, and the Blender Light theme is updated to use a lighter
background color like the outliner.

Reviewed by: Hans Goudey, Julian Eisel

Differential Revision: https://developer.blender.org/D8717
This commit is contained in:
Red Mser 2020-08-26 16:53:58 -05:00 committed by Hans Goudey
parent 8a9912eaf8
commit 479ce00809
5 changed files with 21 additions and 7 deletions

View File

@ -238,11 +238,11 @@ const bTheme U_theme_default = {
.menu_shadow_fac = 0.3f,
.menu_shadow_width = 4,
.editor_outline = RGBA(0x1f1f1fff),
.icon_alpha = 1.0f,
.icon_saturation = 0.5f,
.transparent_checker_primary = RGBA(0x333333ff),
.transparent_checker_secondary = RGBA(0x262626ff),
.transparent_checker_size = 8,
.icon_alpha = 1.0f,
.icon_saturation = 0.5f,
.widget_text_cursor = RGBA(0x3399e6ff),
.xaxis = RGBA(0xff3352ff),
.yaxis = RGBA(0x8bdc00ff),
@ -250,9 +250,9 @@ const bTheme U_theme_default = {
.gizmo_hi = RGBA(0xffffffff),
.gizmo_primary = RGBA(0xf5f14dff),
.gizmo_secondary = RGBA(0x63ffffff),
.gizmo_view_align = RGBA(0xffffffff),
.gizmo_a = RGBA(0x4da84dff),
.gizmo_b = RGBA(0xa33535ff),
.gizmo_view_align = RGBA(0xffffffff),
.icon_scene = RGBA(0xe6e6e6ff),
.icon_collection = RGBA(0xf4f4f4ff),
.icon_object = RGBA(0xee9e5dff),
@ -379,7 +379,7 @@ const bTheme U_theme_default = {
.paint_curve_handle = RGBA(0x7fff7f7f),
},
.space_file = {
.back = RGBA(0x33333300),
.back = RGBA(0x28282800),
.title = RGBA(0xffffffff),
.text = RGBA(0xe6e6e6ff),
.text_hi = RGBA(0xffffffff),
@ -404,6 +404,7 @@ const bTheme U_theme_default = {
.vertex_size = 3,
.outline_width = 1,
.facedot_size = 4,
.row_alternate = RGBA(0xffffff07),
},
.space_graph = {
.back = RGBA(0x42424200),

View File

@ -534,13 +534,14 @@
</graph_editor>
<file_browser>
<ThemeFileBrowser
row_alternate="#ffffff0f"
selected_file="#5680c2"
>
<space>
<ThemeSpaceGeneric
back="#404040"
back="#999999"
title="#000000"
text="#eeeeee"
text="#000000"
text_hi="#ffffff"
header="#adadadff"
header_text="#000000"

View File

@ -228,6 +228,11 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
*/
{
/* Keep this block, even when empty. */
/* The new defaults for the file browser theme are the same as
* the outliner's, and it's less disruptive to just copy them. */
copy_v4_v4_uchar(btheme->space_file.back, btheme->space_outliner.back);
copy_v4_v4_uchar(btheme->space_file.row_alternate, btheme->space_outliner.row_alternate);
}
#undef FROM_DEFAULT_V4_UCHAR

View File

@ -441,7 +441,9 @@ static void draw_background(FileLayout *layout, View2D *v2d)
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColorShade(TH_BACK, -7);
float col_alternating[4];
UI_GetThemeColor4fv(TH_ROW_ALTERNATE, col_alternating);
immUniformThemeColorBlend(TH_BACK, TH_ROW_ALTERNATE, col_alternating[3]);
/* alternating flat shade background */
for (i = 2; (i <= layout->rows + 1); i += 2) {

View File

@ -2478,6 +2478,11 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Selected File", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "row_alternate", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Alternate Rows", "Overlay color on every other row");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)