{"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":"validation","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/9f775e8a12daef8255556097396f9b2739078892/kernel/model/inline_style.go#L781-L817","documentation":"Identical to error 1597 but for the dark theme object: dark.color or dark.backgroundColor failed hex validation, wrapped with the 'invalid dark theme of %s' prefix so the offending entry can be located.","triggerScenarios":"A builtin entry's dark.color or dark.backgroundColor in inline-styles.json is not #RRGGBB (e.g. '#1a1a', 'none', '#12345G').","commonSituations":"Editing dark-mode colors by hand; a script writing truncated or malformed hex; converting from rgba() values; sync merges producing corrupted values.","solutions":["Fix the dark theme color to a valid #RRGGBB hex value","Verify the light theme passes too (both are validated)","Normalize letters to lowercase (the normalizer does this, but keep files consistent)","Reload the workspace and toggle to dark mode to confirm rendering"],"exampleFix":"// before\n\"dark\": {\"backgroundColor\": \"#1a1a\"}\n// after\n\"dark\": {\"backgroundColor\": \"#1a1a1a\"}","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.dark?.[f];\n    if (v && !HEX.test(v)) throw new Error(`builtin color [${entry.index}] dark.${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 dark theme\") { /* convert the reported dark color to #RRGGBB and retry */ }\n    return err\n}","preventionTips":["Validate dark themes with the same regex as light — they share the format rule","Test in dark mode after editing dark colors so truncation/malformed hex is caught early","Avoid hand-typing long hex strings; copy from a color picker","Run one validation pass over both themes before saving"],"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"}