Repository: matplotlib/matplotlib
File: lib/matplotlib/collections.py (Python)

Code before:
        facecolors = self.get_facecolor()
        edgecolors = self.get_edgecolor()
        do_single_path_optimization = False
        if (len(paths) == 1 and len(trans) <= 1 and
                len(facecolors) == 1 and len(edgecolors) == 1 and
                len(self._linewidths) == 1 and
                all(ls[1] is None for ls in self._linestyles) and
                len(self._antialiaseds) == 1 and len(self._urls) == 1 and
                self.get_hatch() is None):
            if len(trans):
                combined_transform = transforms.Affine2D(trans[0]) + transform
            else:
                combined_transform = transform
            extents = paths[0].get_extents(combined_transform)
            if (extents.width < self.get_figure(root=True).bbox.width
                    and extents.height < self.get_figure(root=True).bbox.height):
                do_single_path_optimization = True

        if self._joinstyle:
            gc.set_joinstyle(self._joinstyle)

        if self._capstyle:
            gc.set_capstyle(self._capstyle)

        if do_single_path_optimization:
            gc.set_foreground(mcolors.to_rgba(edgecolors[0]), isRGBA=True)
            gc.set_linewidth(self._linewidths[0])
            gc.set_dashes(*self._linestyles[0])
            gc.set_antialiased(self._antialiaseds[0])
            gc.set_url(self._urls[0])
            renderer.draw_markers(
                gc, paths[0], combined_transform.frozen(),
                mpath.Path(offsets), offset_trf, tuple(facecolors[0]))
        else:
            # The current new API of draw_path_collection() is provisional
            # and will be changed in a future PR.

            # Find whether renderer.draw_path_collection() takes hatchcolor parameter.
            # Since third-party implementations of draw_path_collection() may not be
            # introspectable, e.g. with inspect.signature, the only way is to try and
            # call this with the hatchcolors parameter.
            hatchcolors_arg_supported = True
            try:
                renderer.draw_path_collection(
                    gc, transform.frozen(), [],
                    self.get_transforms(), offsets, offset_trf,
                    self.get_facecolor(), self.get_edgecolor(),
                    self._linewidths, self._linestyles,
                    self._antialiaseds, self._urls,
                    "screen", hatchcolors=self.get_hatchcolor()
                )

Review comment (suggestion):
Conversion is not needed here (as the tuple is hinting), edgecolors is an rgba array. Check the relevant setters.
```suggestion
        gc.set_foreground(tuple(edgecolors[0]), isRGBA=True)
```

Code after:
        facecolors = self.get_facecolor()
        edgecolors = self.get_edgecolor()
        do_single_path_optimization = False
        if (len(paths) == 1 and len(trans) <= 1 and
                len(facecolors) == 1 and len(edgecolors) == 1 and
                len(self._linewidths) == 1 and
                all(ls[1] is None for ls in self._linestyles) and
                len(self._antialiaseds) == 1 and len(self._urls) == 1 and
                self.get_hatch() is None):
            if len(trans):
                combined_transform = transforms.Affine2D(trans[0]) + transform
            else:
                combined_transform = transform
            extents = paths[0].get_extents(combined_transform)
            if (extents.width < self.get_figure(root=True).bbox.width
                    and extents.height < self.get_figure(root=True).bbox.height):
                do_single_path_optimization = True

        if self._joinstyle:
            gc.set_joinstyle(self._joinstyle)

        if self._capstyle:
            gc.set_capstyle(self._capstyle)

        if do_single_path_optimization:
            gc.set_foreground(tuple(edgecolors[0]), isRGBA=True)
            gc.set_linewidth(self._linewidths[0])
            gc.set_dashes(*self._linestyles[0])
            gc.set_antialiased(self._antialiaseds[0])
            gc.set_url(self._urls[0])
            renderer.draw_markers(
                gc, paths[0], combined_transform.frozen(),
                mpath.Path(offsets), offset_trf, tuple(facecolors[0]))
        else:
            # The current new API of draw_path_collection() is provisional
            # and will be changed in a future PR.

            # Find whether renderer.draw_path_collection() takes hatchcolor parameter.
            # Since third-party implementations of draw_path_collection() may not be
            # introspectable, e.g. with inspect.signature, the only way is to try and
            # call this with the hatchcolors parameter.
            hatchcolors_arg_supported = True
            try:
                renderer.draw_path_collection(
                    gc, transform.frozen(), [],
                    self.get_transforms(), offsets, offset_trf,
                    self.get_facecolor(), self.get_edgecolor(),
                    self._linewidths, self._linestyles,
                    self._antialiaseds, self._urls,
                    "screen", hatchcolors=self.get_hatchcolor()
                )