Repository: ManimCommunity/manim
File: manim/utils/color/core.py (Python)

Code before:
        factor : float, optional
            The factor by which the color should be darker, by default 0.2,
            which results in a slightly darker color

        Returns
        -------
        ManimColor
            The darker ManimColor

        See Also
        --------
        :meth:`lighter`
        """
        alpha = self._internal_space[3]
        black = self.from_rgb((0.0, 0.0, 0.0))
        return self.interpolate(black, factor).opacity(alpha)

    def lighter(self, factor: float = 0.2) -> Self:
        """Returns a new color that is lighter than the current color, i.e.
        interpolated with white. The opacity is unchanged.

        Parameters
        ----------
        factor : float, optional
            The factor by which the color should be lighter, by default 0.2,
            which results in a slightly lighter color

        Returns
        -------
        ManimColor
            The lighter ManimColor

        See Also
        --------
        :meth:`darker`
        """
        alpha = self._internal_space[3]
        white = self.from_rgb((1.0, 1.0, 1.0))
        return self.interpolate(white, factor).opacity(alpha)

    def contrasting(
        self,
        threshold: float = 0.5,
        light: Self | None = None,
        dark: Self | None = None,
    ) -> Self:
        """Returns one of two colors, light or dark (by default white or black),
        that contrasts with the current color (depending on its luminance).
        This is typically used to set text in a contrasting color that ensures
        it is readable against a background of the current color.


Review comment (suggestion):
```suggestion
            The factor (as a float ratio) by which the color should be lighter. By default 0.2,
            which results in a slightly lighter color.
```

Code after:
        blend : float, optional
            The blend ratio for the interpolation, from 0 (the current color
            unchanged) to 1 (pure black). By default 0.2 which results in a
            slightly darker color

        Returns
        -------
        ManimColor
            The darker ManimColor

        See Also
        --------
        :meth:`lighter`
        """
        from manim.utils.color.manim_colors import BLACK

        alpha = self._internal_space[3]
        black = self._from_internal(BLACK._internal_value)
        return self.interpolate(black, blend).opacity(alpha)

    def lighter(self, blend: float = 0.2) -> Self:
        """Returns a new color that is lighter than the current color, i.e.
        interpolated with white. The opacity is unchanged.

        Parameters
        ----------
        blend : float, optional
            The blend ratio for the interpolation, from 0 (the current color
            unchanged) to 1 (pure white). By default 0.2 which results in a
            slightly lighter color

        Returns
        -------
        ManimColor
            The lighter ManimColor

        See Also
        --------
        :meth:`darker`
        """
        from manim.utils.color.manim_colors import WHITE

        alpha = self._internal_space[3]
        white = self._from_internal(WHITE._internal_value)
        return self.interpolate(white, blend).opacity(alpha)

    def contrasting(
        self,
        threshold: float = 0.5,
        light: Self | None = None,
        dark: Self | None = None,