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

Code before:
        """
        return self._construct_from_space(
            self._internal_space * (1 - alpha) + other._internal_space * alpha
        )

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

        Parameters
        ----------
        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)


Review comment (suggestion):
I agree with the concerns raised above; we can just import the color constant locally:

`from manim.utils.color.manim_colors import BLACK`

Code after:
        """
        return self._construct_from_space(
            self._internal_space * (1 - alpha) + other._internal_space * alpha
        )

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

        Parameters
        ----------
        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`
        """