# Not all options supported in all terminals
# When in doubt use CLI.RESET to reliably clear any modifications


class CLI:
    # Basic 8/16 colors and modifiers
    # https://misc.flogisoft.com/bash/tip_colors_and_formatting
    # https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

    @staticmethod
    def from_val(value: int) -> str:
        """
        Returns the escape code for a 8/16 color id.
        """
        return f"\033[{value}m"


# region CLI Names
# Resets everything
CLI.RESET = '\033[0m'

CLI.BOLD = '\033[1m'
CLI.DARK = '\033[2m'
CLI.UNDERLINE = '\033[4m'
CLI.BLINK = '\033[5m'
CLI.REVERSE = '\033[7m'
CLI.HIDDEN = '\033[8m'
CLI.RESET_DARK = '\033[22m'
# CLI.RESET_BOLD = '\033[21m'

# Not very well documented anywhere
# Curl ran into the same issue once https://github.com/curl/curl/issues/2736
# For most cases just use RESET
CLI.RESET_BOLD = CLI.RESET_DARK
CLI.RESET_UNDERLINE = '\033[24m'
CLI.RESET_BLINK = '\033[25m'
CLI.RESET_REVERSE = '\033[27m'
CLI.RESET_HIDDEN = '\033[28m'

CLI.FG_RESET = '\033[39m'
CLI.BLACK = '\033[30m'
CLI.RED = '\033[31m'
CLI.GREEN = '\033[32m'
CLI.YELLOW = '\033[33m'
CLI.BLUE = '\033[34m'
CLI.MAGENTA = '\033[35m'
CLI.CYAN = '\033[36m'
CLI.LIGHT_GRAY = '\033[37m'
CLI.DARK_GREY = '\033[90m'
CLI.LIGHT_RED = '\033[91m'
CLI.LIGHT_GREEN = '\033[92m'
CLI.LIGHT_YELLOW = '\033[93m'
CLI.LIGHT_BLUE = '\033[94m'
CLI.LIGHT_MAGENTA = '\033[95m'
CLI.LIGHT_CYAN = '\033[96m'
CLI.WHITE = '\033[97m'

CLI.BG_RESET = '\033[49m'
CLI.BG_GREY = '\033[40m'
CLI.BG_RED = '\033[41m'
CLI.BG_GREEN = '\033[42m'
CLI.BG_YELLOW = '\033[43m'
CLI.BG_BLUE = '\033[44m'
CLI.BG_MAGENTA = '\033[45m'
CLI.BG_CYAN = '\033[46m'
CLI.BG_LIGHT_GRAY = '\033[47m'
CLI.BG_DARK_GREY = '\033[100m'
CLI.BG_LIGHT_RED = '\033[101m'
CLI.BG_LIGHT_GREEN = '\033[102m'
CLI.BG_LIGHT_YELLOW = '\033[103m'
CLI.BG_LIGHT_BLUE = '\033[104m'
CLI.BG_LIGHT_MAGENTA = '\033[105m'
CLI.BG_LIGHT_CYAN = '\033[106m'
CLI.BG_WHITE = '\033[107m'


# http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html
CLI.CLEAR_LINE = '\033[K'
CLI.CLEAR = '\033[2J'
CLI.SAVE = '\033[s'
CLI.RESTORE = '\033[u'
# endregion


# 256 Colors
class CLI256:
    @staticmethod
    def fg(value: int) -> str:
        """
        Returns the foreground escape code for a 256 color id.
        See https://jonasjacek.github.io/colors/ for full list.
        """
        return f"\033[38;5;{value}m"

    @staticmethod
    def bg(value: int) -> str:
        """
        Returns the background escape code for a 256 color id.
        See https://jonasjacek.github.io/colors/ for full list.
        """
        return f"\033[48;5;{value}m"

    @staticmethod
    def from_rgb(r: int, g: int, b: int) -> str:
        # https://stackoverflow.com/a/26665998

        if r == g and g == b:
            if r < 8:
                ansii_val = 16
            elif r > 248:
                ansii_val = 231
            else:
                ansii_val = round(((r - 8) / 247) * 24) + 232
        else:
            ansii_val = 16 \
                + (36 * round(r / 255 * 5)) \
                + (6 * round(g / 255 * 5)) \
                + round(b / 255 * 5)
        return f"\033[38;5;{ansii_val}m"


# Uses names from https://jonasjacek.github.io/colors/
# region CLI256 Names
CLI256.Black = '\033[38;5;0m'
CLI256.Maroon = '\033[38;5;1m'
CLI256.Green = '\033[38;5;2m'
CLI256.Olive = '\033[38;5;3m'
CLI256.Navy = '\033[38;5;4m'
CLI256.Purple = '\033[38;5;5m'
CLI256.Teal = '\033[38;5;6m'
CLI256.Silver = '\033[38;5;7m'
CLI256.Grey = '\033[38;5;8m'
CLI256.Red = '\033[38;5;9m'
CLI256.Lime = '\033[38;5;10m'
CLI256.Yellow = '\033[38;5;11m'
CLI256.Blue = '\033[38;5;12m'
CLI256.Fuchsia = '\033[38;5;13m'
CLI256.Aqua = '\033[38;5;14m'
CLI256.White = '\033[38;5;15m'
CLI256.Grey0 = '\033[38;5;16m'
CLI256.NavyBlue = '\033[38;5;17m'
CLI256.DarkBlue = '\033[38;5;18m'
CLI256.Blue3 = '\033[38;5;19m'
CLI256.Blue3 = '\033[38;5;20m'
CLI256.Blue1 = '\033[38;5;21m'
CLI256.DarkGreen = '\033[38;5;22m'
CLI256.DeepSkyBlue4 = '\033[38;5;23m'
CLI256.DeepSkyBlue4 = '\033[38;5;24m'
CLI256.DeepSkyBlue4 = '\033[38;5;25m'
CLI256.DodgerBlue3 = '\033[38;5;26m'
CLI256.DodgerBlue2 = '\033[38;5;27m'
CLI256.Green4 = '\033[38;5;28m'
CLI256.SpringGreen4 = '\033[38;5;29m'
CLI256.Turquoise4 = '\033[38;5;30m'
CLI256.DeepSkyBlue3 = '\033[38;5;31m'
CLI256.DeepSkyBlue3 = '\033[38;5;32m'
CLI256.DodgerBlue1 = '\033[38;5;33m'
CLI256.Green3 = '\033[38;5;34m'
CLI256.SpringGreen3 = '\033[38;5;35m'
CLI256.DarkCyan = '\033[38;5;36m'
CLI256.LightSeaGreen = '\033[38;5;37m'
CLI256.DeepSkyBlue2 = '\033[38;5;38m'
CLI256.DeepSkyBlue1 = '\033[38;5;39m'
CLI256.Green3 = '\033[38;5;40m'
CLI256.SpringGreen3 = '\033[38;5;41m'
CLI256.SpringGreen2 = '\033[38;5;42m'
CLI256.Cyan3 = '\033[38;5;43m'
CLI256.DarkTurquoise = '\033[38;5;44m'
CLI256.Turquoise2 = '\033[38;5;45m'
CLI256.Green1 = '\033[38;5;46m'
CLI256.SpringGreen2 = '\033[38;5;47m'
CLI256.SpringGreen1 = '\033[38;5;48m'
CLI256.MediumSpringGreen = '\033[38;5;49m'
CLI256.Cyan2 = '\033[38;5;50m'
CLI256.Cyan1 = '\033[38;5;51m'
CLI256.DarkRed = '\033[38;5;52m'
CLI256.DeepPink4 = '\033[38;5;53m'
CLI256.Purple4 = '\033[38;5;54m'
CLI256.Purple4 = '\033[38;5;55m'
CLI256.Purple3 = '\033[38;5;56m'
CLI256.BlueViolet = '\033[38;5;57m'
CLI256.Orange4 = '\033[38;5;58m'
CLI256.Grey37 = '\033[38;5;59m'
CLI256.MediumPurple4 = '\033[38;5;60m'
CLI256.SlateBlue3 = '\033[38;5;61m'
CLI256.SlateBlue3 = '\033[38;5;62m'
CLI256.RoyalBlue1 = '\033[38;5;63m'
CLI256.Chartreuse4 = '\033[38;5;64m'
CLI256.DarkSeaGreen4 = '\033[38;5;65m'
CLI256.PaleTurquoise4 = '\033[38;5;66m'
CLI256.SteelBlue = '\033[38;5;67m'
CLI256.SteelBlue3 = '\033[38;5;68m'
CLI256.CornflowerBlue = '\033[38;5;69m'
CLI256.Chartreuse3 = '\033[38;5;70m'
CLI256.DarkSeaGreen4 = '\033[38;5;71m'
CLI256.CadetBlue = '\033[38;5;72m'
CLI256.CadetBlue = '\033[38;5;73m'
CLI256.SkyBlue3 = '\033[38;5;74m'
CLI256.SteelBlue1 = '\033[38;5;75m'
CLI256.Chartreuse3 = '\033[38;5;76m'
CLI256.PaleGreen3 = '\033[38;5;77m'
CLI256.SeaGreen3 = '\033[38;5;78m'
CLI256.Aquamarine3 = '\033[38;5;79m'
CLI256.MediumTurquoise = '\033[38;5;80m'
CLI256.SteelBlue1 = '\033[38;5;81m'
CLI256.Chartreuse2 = '\033[38;5;82m'
CLI256.SeaGreen2 = '\033[38;5;83m'
CLI256.SeaGreen1 = '\033[38;5;84m'
CLI256.SeaGreen1 = '\033[38;5;85m'
CLI256.Aquamarine1 = '\033[38;5;86m'
CLI256.DarkSlateGray2 = '\033[38;5;87m'
CLI256.DarkRed = '\033[38;5;88m'
CLI256.DeepPink4 = '\033[38;5;89m'
CLI256.DarkMagenta = '\033[38;5;90m'
CLI256.DarkMagenta = '\033[38;5;91m'
CLI256.DarkViolet = '\033[38;5;92m'
CLI256.Purple = '\033[38;5;93m'
CLI256.Orange4 = '\033[38;5;94m'
CLI256.LightPink4 = '\033[38;5;95m'
CLI256.Plum4 = '\033[38;5;96m'
CLI256.MediumPurple3 = '\033[38;5;97m'
CLI256.MediumPurple3 = '\033[38;5;98m'
CLI256.SlateBlue1 = '\033[38;5;99m'
CLI256.Yellow4 = '\033[38;5;100m'
CLI256.Wheat4 = '\033[38;5;101m'
CLI256.Grey53 = '\033[38;5;102m'
CLI256.LightSlateGrey = '\033[38;5;103m'
CLI256.MediumPurple = '\033[38;5;104m'
CLI256.LightSlateBlue = '\033[38;5;105m'
CLI256.Yellow4 = '\033[38;5;106m'
CLI256.DarkOliveGreen3 = '\033[38;5;107m'
CLI256.DarkSeaGreen = '\033[38;5;108m'
CLI256.LightSkyBlue3 = '\033[38;5;109m'
CLI256.LightSkyBlue3 = '\033[38;5;110m'
CLI256.SkyBlue2 = '\033[38;5;111m'
CLI256.Chartreuse2 = '\033[38;5;112m'
CLI256.DarkOliveGreen3 = '\033[38;5;113m'
CLI256.PaleGreen3 = '\033[38;5;114m'
CLI256.DarkSeaGreen3 = '\033[38;5;115m'
CLI256.DarkSlateGray3 = '\033[38;5;116m'
CLI256.SkyBlue1 = '\033[38;5;117m'
CLI256.Chartreuse1 = '\033[38;5;118m'
CLI256.LightGreen = '\033[38;5;119m'
CLI256.LightGreen = '\033[38;5;120m'
CLI256.PaleGreen1 = '\033[38;5;121m'
CLI256.Aquamarine1 = '\033[38;5;122m'
CLI256.DarkSlateGray1 = '\033[38;5;123m'
CLI256.Red3 = '\033[38;5;124m'
CLI256.DeepPink4 = '\033[38;5;125m'
CLI256.MediumVioletRed = '\033[38;5;126m'
CLI256.Magenta3 = '\033[38;5;127m'
CLI256.DarkViolet = '\033[38;5;128m'
CLI256.Purple = '\033[38;5;129m'
CLI256.DarkOrange3 = '\033[38;5;130m'
CLI256.IndianRed = '\033[38;5;131m'
CLI256.HotPink3 = '\033[38;5;132m'
CLI256.MediumOrchid3 = '\033[38;5;133m'
CLI256.MediumOrchid = '\033[38;5;134m'
CLI256.MediumPurple2 = '\033[38;5;135m'
CLI256.DarkGoldenrod = '\033[38;5;136m'
CLI256.LightSalmon3 = '\033[38;5;137m'
CLI256.RosyBrown = '\033[38;5;138m'
CLI256.Grey63 = '\033[38;5;139m'
CLI256.MediumPurple2 = '\033[38;5;140m'
CLI256.MediumPurple1 = '\033[38;5;141m'
CLI256.Gold3 = '\033[38;5;142m'
CLI256.DarkKhaki = '\033[38;5;143m'
CLI256.NavajoWhite3 = '\033[38;5;144m'
CLI256.Grey69 = '\033[38;5;145m'
CLI256.LightSteelBlue3 = '\033[38;5;146m'
CLI256.LightSteelBlue = '\033[38;5;147m'
CLI256.Yellow3 = '\033[38;5;148m'
CLI256.DarkOliveGreen3 = '\033[38;5;149m'
CLI256.DarkSeaGreen3 = '\033[38;5;150m'
CLI256.DarkSeaGreen2 = '\033[38;5;151m'
CLI256.LightCyan3 = '\033[38;5;152m'
CLI256.LightSkyBlue1 = '\033[38;5;153m'
CLI256.GreenYellow = '\033[38;5;154m'
CLI256.DarkOliveGreen2 = '\033[38;5;155m'
CLI256.PaleGreen1 = '\033[38;5;156m'
CLI256.DarkSeaGreen2 = '\033[38;5;157m'
CLI256.DarkSeaGreen1 = '\033[38;5;158m'
CLI256.PaleTurquoise1 = '\033[38;5;159m'
CLI256.Red3 = '\033[38;5;160m'
CLI256.DeepPink3 = '\033[38;5;161m'
CLI256.DeepPink3 = '\033[38;5;162m'
CLI256.Magenta3 = '\033[38;5;163m'
CLI256.Magenta3 = '\033[38;5;164m'
CLI256.Magenta2 = '\033[38;5;165m'
CLI256.DarkOrange3 = '\033[38;5;166m'
CLI256.IndianRed = '\033[38;5;167m'
CLI256.HotPink3 = '\033[38;5;168m'
CLI256.HotPink2 = '\033[38;5;169m'
CLI256.Orchid = '\033[38;5;170m'
CLI256.MediumOrchid1 = '\033[38;5;171m'
CLI256.Orange3 = '\033[38;5;172m'
CLI256.LightSalmon3 = '\033[38;5;173m'
CLI256.LightPink3 = '\033[38;5;174m'
CLI256.Pink3 = '\033[38;5;175m'
CLI256.Plum3 = '\033[38;5;176m'
CLI256.Violet = '\033[38;5;177m'
CLI256.Gold3 = '\033[38;5;178m'
CLI256.LightGoldenrod3 = '\033[38;5;179m'
CLI256.Tan = '\033[38;5;180m'
CLI256.MistyRose3 = '\033[38;5;181m'
CLI256.Thistle3 = '\033[38;5;182m'
CLI256.Plum2 = '\033[38;5;183m'
CLI256.Yellow3 = '\033[38;5;184m'
CLI256.Khaki3 = '\033[38;5;185m'
CLI256.LightGoldenrod2 = '\033[38;5;186m'
CLI256.LightYellow3 = '\033[38;5;187m'
CLI256.Grey84 = '\033[38;5;188m'
CLI256.LightSteelBlue1 = '\033[38;5;189m'
CLI256.Yellow2 = '\033[38;5;190m'
CLI256.DarkOliveGreen1 = '\033[38;5;191m'
CLI256.DarkOliveGreen1 = '\033[38;5;192m'
CLI256.DarkSeaGreen1 = '\033[38;5;193m'
CLI256.Honeydew2 = '\033[38;5;194m'
CLI256.LightCyan1 = '\033[38;5;195m'
CLI256.Red1 = '\033[38;5;196m'
CLI256.DeepPink2 = '\033[38;5;197m'
CLI256.DeepPink1 = '\033[38;5;198m'
CLI256.DeepPink1 = '\033[38;5;199m'
CLI256.Magenta2 = '\033[38;5;200m'
CLI256.Magenta1 = '\033[38;5;201m'
CLI256.OrangeRed1 = '\033[38;5;202m'
CLI256.IndianRed1 = '\033[38;5;203m'
CLI256.IndianRed1 = '\033[38;5;204m'
CLI256.HotPink = '\033[38;5;205m'
CLI256.HotPink = '\033[38;5;206m'
CLI256.MediumOrchid1 = '\033[38;5;207m'
CLI256.DarkOrange = '\033[38;5;208m'
CLI256.Salmon1 = '\033[38;5;209m'
CLI256.LightCoral = '\033[38;5;210m'
CLI256.PaleVioletRed1 = '\033[38;5;211m'
CLI256.Orchid2 = '\033[38;5;212m'
CLI256.Orchid1 = '\033[38;5;213m'
CLI256.Orange1 = '\033[38;5;214m'
CLI256.SandyBrown = '\033[38;5;215m'
CLI256.LightSalmon1 = '\033[38;5;216m'
CLI256.LightPink1 = '\033[38;5;217m'
CLI256.Pink1 = '\033[38;5;218m'
CLI256.Plum1 = '\033[38;5;219m'
CLI256.Gold1 = '\033[38;5;220m'
CLI256.LightGoldenrod2 = '\033[38;5;221m'
CLI256.LightGoldenrod2 = '\033[38;5;222m'
CLI256.NavajoWhite1 = '\033[38;5;223m'
CLI256.MistyRose1 = '\033[38;5;224m'
CLI256.Thistle1 = '\033[38;5;225m'
CLI256.Yellow1 = '\033[38;5;226m'
CLI256.LightGoldenrod1 = '\033[38;5;227m'
CLI256.Khaki1 = '\033[38;5;228m'
CLI256.Wheat1 = '\033[38;5;229m'
CLI256.Cornsilk1 = '\033[38;5;230m'
CLI256.Grey100 = '\033[38;5;231m'
CLI256.Grey3 = '\033[38;5;232m'
CLI256.Grey7 = '\033[38;5;233m'
CLI256.Grey11 = '\033[38;5;234m'
CLI256.Grey15 = '\033[38;5;235m'
CLI256.Grey19 = '\033[38;5;236m'
CLI256.Grey23 = '\033[38;5;237m'
CLI256.Grey27 = '\033[38;5;238m'
CLI256.Grey30 = '\033[38;5;239m'
CLI256.Grey35 = '\033[38;5;240m'
CLI256.Grey39 = '\033[38;5;241m'
CLI256.Grey42 = '\033[38;5;242m'
CLI256.Grey46 = '\033[38;5;243m'
CLI256.Grey50 = '\033[38;5;244m'
CLI256.Grey54 = '\033[38;5;245m'
CLI256.Grey58 = '\033[38;5;246m'
CLI256.Grey62 = '\033[38;5;247m'
CLI256.Grey66 = '\033[38;5;248m'
CLI256.Grey70 = '\033[38;5;249m'
CLI256.Grey74 = '\033[38;5;250m'
CLI256.Grey78 = '\033[38;5;251m'
CLI256.Grey82 = '\033[38;5;252m'
CLI256.Grey85 = '\033[38;5;253m'
CLI256.Grey89 = '\033[38;5;254m'
CLI256.Grey93 = '\033[38;5;255m'

CLI256.BG_Black = '\033[48;5;0m'
CLI256.BG_Maroon = '\033[48;5;1m'
CLI256.BG_Green = '\033[48;5;2m'
CLI256.BG_Olive = '\033[48;5;3m'
CLI256.BG_Navy = '\033[48;5;4m'
CLI256.BG_Purple = '\033[48;5;5m'
CLI256.BG_Teal = '\033[48;5;6m'
CLI256.BG_Silver = '\033[48;5;7m'
CLI256.BG_Grey = '\033[48;5;8m'
CLI256.BG_Red = '\033[48;5;9m'
CLI256.BG_Lime = '\033[48;5;10m'
CLI256.BG_Yellow = '\033[48;5;11m'
CLI256.BG_Blue = '\033[48;5;12m'
CLI256.BG_Fuchsia = '\033[48;5;13m'
CLI256.BG_Aqua = '\033[48;5;14m'
CLI256.BG_White = '\033[48;5;15m'
CLI256.BG_Grey0 = '\033[48;5;16m'
CLI256.BG_NavyBlue = '\033[48;5;17m'
CLI256.BG_DarkBlue = '\033[48;5;18m'
CLI256.BG_Blue3 = '\033[48;5;19m'
CLI256.BG_Blue3 = '\033[48;5;20m'
CLI256.BG_Blue1 = '\033[48;5;21m'
CLI256.BG_DarkGreen = '\033[48;5;22m'
CLI256.BG_DeepSkyBlue4 = '\033[48;5;23m'
CLI256.BG_DeepSkyBlue4 = '\033[48;5;24m'
CLI256.BG_DeepSkyBlue4 = '\033[48;5;25m'
CLI256.BG_DodgerBlue3 = '\033[48;5;26m'
CLI256.BG_DodgerBlue2 = '\033[48;5;27m'
CLI256.BG_Green4 = '\033[48;5;28m'
CLI256.BG_SpringGreen4 = '\033[48;5;29m'
CLI256.BG_Turquoise4 = '\033[48;5;30m'
CLI256.BG_DeepSkyBlue3 = '\033[48;5;31m'
CLI256.BG_DeepSkyBlue3 = '\033[48;5;32m'
CLI256.BG_DodgerBlue1 = '\033[48;5;33m'
CLI256.BG_Green3 = '\033[48;5;34m'
CLI256.BG_SpringGreen3 = '\033[48;5;35m'
CLI256.BG_DarkCyan = '\033[48;5;36m'
CLI256.BG_LightSeaGreen = '\033[48;5;37m'
CLI256.BG_DeepSkyBlue2 = '\033[48;5;38m'
CLI256.BG_DeepSkyBlue1 = '\033[48;5;39m'
CLI256.BG_Green3 = '\033[48;5;40m'
CLI256.BG_SpringGreen3 = '\033[48;5;41m'
CLI256.BG_SpringGreen2 = '\033[48;5;42m'
CLI256.BG_Cyan3 = '\033[48;5;43m'
CLI256.BG_DarkTurquoise = '\033[48;5;44m'
CLI256.BG_Turquoise2 = '\033[48;5;45m'
CLI256.BG_Green1 = '\033[48;5;46m'
CLI256.BG_SpringGreen2 = '\033[48;5;47m'
CLI256.BG_SpringGreen1 = '\033[48;5;48m'
CLI256.BG_MediumSpringGreen = '\033[48;5;49m'
CLI256.BG_Cyan2 = '\033[48;5;50m'
CLI256.BG_Cyan1 = '\033[48;5;51m'
CLI256.BG_DarkRed = '\033[48;5;52m'
CLI256.BG_DeepPink4 = '\033[48;5;53m'
CLI256.BG_Purple4 = '\033[48;5;54m'
CLI256.BG_Purple4 = '\033[48;5;55m'
CLI256.BG_Purple3 = '\033[48;5;56m'
CLI256.BG_BlueViolet = '\033[48;5;57m'
CLI256.BG_Orange4 = '\033[48;5;58m'
CLI256.BG_Grey37 = '\033[48;5;59m'
CLI256.BG_MediumPurple4 = '\033[48;5;60m'
CLI256.BG_SlateBlue3 = '\033[48;5;61m'
CLI256.BG_SlateBlue3 = '\033[48;5;62m'
CLI256.BG_RoyalBlue1 = '\033[48;5;63m'
CLI256.BG_Chartreuse4 = '\033[48;5;64m'
CLI256.BG_DarkSeaGreen4 = '\033[48;5;65m'
CLI256.BG_PaleTurquoise4 = '\033[48;5;66m'
CLI256.BG_SteelBlue = '\033[48;5;67m'
CLI256.BG_SteelBlue3 = '\033[48;5;68m'
CLI256.BG_CornflowerBlue = '\033[48;5;69m'
CLI256.BG_Chartreuse3 = '\033[48;5;70m'
CLI256.BG_DarkSeaGreen4 = '\033[48;5;71m'
CLI256.BG_CadetBlue = '\033[48;5;72m'
CLI256.BG_CadetBlue = '\033[48;5;73m'
CLI256.BG_SkyBlue3 = '\033[48;5;74m'
CLI256.BG_SteelBlue1 = '\033[48;5;75m'
CLI256.BG_Chartreuse3 = '\033[48;5;76m'
CLI256.BG_PaleGreen3 = '\033[48;5;77m'
CLI256.BG_SeaGreen3 = '\033[48;5;78m'
CLI256.BG_Aquamarine3 = '\033[48;5;79m'
CLI256.BG_MediumTurquoise = '\033[48;5;80m'
CLI256.BG_SteelBlue1 = '\033[48;5;81m'
CLI256.BG_Chartreuse2 = '\033[48;5;82m'
CLI256.BG_SeaGreen2 = '\033[48;5;83m'
CLI256.BG_SeaGreen1 = '\033[48;5;84m'
CLI256.BG_SeaGreen1 = '\033[48;5;85m'
CLI256.BG_Aquamarine1 = '\033[48;5;86m'
CLI256.BG_DarkSlateGray2 = '\033[48;5;87m'
CLI256.BG_DarkRed = '\033[48;5;88m'
CLI256.BG_DeepPink4 = '\033[48;5;89m'
CLI256.BG_DarkMagenta = '\033[48;5;90m'
CLI256.BG_DarkMagenta = '\033[48;5;91m'
CLI256.BG_DarkViolet = '\033[48;5;92m'
CLI256.BG_Purple = '\033[48;5;93m'
CLI256.BG_Orange4 = '\033[48;5;94m'
CLI256.BG_LightPink4 = '\033[48;5;95m'
CLI256.BG_Plum4 = '\033[48;5;96m'
CLI256.BG_MediumPurple3 = '\033[48;5;97m'
CLI256.BG_MediumPurple3 = '\033[48;5;98m'
CLI256.BG_SlateBlue1 = '\033[48;5;99m'
CLI256.BG_Yellow4 = '\033[48;5;100m'
CLI256.BG_Wheat4 = '\033[48;5;101m'
CLI256.BG_Grey53 = '\033[48;5;102m'
CLI256.BG_LightSlateGrey = '\033[48;5;103m'
CLI256.BG_MediumPurple = '\033[48;5;104m'
CLI256.BG_LightSlateBlue = '\033[48;5;105m'
CLI256.BG_Yellow4 = '\033[48;5;106m'
CLI256.BG_DarkOliveGreen3 = '\033[48;5;107m'
CLI256.BG_DarkSeaGreen = '\033[48;5;108m'
CLI256.BG_LightSkyBlue3 = '\033[48;5;109m'
CLI256.BG_LightSkyBlue3 = '\033[48;5;110m'
CLI256.BG_SkyBlue2 = '\033[48;5;111m'
CLI256.BG_Chartreuse2 = '\033[48;5;112m'
CLI256.BG_DarkOliveGreen3 = '\033[48;5;113m'
CLI256.BG_PaleGreen3 = '\033[48;5;114m'
CLI256.BG_DarkSeaGreen3 = '\033[48;5;115m'
CLI256.BG_DarkSlateGray3 = '\033[48;5;116m'
CLI256.BG_SkyBlue1 = '\033[48;5;117m'
CLI256.BG_Chartreuse1 = '\033[48;5;118m'
CLI256.BG_LightGreen = '\033[48;5;119m'
CLI256.BG_LightGreen = '\033[48;5;120m'
CLI256.BG_PaleGreen1 = '\033[48;5;121m'
CLI256.BG_Aquamarine1 = '\033[48;5;122m'
CLI256.BG_DarkSlateGray1 = '\033[48;5;123m'
CLI256.BG_Red3 = '\033[48;5;124m'
CLI256.BG_DeepPink4 = '\033[48;5;125m'
CLI256.BG_MediumVioletRed = '\033[48;5;126m'
CLI256.BG_Magenta3 = '\033[48;5;127m'
CLI256.BG_DarkViolet = '\033[48;5;128m'
CLI256.BG_Purple = '\033[48;5;129m'
CLI256.BG_DarkOrange3 = '\033[48;5;130m'
CLI256.BG_IndianRed = '\033[48;5;131m'
CLI256.BG_HotPink3 = '\033[48;5;132m'
CLI256.BG_MediumOrchid3 = '\033[48;5;133m'
CLI256.BG_MediumOrchid = '\033[48;5;134m'
CLI256.BG_MediumPurple2 = '\033[48;5;135m'
CLI256.BG_DarkGoldenrod = '\033[48;5;136m'
CLI256.BG_LightSalmon3 = '\033[48;5;137m'
CLI256.BG_RosyBrown = '\033[48;5;138m'
CLI256.BG_Grey63 = '\033[48;5;139m'
CLI256.BG_MediumPurple2 = '\033[48;5;140m'
CLI256.BG_MediumPurple1 = '\033[48;5;141m'
CLI256.BG_Gold3 = '\033[48;5;142m'
CLI256.BG_DarkKhaki = '\033[48;5;143m'
CLI256.BG_NavajoWhite3 = '\033[48;5;144m'
CLI256.BG_Grey69 = '\033[48;5;145m'
CLI256.BG_LightSteelBlue3 = '\033[48;5;146m'
CLI256.BG_LightSteelBlue = '\033[48;5;147m'
CLI256.BG_Yellow3 = '\033[48;5;148m'
CLI256.BG_DarkOliveGreen3 = '\033[48;5;149m'
CLI256.BG_DarkSeaGreen3 = '\033[48;5;150m'
CLI256.BG_DarkSeaGreen2 = '\033[48;5;151m'
CLI256.BG_LightCyan3 = '\033[48;5;152m'
CLI256.BG_LightSkyBlue1 = '\033[48;5;153m'
CLI256.BG_GreenYellow = '\033[48;5;154m'
CLI256.BG_DarkOliveGreen2 = '\033[48;5;155m'
CLI256.BG_PaleGreen1 = '\033[48;5;156m'
CLI256.BG_DarkSeaGreen2 = '\033[48;5;157m'
CLI256.BG_DarkSeaGreen1 = '\033[48;5;158m'
CLI256.BG_PaleTurquoise1 = '\033[48;5;159m'
CLI256.BG_Red3 = '\033[48;5;160m'
CLI256.BG_DeepPink3 = '\033[48;5;161m'
CLI256.BG_DeepPink3 = '\033[48;5;162m'
CLI256.BG_Magenta3 = '\033[48;5;163m'
CLI256.BG_Magenta3 = '\033[48;5;164m'
CLI256.BG_Magenta2 = '\033[48;5;165m'
CLI256.BG_DarkOrange3 = '\033[48;5;166m'
CLI256.BG_IndianRed = '\033[48;5;167m'
CLI256.BG_HotPink3 = '\033[48;5;168m'
CLI256.BG_HotPink2 = '\033[48;5;169m'
CLI256.BG_Orchid = '\033[48;5;170m'
CLI256.BG_MediumOrchid1 = '\033[48;5;171m'
CLI256.BG_Orange3 = '\033[48;5;172m'
CLI256.BG_LightSalmon3 = '\033[48;5;173m'
CLI256.BG_LightPink3 = '\033[48;5;174m'
CLI256.BG_Pink3 = '\033[48;5;175m'
CLI256.BG_Plum3 = '\033[48;5;176m'
CLI256.BG_Violet = '\033[48;5;177m'
CLI256.BG_Gold3 = '\033[48;5;178m'
CLI256.BG_LightGoldenrod3 = '\033[48;5;179m'
CLI256.BG_Tan = '\033[48;5;180m'
CLI256.BG_MistyRose3 = '\033[48;5;181m'
CLI256.BG_Thistle3 = '\033[48;5;182m'
CLI256.BG_Plum2 = '\033[48;5;183m'
CLI256.BG_Yellow3 = '\033[48;5;184m'
CLI256.BG_Khaki3 = '\033[48;5;185m'
CLI256.BG_LightGoldenrod2 = '\033[48;5;186m'
CLI256.BG_LightYellow3 = '\033[48;5;187m'
CLI256.BG_Grey84 = '\033[48;5;188m'
CLI256.BG_LightSteelBlue1 = '\033[48;5;189m'
CLI256.BG_Yellow2 = '\033[48;5;190m'
CLI256.BG_DarkOliveGreen1 = '\033[48;5;191m'
CLI256.BG_DarkOliveGreen1 = '\033[48;5;192m'
CLI256.BG_DarkSeaGreen1 = '\033[48;5;193m'
CLI256.BG_Honeydew2 = '\033[48;5;194m'
CLI256.BG_LightCyan1 = '\033[48;5;195m'
CLI256.BG_Red1 = '\033[48;5;196m'
CLI256.BG_DeepPink2 = '\033[48;5;197m'
CLI256.BG_DeepPink1 = '\033[48;5;198m'
CLI256.BG_DeepPink1 = '\033[48;5;199m'
CLI256.BG_Magenta2 = '\033[48;5;200m'
CLI256.BG_Magenta1 = '\033[48;5;201m'
CLI256.BG_OrangeRed1 = '\033[48;5;202m'
CLI256.BG_IndianRed1 = '\033[48;5;203m'
CLI256.BG_IndianRed1 = '\033[48;5;204m'
CLI256.BG_HotPink = '\033[48;5;205m'
CLI256.BG_HotPink = '\033[48;5;206m'
CLI256.BG_MediumOrchid1 = '\033[48;5;207m'
CLI256.BG_DarkOrange = '\033[48;5;208m'
CLI256.BG_Salmon1 = '\033[48;5;209m'
CLI256.BG_LightCoral = '\033[48;5;210m'
CLI256.BG_PaleVioletRed1 = '\033[48;5;211m'
CLI256.BG_Orchid2 = '\033[48;5;212m'
CLI256.BG_Orchid1 = '\033[48;5;213m'
CLI256.BG_Orange1 = '\033[48;5;214m'
CLI256.BG_SandyBrown = '\033[48;5;215m'
CLI256.BG_LightSalmon1 = '\033[48;5;216m'
CLI256.BG_LightPink1 = '\033[48;5;217m'
CLI256.BG_Pink1 = '\033[48;5;218m'
CLI256.BG_Plum1 = '\033[48;5;219m'
CLI256.BG_Gold1 = '\033[48;5;220m'
CLI256.BG_LightGoldenrod2 = '\033[48;5;221m'
CLI256.BG_LightGoldenrod2 = '\033[48;5;222m'
CLI256.BG_NavajoWhite1 = '\033[48;5;223m'
CLI256.BG_MistyRose1 = '\033[48;5;224m'
CLI256.BG_Thistle1 = '\033[48;5;225m'
CLI256.BG_Yellow1 = '\033[48;5;226m'
CLI256.BG_LightGoldenrod1 = '\033[48;5;227m'
CLI256.BG_Khaki1 = '\033[48;5;228m'
CLI256.BG_Wheat1 = '\033[48;5;229m'
CLI256.BG_Cornsilk1 = '\033[48;5;230m'
CLI256.BG_Grey100 = '\033[48;5;231m'
CLI256.BG_Grey3 = '\033[48;5;232m'
CLI256.BG_Grey7 = '\033[48;5;233m'
CLI256.BG_Grey11 = '\033[48;5;234m'
CLI256.BG_Grey15 = '\033[48;5;235m'
CLI256.BG_Grey19 = '\033[48;5;236m'
CLI256.BG_Grey23 = '\033[48;5;237m'
CLI256.BG_Grey27 = '\033[48;5;238m'
CLI256.BG_Grey30 = '\033[48;5;239m'
CLI256.BG_Grey35 = '\033[48;5;240m'
CLI256.BG_Grey39 = '\033[48;5;241m'
CLI256.BG_Grey42 = '\033[48;5;242m'
CLI256.BG_Grey46 = '\033[48;5;243m'
CLI256.BG_Grey50 = '\033[48;5;244m'
CLI256.BG_Grey54 = '\033[48;5;245m'
CLI256.BG_Grey58 = '\033[48;5;246m'
CLI256.BG_Grey62 = '\033[48;5;247m'
CLI256.BG_Grey66 = '\033[48;5;248m'
CLI256.BG_Grey70 = '\033[48;5;249m'
CLI256.BG_Grey74 = '\033[48;5;250m'
CLI256.BG_Grey78 = '\033[48;5;251m'
CLI256.BG_Grey82 = '\033[48;5;252m'
CLI256.BG_Grey85 = '\033[48;5;253m'
CLI256.BG_Grey89 = '\033[48;5;254m'
CLI256.BG_Grey93 = '\033[48;5;255m'
# endregion


# Truecolor
# https://gist.github.com/XVilka/8346728
class CLIT:
    @staticmethod
    def fg(r: int, g: int, b: int) -> str:
        """
        Returns the foreground escape code for an rgb truecolor.
        """
        return f"\033[38;2;{r};{g};{b}m"

    @staticmethod
    def bg(r: int, g: int, b: int) -> str:
        """
        Returns the background escape code for an rgb truecolor.
        """
        return f"\033[48;2;{r};{g};{b}m"
