def METHOD_NAME(style: Style, background: Color, factor: float) -> Style:
    """Replace dim attribute with a dim color.
    Args:
        style: Style to dim.
        factor: Blend factor.
    Returns:
        New dimmed style.
    """
    return (
        style
        + Style.from_color(
            dim_color(
                (background.rich_color if style.bgcolor.is_default else style.bgcolor),
                style.color,
                factor,
            ),
            None,
        )
    ) + NO_DIM