{"record":{"id":"199b16cc0481479c","repo":"reflex-dev/reflex","slug":"shade-must-be-between-min-shade-value-and-max-s","errorCode":null,"errorMessage":"Shade must be between {MIN_SHADE_VALUE} and {MAX_SHADE_VALUE}","messagePattern":"Shade must be between (.+?) and (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-components-core/src/reflex_components_core/core/colors.py","lineNumber":44,"sourceCode":"\n    Returns:\n        The color object.\n\n    Raises:\n        ValueError: If the color, shade, or alpha are not valid.\n    \"\"\"\n    if isinstance(color, str):\n        if color not in COLORS and REFLEX_VAR_OPENING_TAG not in color:\n            msg = f\"Color must be one of {COLORS}, received {color}\"\n            raise ValueError(msg)\n    elif not isinstance(color, Var):\n        msg = \"Color must be a string or a Var\"\n        raise ValueError(msg)\n\n    if isinstance(shade, int):\n        if shade < MIN_SHADE_VALUE or shade > MAX_SHADE_VALUE:\n            msg = f\"Shade must be between {MIN_SHADE_VALUE} and {MAX_SHADE_VALUE}\"\n            raise ValueError(msg)\n    elif not isinstance(shade, Var):\n        msg = \"Shade must be an integer or a Var\"\n        raise ValueError(msg)\n\n    if not isinstance(alpha, (bool, Var)):\n        msg = \"Alpha must be a boolean or a Var\"\n        raise ValueError(msg)\n\n    return Color(color, shade, alpha)\n","sourceCodeStart":26,"sourceCodeEnd":54,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-components-core/src/reflex_components_core/core/colors.py#L26-L54","documentation":"The `shade` argument of `rx.color()` must be an integer between MIN_SHADE_VALUE and MAX_SHADE_VALUE (0–12 in Reflex's palette). Shades index into the theme's color ramp, so out-of-range values have no corresponding CSS variable.","triggerScenarios":"`rx.color('red', 13)`, `rx.color('red', -1)`, or computing a shade from arithmetic that overshoots the range.","commonSituations":"Porting Tailwind shades (e.g. 50, 100, 900) directly into rx.color; dynamic shade calculation like min(a+b, 20) with the wrong cap.","solutions":["Clamp the shade to 0–12: rx.color('red', max(0, min(shade, 12)))","Use a valid shade 0–12","Check MIN_SHADE_VALUE/MAX_SHADE_VALUE imported from reflex.constants if unsure"],"exampleFix":"// before\nrx.color('red', 100)\n// after\nrx.color('red', 9)","handlingStrategy":"validation","validationCode":"MIN, MAX = 0, 12\nshade = max(MIN, min(int(shade), MAX))\ncolor = rx.color('red', shade)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed shades before passing","Remember Reflex shades are 0-12, not Tailwind's 50-900 scale"],"tags":["reflex","color","range-validation"],"backgroundTag":"value-out-of-range","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}