wdpr
    Preparing search index...

    Function isValidCssColor

    • Validate that a string is a safe CSS color value.

      Accepts named colors, hex notation (#RGB, #RGBA, #RRGGBB, #RRGGBBAA), and functional notation (rgb(), rgba(), hsl(), hsla()) with strictly numeric arguments.

      Rejects anything else -- including semicolons, url(), expression(), and any other pattern that could be used for CSS injection.

      Parameters

      • color: string

        The CSS color value to validate.

      Returns boolean

      true if the value is a recognized safe color format.