{"record":{"id":"0d6ce1710bf5d926","repo":"JanDeDobbeleer/oh-my-posh","slug":"color-name-s-does-not-exist","errorCode":null,"errorMessage":"color name %s does not exist","messagePattern":"color name (.+?) does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/color/colors.go","lineNumber":430,"sourceCode":"\tif colorInt, err := strconv.ParseInt(colorString, 10, 8); err == nil {\n\t\tc := color.C256(uint8(colorInt), isBackground)\n\n\t\treturn Ansi(c.String())\n\t}\n\n\treturn emptyColor\n}\n\nfunc (d *Defaults) Resolve(colorString Ansi) (Ansi, error) {\n\treturn colorString, nil\n}\n\nfunc getAnsiColorFromName(colorValue Ansi, isBackground bool) (Ansi, error) {\n\tif colorCodes, found := ansiColorCodes[colorValue]; found {\n\t\treturn colorCodes[generics.ToInt[int](isBackground)], nil\n\t}\n\n\treturn \"\", fmt.Errorf(\"color name %s does not exist\", colorValue)\n}\n\nfunc IsAnsiColorName(colorValue Ansi) bool {\n\t_, ok := ansiColorCodes[colorValue]\n\treturn ok\n}\n\n// PaletteColors is the AnsiColors Decorator that uses the Palette to do named color\n// lookups before ANSI color code generation.\ntype PaletteColors struct {\n\tansiColors String\n\tpalette    Palette\n}\n\nfunc (p *PaletteColors) ToAnsi(colorString Ansi, isBackground bool) Ansi {\n\t// a gradient string is not a palette key; guard it explicitly so it never round-trips\n\t// through palette resolution and reaches the next decorator untouched.\n\tif colorString.IsGradient() {","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/color/colors.go#L412-L448","documentation":"When converting a color specified by name to its ANSI code, getAnsiColorFromName looks the name up in the ansiColorCodes map. If the name is absent, it returns this error. It means the configured color string is not one of the recognized ANSI color names (or a valid hex was expected instead).","triggerScenarios":"Setting a segment's foreground/background/template color to an unknown name in a theme config (e.g. 'brightblue' vs 'lightBlue'), then rendering the prompt so ToAnsi resolves the name.","commonSituations":"Hand-editing theme JSON/YAML/TOML with an invented color name, porting a theme from another prompt tool with different color vocabularies, or case/spacing mistakes in the color string.","solutions":["Use a documented color name (see oh-my-posh docs color list) or a hex value like '#ff0000'","Verify spelling against IsAnsiColorName-recognized names (e.g. 'lightBlue', not 'brightblue')","Run `oh-my-posh config` debug/render output to confirm which segment's color fails","Validate the theme JSON against website/static/schema.json which enumerates allowed values"],"exampleFix":"// before (config.toml)\nforeground = \"brightblue\"\n// after\nforeground = \"lightBlue\"","handlingStrategy":"validation","validationCode":"if !IsAnsiColorName(foreground) && !strings.HasPrefix(foreground, \"#\") {\n    return fmt.Errorf(\"color %q is neither a known ANSI color name nor a hex value\", foreground)\n}","typeGuard":"func isValidColor(v string) bool { return IsAnsiColorName(Ansi(v)) || strings.HasPrefix(v, \"#\") }","tryCatchPattern":"code, err := colors.ToAnsi(name, false)\nif err != nil && strings.Contains(err.Error(), \"does not exist\") {\n    code = defaultColor\n}","preventionTips":["Pick color names only from the documented color list","Validate themes against website/static/schema.json","Use hex values (#rrggbb) when unsure of a name","Keep a working theme as reference for correct color vocabulary"],"tags":["color","configuration","theme"],"backgroundTag":"invalid-color-name","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}