Factory that returns BaseGradient or AnimatedGradient.
If animated=True (or animate=True) is passed, an AnimatedGradient
instance is constructed; otherwise a BaseGradient is returned. All other
positional and keyword arguments are forwarded to the chosen implementation.
              
                Source code in src/rich_gradient/gradient.py
                |  | class Gradient:
    """Factory that returns `BaseGradient` or `AnimatedGradient`.
    If `animated=True` (or `animate=True`) is passed, an `AnimatedGradient`
    instance is constructed; otherwise a `BaseGradient` is returned. All other
    positional and keyword arguments are forwarded to the chosen implementation.
    """
    def __new__(cls, *args: Any, **kwargs: Any):  # type: ignore[override]
        # Support both `animated` (preferred) and `animate` (compat) flags
        animated = bool(kwargs.pop("animated", False) or kwargs.pop("animate", False))
        if animated:
            return AnimatedGradient(*args, **kwargs)
        return BaseGradient(*args, **kwargs)
 |