MCPcopy
hub / github.com/docker/docker-agent / applyTheme

Function applyTheme

cmd/root/run.go:1131–1149  ·  view source on GitHub ↗

applyTheme applies the theme, resolving it from the --theme flag, then the user config, then the built-in default.

(themeOverride string)

Source from the content-addressed store, hash-verified

1129// applyTheme applies the theme, resolving it from the --theme flag, then the
1130// user config, then the built-in default.
1131func applyTheme(themeOverride string) {
1132 // Resolve theme from --theme flag > user config > built-in default
1133 themeRef := styles.DefaultThemeRef
1134 if userSettings := userconfig.Get(); userSettings.Theme != "" {
1135 themeRef = userSettings.Theme
1136 }
1137 if themeOverride != "" {
1138 themeRef = themeOverride
1139 }
1140
1141 theme, err := styles.LoadTheme(themeRef)
1142 if err != nil {
1143 slog.Warn("Failed to load theme, using default", "theme", themeRef, "error", err)
1144 theme = styles.DefaultTheme()
1145 }
1146
1147 styles.ApplyTheme(theme)
1148 slog.Debug("Applied theme", "theme_ref", themeRef, "theme_name", theme.Name)
1149}

Callers 3

TestApplyThemePrecedenceFunction · 0.85
runRunCommandMethod · 0.85
runOrExecMethod · 0.85

Calls 6

GetFunction · 0.92
LoadThemeFunction · 0.92
DefaultThemeFunction · 0.92
ApplyThemeFunction · 0.92
WarnMethod · 0.80
DebugMethod · 0.80

Tested by 1

TestApplyThemePrecedenceFunction · 0.68