Repository: ManimCommunity/manim
File: manim/mobject/three_d/three_dimensions.py (Python)

Code before:

            def construct(self):
                axes = ThreeDAxes(x_range=[-4,4], x_length=8)
                surface = Surface(
                    lambda u, v: axes.c2p(*self.func(u, v)),
                    u_range=[-PI, PI],
                    v_range=[0, TAU],
                    resolution=8,
                )
                self.set_camera_orientation(theta=70 * DEGREES, phi=75 * DEGREES)
                self.add(axes, surface)
    """

    def __init__(
        self,
        func: Callable[[float, float], np.ndarray],
        u_range: Sequence[float] = [0, 1],
        v_range: Sequence[float] = [0, 1],
        resolution: Sequence[int] | int = 32,
        surface_piece_config: dict = {},
        fill_color: ParsableManimColor = BLUE_D,
        fill_opacity: float = 1.0,
        checkerboard_colors: Sequence[ParsableManimColor] | Literal[False] = [
            BLUE_D,
            BLUE_E,
        ],
        stroke_color: ParsableManimColor = LIGHT_GREY,
        stroke_width: float = 0.5,
        should_make_jagged: bool = False,
        pre_function_handle_to_anchor_scale_factor: float = 0.00001,
        **kwargs: Any,
    ) -> None:
        self.u_range = u_range
        self.v_range = v_range
        super().__init__(
            fill_color=fill_color,
            fill_opacity=fill_opacity,
            stroke_color=stroke_color,
            stroke_width=stroke_width,
            **kwargs,
        )
        self.resolution = resolution
        self.surface_piece_config = surface_piece_config
        self.checkerboard_colors: list[ManimColor] | Literal[False]
        if checkerboard_colors is False:
            self.checkerboard_colors = checkerboard_colors
        else:
            self.checkerboard_colors = [ManimColor(i) for i in checkerboard_colors]
        self.should_make_jagged = should_make_jagged
        self.pre_function_handle_to_anchor_scale_factor = (
            pre_function_handle_to_anchor_scale_factor

Review comment (suggestion):
More generally, checkerboard_colors could be any Iterable.
Based on how checkerboard_colors is used in the code, it seems more proper to use None instead of bool or Literal[False]. There are some caveats to that, however: there are some parts where the default value is explicitly `False` and making this change would require changing those default values as well, so feel free to disagree with me here.
  
```suggestion
        checkerboard_colors: Iterable[ParsableManimColor] | None = [BLUE_D, BLUE_E],
```

Code after:
                return np.array([np.cos(u) * np.cos(v), np.cos(u) * np.sin(v), u])

            def construct(self):
                axes = ThreeDAxes(x_range=[-4,4], x_length=8)
                surface = Surface(
                    lambda u, v: axes.c2p(*self.func(u, v)),
                    u_range=[-PI, PI],
                    v_range=[0, TAU],
                    resolution=8,
                )
                self.set_camera_orientation(theta=70 * DEGREES, phi=75 * DEGREES)
                self.add(axes, surface)
    """

    def __init__(
        self,
        func: Callable[[float, float], np.ndarray],
        u_range: tuple[float, float] = (0, 1),
        v_range: tuple[float, float] = (0, 1),
        resolution: int | Sequence[int] = 32,
        surface_piece_config: dict = {},
        fill_color: ParsableManimColor = BLUE_D,
        fill_opacity: float = 1.0,
        checkerboard_colors: Iterable[ParsableManimColor] | Literal[False] = [
            BLUE_D,
            BLUE_E,
        ],
        stroke_color: ParsableManimColor = LIGHT_GREY,
        stroke_width: float = 0.5,
        should_make_jagged: bool = False,
        pre_function_handle_to_anchor_scale_factor: float = 0.00001,
        **kwargs: Any,
    ) -> None:
        self.u_range = u_range
        self.v_range = v_range
        super().__init__(
            fill_color=fill_color,
            fill_opacity=fill_opacity,
            stroke_color=stroke_color,
            stroke_width=stroke_width,
            **kwargs,
        )
        self.resolution = resolution
        self.surface_piece_config = surface_piece_config
        self.checkerboard_colors: list[ManimColor] | Literal[False]
        if checkerboard_colors is False:
            self.checkerboard_colors = checkerboard_colors
        else:
            self.checkerboard_colors = [ManimColor(i) for i in checkerboard_colors]
        self.should_make_jagged = should_make_jagged
        self.pre_function_handle_to_anchor_scale_factor = (