{"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":"exception","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/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L778-L814","documentation":"The `light` theme of a builtin color/style failed validation inside normalizeInlineStyleTheme; the underlying cause is wrapped after this prefix. Typically the theme's `color` or `backgroundColor` is present but not a valid value — the kernel requires the `#rrggbb` form (inlineStyleColorPattern `^#[0-9a-f]{6}$`). The description names the owning entry, e.g. \"invalid light theme of builtin color [5]: ...\".","triggerScenarios":"setInlineStylesData or loadInlineStyles where a builtin entry's light theme has color/backgroundColor not matching `#rrggbb` (e.g. \"red\", \"#fff\", \"#FF0000\" uppercase, \"rgb(255,0,0)\", or an empty string paired incorrectly).","commonSituations":"Copy-pasting CSS color values from the web (named colors, rgb(), 3-digit hex, uppercase hex); pasting a var(--token) reference; trailing whitespace in the value.","solutions":["Convert the light theme's color/backgroundColor to 6-digit lowercase hex, e.g. \"#e8f0e8\".","Expand 3-digit hex (#fff -> #ffffff) and lowercase any uppercase hex digits.","Resolve named colors, rgb()/hsl() values, or CSS variables to concrete hex values before saving."],"exampleFix":"// before\n\"light\": {\"backgroundColor\": \"#FFF\"}\n// after\n\"light\": {\"backgroundColor\": \"#ffffff\"}","handlingStrategy":"validation","validationCode":"const HEX = /^#[0-9a-f]{6}$/;\nif (!HEX.test(entry.light.color || \"\") && !HEX.test(entry.light.backgroundColor || \"\")) {\n  throw new Error(\"light theme color/backgroundColor must be #rrggbb\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize all colors through a toRrggbb() helper (expand 3-digit hex, lowercase, resolve names/rgb()) before saving.","Never paste raw CSS color values into the config without conversion."],"tags":["go","configuration","inline-styles","color-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}