def color_surf_from_size(
    size: {'widget_name': 'literal_entry', 'type': tuple} = (256, 256),
    color: {
        'widget_name': 'color_button',
        'widget_kwargs': {'color_format': 'rgb_tuple'},
        'type': (tuple, list, str, Color),
    } = (255, 0, 0),
) -> [
    {'name': 'surface', 'type': Surface},
]:
    """Return surface of given color.

    Parameters
    ==========
    size (sequence of integers)
        Size of surface to be created
    color (string or sequence of RGB(A) integers in range(256))
        If string must be the name of a color. Regardless of
        whether it is a string or sequence of integers, it must be
        accepted by pygame.Surface.fill().

        If color is a sequence of integers and has an alpha value
        (fourth value) which is less than 255, the surface is
        converted with pygame.Surface.convert_alpha(), in all other
        scenarios it is converted with pygame.Surface.convert().
    """
    surf = Surface(size)

    if not isinstance(color, str):

        try:
            alpha = color[3]

        except IndexError:
            surf = surf.convert()

        else:

            if alpha < 255:
                surf = surf.convert_alpha()
            else:
                surf = surf.convert()

    else:
        surf = surf.convert()

    surf.fill(color)

    return surf
Return surface of given color.

    Parameters
    ==========
    size (sequence of integers)
        Size of surface to be created
    color (string or sequence of RGB(A) integers in range(256))
        If string must be the name of a color. Regardless of
        whether it is a string or sequence of integers, it must be
        accepted by pygame.Surface.fill().

        If color is a sequence of integers and has an alpha value
        (fourth value) which is less than 255, the surface is
        converted with pygame.Surface.convert_alpha(), in all other
        scenarios it is converted with pygame.Surface.convert().
    
nodezator/graphman/capsulenode/pygamedefs.py