UI: Theme: Add text color settings to panels

Recently, panel styling was moved to a global setting instead of being
per-editor. However, the panel's title and labels inside still rely on
the per-editor region's text and title settings.

Move panel title and text colors to the global "Panel" settings.

See PR for details and screenshots.

Part of #135192

Pull Request: https://projects.blender.org/blender/blender/pulls/140726
This commit is contained in:
Pablo Vazquez
2025-06-20 21:03:08 +02:00
committed by Pablo Vazquez
parent 1b9f9dd96f
commit 695a03d9f4
10 changed files with 41 additions and 122 deletions

View File

@@ -272,6 +272,8 @@ const bTheme U_theme_default = {
.panel_back = RGBA(0x3d3d3dff),
.panel_sub_back = RGBA(0x0000001f),
.panel_outline = RGBA(0xffffff11),
.panel_title = RGBA(0xe6e6e600),
.panel_text = RGBA(0xe6e6e600),
},
.space_properties = {
.back = RGBA(0x30303000),
@@ -283,9 +285,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x1d1d1d00),
.button = RGBA(0x303030ff),
.button_title = RGBA(0xffffff00),
.button_text = RGBA(0xcccccc00),
.button_text_hi = RGBA(0xffffff00),
.active = RGBA(0x4772b3ff),
.vertex_size = 3,
.outline_width = 1,
@@ -303,9 +302,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.grid = RGBA(0x54545480),
.wire = RGBA(0x000000ff),
.wire_edit = RGBA(0x000000ff),
@@ -392,9 +388,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.hilite = RGBA(0x4772b3ff),
.vertex_size = 3,
.outline_width = 1,
@@ -411,9 +404,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x1d1d1dff),
.list_title = RGBA(0xffffffff),
.list_text = RGBA(0xb8b8b8ff),
@@ -481,9 +471,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x22222200),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x1d1d1dff),
.list_title = RGBA(0xffffffff),
.list_text = RGBA(0xb8b8b8ff),
@@ -536,9 +523,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x1d1d1dff),
.list_title = RGBA(0xffffffff),
.list_text = RGBA(0xb8b8b8ff),
@@ -582,9 +566,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x18181800),
.list_title = RGBA(0xffffffff),
.list_text = RGBA(0xffffffff),
@@ -647,9 +628,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.grid = RGBA(0x303030ff),
.wire_edit = RGBA(0xc0c0c0ff),
.vertex_select = RGBA(0xff8500ff),
@@ -694,9 +672,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.shade2 = RGBA(0x4d4d4de6),
.hilite = RGBA(0x71a8ffff),
.grid = RGBA(0x1d1d1dff),
@@ -742,9 +717,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x303030ff),
.list_title = RGBA(0xffffffff),
.list_text = RGBA(0xb8b8b8ff),
@@ -799,9 +771,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x30303000),
.button = RGBA(0x303030ff),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.vertex_size = 3,
.outline_width = 1,
.facedot_size = 4,
@@ -834,9 +803,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x303030ff),
.list_title = RGBA(0xffffff00),
.list_text = RGBA(0xb8b8b8ff),
@@ -908,9 +874,6 @@ const bTheme U_theme_default = {
.header_text_hi = RGBA(0xffffffff),
.tab_back = RGBA(0x18181800),
.button = RGBA(0x30303000),
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xccccccff),
.button_text_hi = RGBA(0xffffffff),
.list = RGBA(0x303030ff),
.list_title = RGBA(0xc3c3c3ff),
.list_text = RGBA(0xb8b8b8ff),

View File

@@ -13,6 +13,8 @@
widget_text_cursor="#3399e6"
panel_roundness="0.4"
panel_header="#ccccccff"
panel_title="#1a1a1a"
panel_text="#1a1a1a"
panel_back="#ccccccff"
panel_sub_back="#0000001f"
panel_outline="#ffffff22"
@@ -463,9 +465,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -550,9 +549,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -579,9 +575,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -639,9 +632,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -709,9 +699,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -779,9 +766,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -852,9 +836,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -881,9 +862,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#303030ff"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#a6a6a6ff"
>
</ThemeSpaceRegionGeneric>
@@ -920,9 +898,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -980,9 +955,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -1058,9 +1030,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -1148,9 +1117,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>
@@ -1208,9 +1174,6 @@
<space_region>
<ThemeSpaceRegionGeneric
button="#b3b3b300"
button_title="#1a1a1a"
button_text="#1a1a1a"
button_text_hi="#000000"
tab_back="#b3b3b300"
>
</ThemeSpaceRegionGeneric>

View File

@@ -1113,7 +1113,11 @@ class USERPREF_PT_theme_interface_panel(ThemePanel, CenterAlignMixIn, Panel):
col.prop(ui, "panel_back", text="Background")
col.prop(ui, "panel_sub_back", text="Sub-Panel")
col = flow.column()
col = flow.column(align=True)
col.prop(ui, "panel_title", text="Title")
col.prop(ui, "panel_text", text="Text")
col = col.column()
col.prop(ui, "panel_outline", text="Outline")
col.prop(ui, "panel_roundness", text="Roundness")

View File

@@ -27,7 +27,7 @@
/* Blender file format version. */
#define BLENDER_FILE_VERSION BLENDER_VERSION
#define BLENDER_FILE_SUBVERSION 24
#define BLENDER_FILE_SUBVERSION 25
/* Minimum Blender version that supports reading file written with the current
* version. Older Blender versions will test this and cancel loading the file, showing a warning to

View File

@@ -332,11 +332,13 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
}
if (!USER_VERSION_ATLEAST(500, 24)) {
FROM_DEFAULT_V4_UCHAR(tui.panel_title);
FROM_DEFAULT_V4_UCHAR(tui.panel_text);
}
if (!USER_VERSION_ATLEAST(500, 25)) {
FROM_DEFAULT_V4_UCHAR(space_properties.tab_back);
FROM_DEFAULT_V4_UCHAR(space_properties.button);
FROM_DEFAULT_V4_UCHAR(space_properties.button_title);
FROM_DEFAULT_V4_UCHAR(space_properties.button_text);
FROM_DEFAULT_V4_UCHAR(space_properties.button_text_hi);
}
/**

View File

@@ -78,8 +78,6 @@ enum ThemeColorID {
TH_PANEL_OUTLINE,
TH_BUTBACK,
TH_BUTBACK_TEXT,
TH_BUTBACK_TEXT_HI,
TH_SHADE1,
TH_SHADE2,

View File

@@ -202,8 +202,10 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
setting = ts->background_type;
break;
case TH_TEXT:
if (g_theme_state.regionid == RGN_TYPE_WINDOW) {
cp = ts->text;
if (ELEM(g_theme_state.regionid, RGN_TYPE_UI, RGN_TYPE_TOOLS) ||
ELEM(g_theme_state.spacetype, SPACE_PROPERTIES, SPACE_USERPREF))
{
cp = btheme->tui.panel_text;
}
else if (g_theme_state.regionid == RGN_TYPE_CHANNELS) {
cp = ts->list_text;
@@ -216,14 +218,11 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->header_text;
}
else {
cp = ts->button_text;
cp = ts->text;
}
break;
case TH_TEXT_HI:
if (g_theme_state.regionid == RGN_TYPE_WINDOW) {
cp = ts->text_hi;
}
else if (g_theme_state.regionid == RGN_TYPE_CHANNELS) {
if (g_theme_state.regionid == RGN_TYPE_CHANNELS) {
cp = ts->list_text_hi;
}
else if (ELEM(g_theme_state.regionid,
@@ -234,12 +233,14 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->header_text_hi;
}
else {
cp = ts->button_text_hi;
cp = ts->text_hi;
}
break;
case TH_TITLE:
if (g_theme_state.regionid == RGN_TYPE_WINDOW) {
cp = ts->title;
if (ELEM(g_theme_state.regionid, RGN_TYPE_UI, RGN_TYPE_TOOLS) ||
ELEM(g_theme_state.spacetype, SPACE_PROPERTIES, SPACE_USERPREF))
{
cp = btheme->tui.panel_title;
}
else if (g_theme_state.regionid == RGN_TYPE_CHANNELS) {
cp = ts->list_title;
@@ -252,7 +253,7 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
cp = ts->header_title;
}
else {
cp = ts->button_title;
cp = ts->title;
}
break;
@@ -283,12 +284,6 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
case TH_BUTBACK:
cp = ts->button;
break;
case TH_BUTBACK_TEXT:
cp = ts->button_text;
break;
case TH_BUTBACK_TEXT_HI:
cp = ts->button_text_hi;
break;
case TH_TAB_TEXT:
cp = btheme->tui.wcol_tab.text;

View File

@@ -206,6 +206,8 @@ typedef struct ThemeUI {
unsigned char panel_back[4];
unsigned char panel_sub_back[4];
unsigned char panel_outline[4];
unsigned char panel_title[4];
unsigned char panel_text[4];
char _pad2[4];
} ThemeUI;
@@ -246,10 +248,7 @@ typedef struct ThemeSpace {
/* button/tool regions */
/** Region background. */
unsigned char button[4];
/** Panel title. */
unsigned char button_title[4];
unsigned char button_text[4];
unsigned char button_text_hi[4];
unsigned char _pad3[4];
/* List-view regions. */
/** Region background. */

View File

@@ -1982,6 +1982,16 @@ static void rna_def_userdef_theme_ui(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Panel Header", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "panel_title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Panel Title", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "panel_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Panel Text", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "panel_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_ui_text(prop, "Panel Background", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
@@ -2218,21 +2228,6 @@ static void rna_def_userdef_theme_space_region_generic(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Region Background", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text Titles", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Region Text Highlight", "");
RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
/* tabs */
prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
RNA_def_property_array(prop, 4);

View File

@@ -662,7 +662,7 @@ static void wm_window_decoration_style_set_from_theme(const wmWindow *win, const
float titlebar_bg_color[3], titlebar_fg_color[3];
UI_GetThemeColor3fv(TH_BACK, titlebar_bg_color);
UI_GetThemeColor3fv(TH_BUTBACK_TEXT, titlebar_fg_color);
UI_GetThemeColor3fv(TH_TEXT, titlebar_fg_color);
copy_v3_v3(decoration_settings.colored_titlebar_bg_color, titlebar_bg_color);
copy_v3_v3(decoration_settings.colored_titlebar_fg_color, titlebar_fg_color);