{"record":{"id":"ac5e12e8208452ab","repo":"junegunn/fzf","slug":"invalid-color-specification-str","errorCode":null,"errorMessage":"invalid color specification: ${str}","messagePattern":"invalid color specification: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":1440,"sourceCode":"\t\t\tcontinue\n\t\t}\n\t\tswitch str {\n\t\tcase \"dark\":\n\t\t\tbaseTheme = tui.Dark256\n\t\t\ttheme = dupeTheme(tui.Dark256)\n\t\tcase \"light\":\n\t\t\tbaseTheme = tui.Light256\n\t\t\ttheme = dupeTheme(tui.Light256)\n\t\tcase \"base16\", \"16\":\n\t\t\tbaseTheme = tui.Default16\n\t\t\ttheme = dupeTheme(tui.Default16)\n\t\tcase \"bw\", \"no\":\n\t\t\tbaseTheme = tui.NoColorTheme\n\t\t\ttheme = dupeTheme(tui.NoColorTheme)\n\t\tdefault:\n\t\t\tfail := func() {\n\t\t\t\t// Let the code proceed to simplify the error handling\n\t\t\t\terr = errors.New(\"invalid color specification: \" + str)\n\t\t\t}\n\t\t\t// Color is disabled\n\t\t\tif theme == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tcomponents := strings.Split(str, \":\")\n\t\t\tif len(components) < 2 {\n\t\t\t\tfail()\n\t\t\t}\n\n\t\t\tmergeAttr := func(cattr *tui.ColorAttr) {\n\t\t\t\tfor _, component := range components[1:] {\n\t\t\t\t\tswitch component {\n\t\t\t\t\tcase \"regular\":\n\t\t\t\t\t\tcattr.Attr = tui.AttrRegular\n\t\t\t\t\tcase \"bold\", \"strong\":\n\t\t\t\t\t\tcattr.Attr |= tui.Bold","sourceCodeStart":1422,"sourceCodeEnd":1458,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L1422-L1458","documentation":"parseTheme processes colon-separated --color arguments. Each component must be a known theme keyword (dark, light, 16, bw, ...) or a 'facet:ansi-256-color-or-#rrggbb' pair. A component that is neither — fewer than 2 parts after splitting on ':', or a facet/color pair that fails color parsing — sets this error via the fail() closure.","triggerScenarios":"--color border (missing ':value'), --color sp: (empty color), --color 'fg:#GGGGGG' (bad hex), --color pointer:pink (not a color name), stray empty components from 'a::b' style typos.","commonSituations":"Terminal-specific color configs ported between tools; missing value after a rename of a facet; quoting issues that swallow the ':'-half; themes written for newer fzf facets on an older binary.","solutions":["Use 'facet:value' pairs with valid colors: --color 'fg:15,bg:#1e1e2e,pointer:3'","Check facet names against fzf --help (fg, bg, preview-fg, preview-bg, hl, hl+, gutter, border, prompt, pointer, marker, spinner, header, label, query, info, separator)","Fix quoting so the colon-pair survives shell parsing: --color \"gutter:${c:--1}\"","Remove empty components caused by double colons"],"exampleFix":"# before\nfzf --color 'border,fg:15'\n# after\nfzf --color 'border:8,fg:15'","handlingStrategy":"type-guard","validationCode":"validate_color_pair() {\n  local facet color\n  facet=\"${1%%:*}\" color=\"${1##*:}\"\n  [[ \"$1\" == *:* ]] || return 1\n  [[ \"$facet\" =~ ^(fg|bg|preview-fg|preview-bg|hl|hl\\+|gutter|border|prompt|pointer|marker|spinner|header|label|query|info|separator|border-label)$ ]] || return 1\n  [[ \"$color\" =~ ^(-1|[0-9]{1,3}|#[0-9a-fA-F]{6})$ ]] || return 1\n}\nfor c in 'fg:15' 'border:#ff0000'; do validate_color_pair \"$c\" || { echo \"bad color spec: $c\" >&2; exit 1; }; done","typeGuard":"isValidFzfColorSpec() { [[ \"$1\" =~ ^(fg|bg|hl|hl\\+|gutter|border|prompt|pointer|marker|spinner|header|label|query|info|separator):(-1|[0-9]{1,3}|#[0-9a-fA-F]{6})$ ]]; }","tryCatchPattern":null,"preventionTips":["Always pair 'facet:color' — a bare facet is invalid","Use ANSI 0-255 indices or #rrggbb hex; color names like 'pink' are not accepted","Double-quote the whole --color argument so ':' pairs survive","Verify facet names against the current fzf --help after upgrades"],"tags":["fzf","theming","options-parsing","color","go"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}