def __init__(
        self,
        value=(0, 0, 255),
        color_format="rgb_tuple",
        alone_when_single=True,
        width=155,
        name="color_button",
        command=empty_function,
        coordinates_name="topleft",
        coordinates_value=(0, 0),
    ):
        """Store arguments and perform setups.

        Parameters
        ==========

        value (string or tuple)
            the value stored by the widget; may represent
            one or more colors;

            here are the possible meanings of the value:
                - (1) tuple of integers: a single color
                  where each integer is in the
                  range(0, 256) interval and represent
                  the value of each of the red, green, blue
                  and, possibly, the alpha channel;
                - (2) string: a single color in the
                  '#ffffff' or '#ffffffff' format, where
                  the characters after the '#' represent
                  hexadecimal numbers, two digits for
                  each of the red, green, blue and,
                  possibly, the alpha channel;
                - (3) tuple of tuples: each item of the
                  tuple represents a color in the format
                  shown in the item (1);
                - (4) tuple of strings: each item of the
                  tuple represents a color in the format
                  shown in the item (2);
        color_format (string)
            either 'rgb_tuple', if individual colors
            must use the representation described in
            the item (1) of the 'value' parameter
            explanation above or 'hex_string', if the
            format in item (2) must be used instead;
        alone_when_single (boolean)
            when True, instead of a tuple of colors, the
            color itself is used as the value when the
            color value represents a single color (that is,
            when True, if only one color is stored, it will
            be either a string or a tuple of integers
            representing a single color, instead of a tuple
            containing such color);

            for instance, for
            color_format='hex_string' and
            alone_when_single=True, say the value of the
            button is ['#ffffff', '#00ff00aa'], if you
            go and delete any color (for instance, the
            second one), instead of ['#ffffff'] as the
            value of the button, you'll end up with
            '#ffffff' (that is, the string itself).
        width (integer)
            width available for the button.
        name (string)
            an arbitrary name to help identify the widget;
            it is assigned to the 'name' attribute.
        command (callable)
            callable to be executed whenever the value
            of the button is changed.
        coordinates_name (string)
            represents the name of a pygame.Rect attribute
            wherein to store the position information from
            the "coordinates_value" parameter.
        coordinates_value (sequence with 2 integers)
            integers represent the x and y coordinates of a
            position in 2d space, respectively.
        """
        ### store arguments

        self.value = value
        self.color_format = color_format
        self.alone_when_single = alone_when_single
        self.command = command
        self.name = name
        self.width = width

        ### make sure value and its type are valid; errors
        ### raised in this step are purposefully not caught
        ### (no try/except clauses are set up)

        validate_custom_color_format(value, color_format, alone_when_single)

        ### define the number of available slots to display
        ### colors, storing it in a dedicated attribute

        ## if a width wasn't specified (it is None), then
        ## any number of slots can be used, in which case
        ## we assign math.inf to the relevant attribute
        if width is None:
            self.no_of_slots = inf

        ## otherwise we calculate how many slots we can
        ## fit in the remaining space in the button after
        ## we blit the colorbutton icon and use such
        ## number as the number of slots available

        else:

            available_width_for_colors = width - ICON_SIZE[0]

            self.no_of_slots = available_width_for_colors // (SINGLE_COLOR_SIZE[0] - 2)

            # we subtract 2 because the color unit shape
            # is a bit inclined, so they can be lined
            # closer to each other, which means their
            # width doesn't  occupy so much spacke

        ### create/update the surface representing the
        ### value of the widget, to be stored in the
        ### 'image' attribute
        self.update_image()

        ### create rect from the image attribute and
        ### position it according to the given
        ### coordinates

        self.rect = self.image.get_rect()

        setattr(self.rect, coordinates_name, coordinates_value)
Store arguments and perform setups.

        Parameters
        ==========

        value (string or tuple)
            the value stored by the widget; may represent
            one or more colors;

            here are the possible meanings of the value:
                - (1) tuple of integers: a single color
                  where each integer is in the
                  range(0, 256) interval and represent
                  the value of each of the red, green, blue
                  and, possibly, the alpha channel;
                - (2) string: a single color in the
                  '#ffffff' or '#ffffffff' format, where
                  the characters after the '#' represent
                  hexadecimal numbers, two digits for
                  each of the red, green, blue and,
                  possibly, the alpha channel;
                - (3) tuple of tuples: each item of the
                  tuple represents a color in the format
                  shown in the item (1);
                - (4) tuple of strings: each item of the
                  tuple represents a color in the format
                  shown in the item (2);
        color_format (string)
            either 'rgb_tuple', if individual colors
            must use the representation described in
            the item (1) of the 'value' parameter
            explanation above or 'hex_string', if the
            format in item (2) must be used instead;
        alone_when_single (boolean)
            when True, instead of a tuple of colors, the
            color itself is used as the value when the
            color value represents a single color (that is,
            when True, if only one color is stored, it will
            be either a string or a tuple of integers
            representing a single color, instead of a tuple
            containing such color);

            for instance, for
            color_format='hex_string' and
            alone_when_single=True, say the value of the
            button is ['#ffffff', '#00ff00aa'], if you
            go and delete any color (for instance, the
            second one), instead of ['#ffffff'] as the
            value of the button, you'll end up with
            '#ffffff' (that is, the string itself).
        width (integer)
            width available for the button.
        name (string)
            an arbitrary name to help identify the widget;
            it is assigned to the 'name' attribute.
        command (callable)
            callable to be executed whenever the value
            of the button is changed.
        coordinates_name (string)
            represents the name of a pygame.Rect attribute
            wherein to store the position information from
            the "coordinates_value" parameter.
        coordinates_value (sequence with 2 integers)
            integers represent the x and y coordinates of a
            position in 2d space, respectively.
        
nodezator/widget/colorbutton.py