Beispiel #1
0
    class Fore(object):
        """Color constants for the foreground"""

        # For individually setting a RGB field
        SET_RED = chr(27) + 'FSR'
        SET_GREEN = chr(27) + 'FSG'
        SET_BLUE = chr(27) + 'FSB'
        SET_BRIGHT = chr(27) + 'FSX'

        # For individually clearing a RGB field
        CLEAR_RED = chr(27) + 'FCR'
        CLEAR_GREEN = chr(27) + 'FCG'
        CLEAR_BLUE = chr(27) + 'FCB'
        CLEAR_BRIGHT = chr(27) + 'FCX'

        # For individually toggling a RGB field
        TOGGLE_RED = chr(27) + 'FTR'
        TOGGLE_GREEN = chr(27) + 'FTG'
        TOGGLE_BLUE = chr(27) + 'FTB'
        TOGGLE_BRIGHT = chr(27) + 'FTX'

        # Standard colors defined as combinations of the RGB constants
        RED = SET_RED + CLEAR_GREEN + CLEAR_BLUE
        GREEN = CLEAR_RED + SET_GREEN + CLEAR_BLUE
        YELLOW = SET_RED + SET_GREEN + CLEAR_BLUE
        BLUE = CLEAR_RED + CLEAR_GREEN + SET_BLUE
        MAGENTA = SET_RED + CLEAR_GREEN + SET_BLUE
        CYAN = CLEAR_RED + SET_GREEN + SET_BLUE
        WHITE = SET_RED + SET_GREEN + SET_BLUE

        # Default terminal color
        DEFAULT = console.get_current_foreground()
Beispiel #2
0
 def update():
     """
     Update the current values of the DEFAULT color constant -- we have
     to adapt these since they might change (e.g. with the "color"
     command).
     """
     color.Back.DEFAULT = console.get_current_background()
     color.Fore.DEFAULT = console.get_current_foreground()
Beispiel #3
0
 def update():
     """
     Update the current values of the DEFAULT color constant -- we have
     to adapt these since they might change (e.g. with the "color"
     command).
     """
     color.Back.DEFAULT = console.get_current_background()
     color.Fore.DEFAULT = console.get_current_foreground()