ResolveTheme merges the selected built-in theme with user overrides.
(cfg *config.ThemeConfig)
| 535 | |
| 536 | // ResolveTheme merges the selected built-in theme with user overrides. |
| 537 | func ResolveTheme(cfg *config.ThemeConfig) map[string]string { |
| 538 | base := BuiltInThemes["default"] |
| 539 | |
| 540 | if cfg != nil && cfg.Name != "" { |
| 541 | if t, ok := BuiltInThemes[cfg.Name]; ok { |
| 542 | base = t |
| 543 | } |
| 544 | } |
| 545 | // Copy base to avoid mutation |
| 546 | resolved := make(map[string]string) |
| 547 | for k, v := range base { |
| 548 | resolved[k] = v |
| 549 | } |
| 550 | |
| 551 | if cfg != nil { |
| 552 | for k, v := range cfg.Colors { |
| 553 | resolved[k] = v |
| 554 | } |
| 555 | } |
| 556 | |
| 557 | return resolved |
| 558 | } |
| 559 | |
| 560 | // ApplyCustomTheme applies the resolved theme to the Colors struct. |
| 561 | // Users can select a built-in theme by name and override any color. |