def set_color(self, color):
        """Store color and create surface representing it.

        Check the __init__ method for an explanation of
        the color parameter.

        Quick discussion
        ================

        Instead of arbitrarily creating/referencing/copying
        the checkered surface, I could first check whether
        the surface has transparency or not, so the step
        could be skipped if it didn't have.

        However, after trying the implementation, it wasn't
        obviously apparent whether or not this would save
        a significant amount of time (or even whether it
        would save time any time at all), since so many
        operations take place. For instance, even taking
        the speed of the operations into account, this
        class was made, at least initially, to produce
        relatively small widgets, thus not much time is
        spent in the creation of surfaces to begin with.

        In the future, when convenient, we could profile
        such operations within typical use-cases in order
        to decide whether to implement the additional checks
        and operations to skip checkered surface creation/
        copy when the color has no transparency.

        For now, I believe the method is fine as it is
        and doesn't hinder the application at all.
        """
        ### store the color and its contrasting counterpart
        ### (either black or white)

        self.color = color

        self.contrasting_color = CONTRASTING_COLOR_MAP[color]

        ### obtain a checkered surface with this widget size
        checkered_surf = self.SIZE_TO_CHECKERED_SURF[self.size]

        ### copy the checkered surface in the 'image'
        ### attribute
        self.image = checkered_surf.copy()

        ### obtain a surface representing a rect filled
        ### with this widget's color
        color_surf = render_rect(*self.size, color)

        ### blit the color surface over the checkered
        ### surface we copied (if the color has transparency,
        ### the checker pattern underneath will be visible,
        ### making the transparency apparent)
        self.image.blit(color_surf, (0, 0))
Store color and create surface representing it.

        Check the __init__ method for an explanation of
        the color parameter.

        Quick discussion
        ================

        Instead of arbitrarily creating/referencing/copying
        the checkered surface, I could first check whether
        the surface has transparency or not, so the step
        could be skipped if it didn't have.

        However, after trying the implementation, it wasn't
        obviously apparent whether or not this would save
        a significant amount of time (or even whether it
        would save time any time at all), since so many
        operations take place. For instance, even taking
        the speed of the operations into account, this
        class was made, at least initially, to produce
        relatively small widgets, thus not much time is
        spent in the creation of surfaces to begin with.

        In the future, when convenient, we could profile
        such operations within typical use-cases in order
        to decide whether to implement the additional checks
        and operations to skip checkered surface creation/
        copy when the color has no transparency.

        For now, I believe the method is fine as it is
        and doesn't hinder the application at all.
        
nodezator/colorsman/color2d.py