{"record":{"id":"3c5e84ef79e0bfe9","repo":"siyuan-note/siyuan","slug":"invalid-dark-theme-of-s-w","errorCode":null,"errorMessage":"invalid dark theme of %s: %w","messagePattern":"invalid dark theme of (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/inline_style.go","lineNumber":799,"sourceCode":"\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))\n\tmaxIndex := maxBuiltinColorIndex\n\tif field == \"av\" {\n\t\tmaxIndex = neutralAVColorIndex","sourceCodeStart":781,"sourceCodeEnd":817,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/inline_style.go#L781-L817","documentation":"The `dark` theme of a builtin color/style failed validation inside normalizeInlineStyleTheme, with the underlying cause wrapped after this prefix. As with the light theme, color/backgroundColor values must be valid `#rrggbb` hex strings. The description identifies the owning builtin color or style entry.","triggerScenarios":"setInlineStylesData or loadInlineStyles where a builtin entry's dark theme has an invalid color/backgroundColor value (named color, shorthand hex, uppercase hex, rgb() string, or otherwise non-#rrggbb).","commonSituations":"Authoring dark themes by hand from CSS snippets; theme export from another tool using different color notation; mixed-case hex from a color picker that emits uppercase.","solutions":["Rewrite the dark theme's color/backgroundColor as 6-digit lowercase hex (e.g. \"#1e1e1e\").","Normalize all theme values through the same formatter so light and dark both pass the #rrggbb check.","Validate with a regex ^#[0-9a-f]{6}$ in your tooling before calling setInlineStylesData."],"exampleFix":"// before\n\"dark\": {\"backgroundColor\": \"rgb(30,30,30)\"}\n// after\n\"dark\": {\"backgroundColor\": \"#1e1e1e\"}","handlingStrategy":"validation","validationCode":"const HEX = /^#[0-9a-f]{6}$/;\nif (!HEX.test(entry.dark.color || \"\") && !HEX.test(entry.dark.backgroundColor || \"\")) {\n  throw new Error(\"dark theme color/backgroundColor must be #rrggbb\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run the same hex validation on dark themes as on light themes before calling setInlineStylesData.","Convert color-picker output (often uppercase or rgb()) to lowercase 6-digit hex at write time."],"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"}