{"record":{"id":"3bf40daf827a1ff0","repo":"BigPizzaV3/CodexPlusPlus","slug":"invalid-dream-skin-theme-color-color","errorCode":null,"errorMessage":"invalid Dream Skin theme color: {color}","messagePattern":"invalid Dream Skin theme color: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_library.rs","lineNumber":540,"sourceCode":"    }\n    if !draft.config.style_preset.is_empty() && !valid_theme_id(&draft.config.style_preset) {\n        bail!(\"invalid Dream Skin style preset\");\n    }\n    if let Some(colors) = &draft.config.colors {\n        for color in [\n            &colors.background,\n            &colors.panel,\n            &colors.panel_alt,\n            &colors.accent,\n            &colors.accent_alt,\n            &colors.secondary,\n            &colors.highlight,\n            &colors.text,\n            &colors.muted,\n            &colors.line,\n        ] {\n            if !valid_css_color(color) {\n                bail!(\"invalid Dream Skin theme color: {color}\");\n            }\n        }\n    }\n    Ok(())\n}\n\nfn valid_css_color(value: &str) -> bool {\n    let value = value.trim();\n    if let Some(hex) = value.strip_prefix('#') {\n        return matches!(hex.len(), 3 | 4 | 6 | 8)\n            && hex.bytes().all(|byte| byte.is_ascii_hexdigit());\n    }\n    let body = value\n        .strip_prefix(\"rgb(\")\n        .or_else(|| value.strip_prefix(\"rgba(\"))\n        .and_then(|value| value.strip_suffix(')'));\n    body.is_some_and(|body| {\n        !body.is_empty()","sourceCodeStart":522,"sourceCodeEnd":558,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_library.rs#L522-L558","documentation":"validate_theme_draft iterates every color in draft.config.colors (background, panel, panel_alt, highlight, text, muted, line) and requires each to pass valid_css_color: a hex color (#RGB, #RGBA, #RRGGBB, #RRGGBBAA) or an rgb()/rgba() expression containing only digits, whitespace, commas, dots and percent signs. Any other string (named colors, hsl(), 'transparent', CSS variables) is rejected with the offending value in the message.","triggerScenarios":"Saving/activating a theme whose colors contain a non-hex, non-rgb() string such as \"red\", \"hsl(0 100% 50%)\", \"var(--bg)\", \"#12345\" (bad hex length), \"rgb(300, 0, 0)\" is fine format-wise but \"#GGHHII\" or \"transparent\" fail.","commonSituations":"Picking colors from a CSS design system that uses named colors or CSS variables; importing themes written for a web context that allows the full CSS color grammar; hand-editing theme.json with a typo in a hex triplet.","solutions":["Convert colors to #RRGGBB (or #RRGGBBAA / #RGB / #RGBA) hex form before assigning to config.colors.","Convert rgb()/rgba() values to the digit/comma form the validator accepts, e.g. \"rgb(24, 32, 48)\".","Resolve CSS variables and named colors at generation time in your UI (color picker output) rather than storing them raw.","Pre-validate each color with the same hex/rgb grammar in your form before constructing the draft."],"exampleFix":"// before\nconfig.colors = Some(Colors { background: \"var(--bg)\".into(), .. });\nsave_dream_skin_theme(&state_dir, &draft(config))?;\n// after\nconfig.colors = Some(Colors { background: \"#101820\".into(), .. }); // hex always passes\nsave_dream_skin_theme(&state_dir, &draft(config))?;","handlingStrategy":"validation","validationCode":"fn valid_css_color(value: &str) -> bool {\n    let v = value.trim();\n    if let Some(h) = v.strip_prefix('#') {\n        return matches!(h.len(), 3 | 4 | 6 | 8) && h.bytes().all(|b| b.is_ascii_hexdigit());\n    }\n    v.strip_prefix(\"rgb(\").or_else(|| v.strip_prefix(\"rgba(\"))\n        .and_then(|b| b.strip_suffix(')'))\n        .map_or(false, |b| !b.is_empty() && b.bytes().all(|b| b.is_ascii_digit() || b.is_ascii_whitespace() || matches!(b, b',' | b'.' | b'%')))\n}","typeGuard":null,"tryCatchPattern":"for (k, v) in all_colors(&config) {\n    if !valid_css_color(&v) { return Err(anyhow!(\"field {k} must be hex or rgb(), got {v}\")); }\n}","preventionTips":["Use a color picker that outputs hex always; never store named colors, hsl(), or CSS variables.","Normalize imported colors (convert any CSS color to #RRGGBB / rgb(r, g, b)) at import time.","Validate all 7 color fields (background, panel, panel_alt, highlight, text, muted, line) before save."],"tags":["validation","css-color","format","theme"],"backgroundTag":"invalid-argument-format","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}