per-window theme-usage setting - by default, prioritize project theme settings, but allow using only user themes per-window as well.

This commit is contained in:
Ryan Fleury
2025-05-02 13:24:01 -07:00
parent dddc79e852
commit d98335ef76
3 changed files with 18 additions and 4 deletions
File diff suppressed because one or more lines are too long
+4
View File
@@ -414,6 +414,10 @@ RD_VocabTable:
'row_height': @range[1.75f, 5.f] f32,
@default(3.f) @description("Controls the height of tabs, in multiples of the font size.")
'tab_height': @range[1.75f, 5.f] f32,
//- rjf: theme settings
@default(1) @display_name('Use Project Theme') @description("Prefer using the project theme for this window, if any. If off, only the user's theme settings will be used.")
'use_project_theme': bool,
}
```
}
+13 -3
View File
@@ -5757,10 +5757,20 @@ rd_window_frame(void)
// that windows can have their own colors, and have those override higher-up settings.
RD_Cfg *preset_cfg = &rd_nil_cfg;
RD_CfgList colors_cfgs = {0};
RD_Cfg *scan_parents[] = {window, rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project")), rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"))};
for EachElement(idx, scan_parents)
RD_Cfg *theme_parents[] =
{
RD_Cfg *parent_cfg = scan_parents[idx];
rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("project")),
rd_cfg_child_from_string(rd_state->root_cfg, str8_lit("user"))
};
U64 theme_parents_count = ArrayCount(theme_parents);
if(!rd_setting_b32_from_name(str8_lit("use_project_theme")))
{
theme_parents[0] = theme_parents[1];
theme_parents_count -= 1;
}
for EachIndex(idx, theme_parents_count)
{
RD_Cfg *parent_cfg = theme_parents[idx];
if(preset_cfg != &rd_nil_cfg)
{
RD_Cfg *possible_preset_cfg = rd_cfg_child_from_string(parent_cfg, str8_lit("color_preset"));