# Path: colr/codes.py
# def _build_code_nums() -> Dict[str, Dict[str, int]]:
# def _build_code_nums_reverse() -> Dict[str, Dict[int, str]]:
# def _build_codes() -> Dict[str, Dict[str, str]]:
# def _build_codes_reverse(
#         codes: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]:
# def _add_alias_names(d: Dict[str, Dict[str, str]]) -> None:
# 
# Path: colr/name_data.py
# def create_term_name_c_array(name=None):
# def create_name_data_c_array(
#         name=None, struct=None, no_members=False, no_hex=False):
#     def create_elem_def(knownname, info):
#     def create_full_elem_def(knownname, info):
# def get_x11_rgb(fix_names=False):


import re
    import sys
from types import GeneratorType
from typing import (
    Any,
    Optional,
    Tuple,
    Union,
    cast,
)
from .codes import (
    code_nums,
    code_nums_reverse,
)
from .name_data import names as name_data
        c._init_code(code)
        return c

    @classmethod
    def from_hex(cls, hexval: str) -> 'ColorCode':
        """ Return a ColorCode from a hex string. """
        c = cls()
        c._init_hex(hexval)
        return c

    @classmethod
    def from_name(cls, name: str) -> 'ColorCode':
        """ Return a ColorCode from a known name. """
        c = cls()
        c._init_name(name)
        return c

    @classmethod
    def from_rgb(cls, r: int, g: int, b: int) -> 'ColorCode':
        """ Return a ColorCode from a RGB tuple. """
        c = cls()
        c._init_rgb(r, g, b)
        return c

    @staticmethod
    def get_name_by_code(code: str) -> Optional[str]:
        coden = int(code)
        # Test basic fore code (30-37, 90-97).
        if coden < 8:
            coden += 30

# Path: colr/codes.py
# def _build_code_nums() -> Dict[str, Dict[str, int]]:
# def _build_code_nums_reverse() -> Dict[str, Dict[int, str]]:
# def _build_codes() -> Dict[str, Dict[str, str]]:
# def _build_codes_reverse(
#         codes: Dict[str, Dict[str, str]]) -> Dict[str, Dict[str, str]]:
# def _add_alias_names(d: Dict[str, Dict[str, str]]) -> None:
# 
# Path: colr/name_data.py
# def create_term_name_c_array(name=None):
# def create_name_data_c_array(
#         name=None, struct=None, no_members=False, no_hex=False):
#     def create_elem_def(knownname, info):
#     def create_full_elem_def(knownname, info):
# def get_x11_rgb(fix_names=False):


# Path: colr/trans.py
import re
    import sys
from types import GeneratorType
from typing import (
    Any,
    Optional,
    Tuple,
    Union,
    cast,
)
from .codes import (
    code_nums,
    code_nums_reverse,
)
from .name_data import names as name_data

        c._init_code(code)
        return c

    @classmethod
    def from_hex(cls, hexval: str) -> 'ColorCode':
        """ Return a ColorCode from a hex string. """
        c = cls()
        c._init_hex(hexval)
        return c

    @classmethod
    def from_name(cls, name: str) -> 'ColorCode':
        """ Return a ColorCode from a known name. """
        c = cls()
        c._init_name(name)
        return c

    @classmethod
    def from_rgb(cls, r: int, g: int, b: int) -> 'ColorCode':
        """ Return a ColorCode from a RGB tuple. """
        c = cls()
        c._init_rgb(r, g, b)
        return c

    @staticmethod
    def get_name_by_code(code: str) -> Optional[str]:
        coden = int(code)
        # Test basic fore code (30-37, 90-97).
        if coden < 8:
            coden += 30

            name = code_nums_reverse['fore'].get(coden, None)