{"record":{"id":"c309a91cb86c68c7","repo":"siyuan-note/siyuan","slug":"invalid-light-theme-of-s-w","errorCode":null,"errorMessage":"invalid light theme of %s: %w","messagePattern":"invalid light theme of (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":796,"sourceCode":"\tif palette == nil {\n\t\treturn ret, nil\n\t}\n\tcolors, err := av.NormalizeAttributeViewCustomColors(palette.Colors, strict)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tret.Colors = colors\n\tret.Order = av.NormalizeAttributeViewColorOrder(palette.Order, colors)\n\treturn ret, nil\n}\n\nfunc normalizeInlineStyleThemePair(light, dark *InlineStyleTheme, description string) (normalizedLight,\n\tnormalizedDark *InlineStyleTheme, err error) {\n\tif light == nil || dark == nil {\n\t\treturn nil, nil, fmt.Errorf(\"%s must define light and dark themes\", description)\n\t}\n\tif normalizedLight, err = normalizeInlineStyleTheme(light); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"invalid light theme of %s: %w\", description, err)\n\t}\n\tif normalizedDark, err = normalizeInlineStyleTheme(dark); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"invalid dark theme of %s: %w\", description, err)\n\t}\n\tlightColor, lightBackground := normalizedLight.Color != \"\", normalizedLight.BackgroundColor != \"\"\n\tdarkColor, darkBackground := normalizedDark.Color != \"\", normalizedDark.BackgroundColor != \"\"\n\tif !lightColor && !lightBackground {\n\t\treturn nil, nil, fmt.Errorf(\"%s must define color or backgroundColor\", description)\n\t}\n\tif lightColor != darkColor || lightBackground != darkBackground {\n\t\treturn nil, nil, fmt.Errorf(\"%s must use the same fields in light and dark themes\", description)\n\t}\n\treturn normalizedLight, normalizedDark, nil\n}\n\nfunc normalizeHiddenBuiltinColorIndexes(indexes []int, field string) (ret []int, err error) {\n\tret = make([]int, 0, len(indexes))\n\tseen := make(map[int]struct{}, len(indexes))","sourceCodeStart":778,"sourceCodeEnd":814,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/inline_style.go#L778-L814","documentation":"When the light theme object of a builtin color/style fails normalizeInlineStyleTheme, the pair normalizer wraps the inner error ('invalid color: color [...] must use #RRGGBB format' or the backgroundColor variant) with this prefix. The color values must be lowercase-normalizable #RRGGBB hex strings or empty.","triggerScenarios":"A builtin entry's light.color or light.backgroundColor in inline-styles.json is not a 6-digit hex value (e.g. 'red', '#fff', '#FF00GG', 'rgb(255,0,0)').","commonSituations":"Pasting CSS color names or rgb()/hsl() values into the JSON; using 3-digit shorthand hex; typos in hex digits; themes copied from other apps with different color formats.","solutions":["Convert the light theme color to #RRGGBB hex form (e.g. red -> #ff0000, #fff -> #ffffff)","Check both color and backgroundColor fields in the light theme; the wrapped error names which one is bad","Apply the same fix to the dark theme to avoid the sibling 'invalid dark theme' error","Reload the workspace to confirm the palette loads"],"exampleFix":"// before\n\"light\": {\"backgroundColor\": \"#fff\"}\n// after\n\"light\": {\"backgroundColor\": \"#ffffff\"}","handlingStrategy":"validation","validationCode":"const HEX = /^#[0-9a-fA-F]{6}$/;\nfor (const entry of (cfg.builtin?.colors ?? [])) {\n  for (const f of ['color', 'backgroundColor']) {\n    const v = entry.light?.[f];\n    if (v && !HEX.test(v)) throw new Error(`builtin color [${entry.index}] light.${f} '${v}' must use #RRGGBB format`);\n  }\n}","typeGuard":"function isHexColor(v) { return v === undefined || v === '' || /^#[0-9a-fA-F]{6}$/.test(v); }","tryCatchPattern":"if _, err := setInlineStylesData(styles, currentAV); err != nil {\n    if strings.Contains(err.Error(), \"invalid light theme\") { /* convert the reported color to #RRGGBB and retry */ }\n    return err\n}","preventionTips":["Only use 6-digit hex colors (#RRGGBB); convert names/rgb()/3-digit hex before saving","Validate with /^#[0-9a-fA-F]{6}$/ before writing the config","Copy color values from a palette tool that outputs hex","Keep light and dark colors from the same generator to avoid one-off format mistakes"],"tags":["config","color-format","validation","hex"],"backgroundTag":"invalid-argument-format","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}