kyanit.colorid module
This module publishes two helper functions to work with Color IDs.
See the function documentations for details on usage.
Functions
def from_number(num)-
Calculate a Color ID string from a number passed to
num. Ifnumis negative or larger than 342,ValueErrorwill be raised. The Color ID is used for representing the last octet of an IP address, so any value above 245 is probably also not valid, but 342 is the maximum number that can be represented with the 7 available color symbols.If
numis notint,TypeErrorwill be raised. def to_colors(color_id)-
Return a list with 3 RGB color tuples corresponding to the
color_id. Thecolor_idmust be a string with 3 upper-case characters, which can be any of 'R', 'G', 'B', 'C', 'M', 'Y', or 'W' (white).If the
color_idis a longer string, subsequent characters are disregarded. If the first 3 characters are not one of the above list,IndexErrorwill be raised.color_idmay also be any other indexable type, but ifcolor_idis not indexable,TypeErrorwill be raised.