def draw_border_on_surf(
    surface: Surface,
    color: {
        'widget_name': 'color_button',
        'widget_kwargs': {'color_format': 'rgb_tuple'},
        'type': (tuple, list, str, Color),
    } = (0, 0, 0),
    thickness: 'positive_integer' = 1,
) -> [
    {'name': 'surface', 'type': Surface},
]:
    """Draw border on surface edges and return surface."""

    ### fill only border areas

    rect = surface.get_rect()

    for border_rect in (

        # top border
        (*rect.topleft, rect.width, thickness),

        # bottom border
        (*rect.move(0, -thickness).bottomleft,
        rect.width, thickness),

        # left border
        (*rect.move(0, thickness).topleft,
        thickness, rect.height - (thickness*2)),

        # right border
        (*rect.move(-thickness, thickness).topright,
        thickness, rect.height - (thickness*2)),

    ):
        surface.fill(color, border_rect)


    ### return surface
    return surface
Draw border on surface edges and return surface.
nodezator/graphman/capsulenode/pygamedefs.py