def update_from_name_entry(
        self,
        entry_attr_name,
        color_map,
    ):
        """Update color value from name entry.

        Or, if the name in the entry is 'unamed', set
        back the actual name of the color, if it has one.
        """
        ### reference entry locally
        entry = getattr(self, entry_attr_name)

        ### get name from entry
        color_name = entry.get()

        ### if color name is 'unamed', we return earlier,
        ### since it doesn't point to any known color;
        ###
        ### however, before doing so, we also check whether
        ### the current color actually has a name, in which
        ### case we change the name in the entry to that
        ### name, since it wouldn't be right to leave
        ### 'unamed' in the entry when the current color
        ### actually has a name

        if color_name == "unamed":

            ## obtain a tuple with the 3 first values of
            ## the current color

            current_color = tuple(self.colors_panel.get_current_color()[:3])

            ## iterate over each item of the color map

            for name, color in color_map.items():

                ## if the current color has the same value
                ## as one of the color from the map, then
                ## the color actually has a name, which is
                ## the one store in the 'name' variable,
                ## so set such name as the text of the
                ## entry and break out of the "for loop"

                if current_color == color:

                    ## we use False as the second argument
                    ## so the change doesn't unnecessarily
                    ## triggers the update command of the
                    ## entry
                    entry.set(name, False)

                    break

            ## finally return
            return

        ### otherwise, retrieve the color from the
        ### corresponding map using the color name as the
        ### key, converting it to a new list
        color = list(color_map[color_name])

        ### if the alpha is supposed to be used, retrieve
        ### it from the entry and append it to the color
        if self.alpha_checkbutton.get():
            color.append(self.entry_map["alpha"].get())

        ### finally, set the color on the controls
        self.set_color_on_controls(color)
Update color value from name entry.

        Or, if the name in the entry is 'unamed', set
        back the actual name of the color, if it has one.
        
nodezator/colorsman/editor/widgetop.py