def _set_values()

in scripts/awsicons/icon.py [0:0]


    def _set_values(self, source_name, source_category):
        """Set values if entry found in the config.yml file, otherwise set uncategorized and defaults"""
        for i in self.config["Categories"]:
            for j in self.config["Categories"][i]["Icons"]:
                if j["Source"] == source_name and i == source_category:
                    try:
                        self.category = i
                        self.target = j["Target"]

                        # Set color from icon, category, default then black
                        if "Color" in j:
                            self.color = self._color_name(j["Color"])
                        # check category
                        elif "Color" in self.config["Categories"][i]:
                            self.color = self._color_name(
                                self.config["Categories"][i]["Color"]
                            )
                        elif "Color" in self.config["Defaults"]["Category"]:
                            self.color = self._color_name(
                                self.config["Defaults"]["Category"]["Color"]
                            )
                        else:
                            print(
                                f"No color definition found for {source_name}, using black"
                            )
                            self.color = "#000000"
                        return
                    except KeyError as e:
                        print(f"Error: {e}")
                        print(
                            "config.yml requires minimal config section, please see documentation"
                        )
                        sys.exit(1)
                    except TypeError as e:
                        print(f"Error: {e}")
                        print(
                            "config.yml requires Defaults->Color definition, please see documentation"
                        )
                        sys.exit(1)

        # Entry not found, place into uncategorized
        try:
            self.category = "Uncategorized"
            self.target = self._make_name(
                regex=self.filename_regex,
                filename=str(self.filename),
                mappings=self.filename_mappings,
            )
            self.color = self.config["Defaults"]["Category"]["Color"]
        except KeyError as e:
            print(f"Error: {e}")
            print(
                "config.yml requires minimal config section, please see documentation"
            )
            sys.exit(1)