def scroll_color_list(self, amount):
        """Scroll widgets representing the list of colors.

        The way this method works makes it so the widgets
        return the their initial position if there's no
        widget out of the boundaries of the color list
        background object.

        This way the widgets or at least part of it are
        always visible.
        """
        ### XXX rect for boundary checking below should
        ### probably be stored, instead of being created
        ### every time we scroll

        ### define rect used for boundary checking
        bg_rect = self.color_list_bg.rect.inflate(0, -20)

        ### retrieve rect used to read and control the
        ### position of widgets
        objs_rect = self.color_list_objs.rect

        ### move widgets
        objs_rect.move_ip(0, amount)

        ### if scrolling up, don't allow the top of widgets
        ### to go above the top of the background area

        if amount > 0:

            ## if the top of widgets goes above the top
            ## of the background, set the top of the widgets
            ## to the top of the background
            if objs_rect.top > bg_rect.top:
                objs_rect.top = bg_rect.top

        ### if scrolling down, don't allow the bottom of
        ### widgets to go below the bottom of the background
        ### area

        elif amount < 0:

            ## if the bottom of widgets goes below the
            ## bottom of the background, set the bottom of
            ## the widgets to the bottom of the background

            if objs_rect.bottom < bg_rect.bottom:
                objs_rect.bottom = bg_rect.bottom
Scroll widgets representing the list of colors.

        The way this method works makes it so the widgets
        return the their initial position if there's no
        widget out of the boundaries of the color list
        background object.

        This way the widgets or at least part of it are
        always visible.
        
nodezator/colorsman/viewer/modes/colorlist.py