How to use the colorama.Fore.WHITE function in colorama

To help you get started, we’ve selected a few colorama examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github radical-cybertools / radical.saga / saga / utils / logger / colorstreamhandler.py View on Github external
try:
    from colorama import Fore, Back, init, Style
 
    class ColorStreamHandler(StreamHandler):
        """ A colorized output SteamHandler """
 
        # Some basic colour scheme defaults
        colours = {
            'DEBUG'    : Fore.CYAN,
            'INFO'     : Fore.GREEN,
            'WARN'     : Fore.YELLOW,
            'WARNING'  : Fore.YELLOW,
            'ERROR'    : Fore.RED,
            'CRIT'     : Back.RED + Fore.WHITE,
            'CRITICAL' : Back.RED + Fore.WHITE
        }
 
        @property
        def is_tty(self):
            """ Check if we are using a "real" TTY. If we are not using a TTY it means that
            the colour output should be disabled.
 
            :return: Using a TTY status
            :rtype: bool
            """
            try:    return getattr(self.stream, 'isatty', None)()
            except: return False
 
        def emit(self, record):
            try:
                message = self.format(record)
github Pattio / DeepSwarm / deepswarm / log.py View on Github external
import json
import logging
import re

from colorama import init as colorama_init
from colorama import Fore, Back, Style


class Log:
    """Class responsible for logging information."""

    # Define header styles
    HEADER_W = [Fore.BLACK, Back.WHITE, Style.BRIGHT]
    HEADER_R = [Fore.WHITE, Back.RED, Style.BRIGHT]
    HEADER_G = [Fore.WHITE, Back.GREEN, Style.BRIGHT]

    @classmethod
    def enable(cls, storage):
        """Initializes the logger.

        Args:
            storage: Storage object.
        """

        # Init colorama to enable colors
        colorama_init()
        # Get deepswarm logger
        cls.logger = logging.getLogger("deepswarm")

        # Create stream handler
        stream_handler = logging.StreamHandler()
github superhedgy / AttackSurfaceMapper / modules / subbrute.py View on Github external
def cprint(type, msg, reset):
    colorama.init()
    message = {
        "action": Fore.YELLOW,
        "positive": Fore.GREEN + Style.BRIGHT,
        "info": Fore.YELLOW,
        "reset": Style.RESET_ALL,
        "red": Fore.RED,
        "white": Fore.WHITE,
        "green": Fore.GREEN,
        "yellow": Fore.YELLOW
    }
    style = message.get(type.lower())
github tartley / colorama / demos / demo06.py View on Github external
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
from __future__ import print_function
import fixpath
import colorama
from colorama import Fore, Back, Style
from random import randint, choice
from string import printable

# Demonstrate printing colored, random characters at random positions on the screen

# Fore, Back and Style are convenience classes for the constant ANSI strings that set
#     the foreground, background and style. The don't have any magic of their own.
FORES = [ Fore.BLACK, Fore.RED, Fore.GREEN, Fore.YELLOW, Fore.BLUE, Fore.MAGENTA, Fore.CYAN, Fore.WHITE ]
BACKS = [ Back.BLACK, Back.RED, Back.GREEN, Back.YELLOW, Back.BLUE, Back.MAGENTA, Back.CYAN, Back.WHITE ]
STYLES = [ Style.DIM, Style.NORMAL, Style.BRIGHT ]

# This assumes your terminal is 80x24. Ansi minimum coordinate is (1,1).
MINY, MAXY = 1, 24
MINX, MAXX = 1, 80

# set of printable ASCII characters, including a space.
CHARS = ' ' + printable.strip()

PASSES = 1000

def main():
    colorama.init()
    # gratuitous use of lambda.
    pos = lambda y, x: '\x1b[%d;%dH' % (y, x)
github m0rtem / CloudFail / cloudfail.py View on Github external
def crimeflare(target):
    print_out(Fore.CYAN + "Scanning crimeflare database...")

    with open("data/ipout", "r") as ins:
        crimeFoundArray = []
        for line in ins:
            lineExploded = line.split(" ")
            if lineExploded[1] == args.target:
                crimeFoundArray.append(lineExploded[2])
            else:
                continue
    if (len(crimeFoundArray) != 0):
        for foundIp in crimeFoundArray:
            print_out(Style.BRIGHT + Fore.WHITE + "[FOUND:IP] " + Fore.GREEN + "" + foundIp.strip())
    else:
        print_out("Did not find anything.")
github BBVA / brainslug / brainslug / banner.py View on Github external
import pkg_resources
import colorama

__all__ = ['BANNER']

P = colorama.Fore.MAGENTA + colorama.Style.BRIGHT
G = colorama.Fore.GREEN + colorama.Style.NORMAL
R = colorama.Style.RESET_ALL
W = colorama.Fore.WHITE + colorama.Style.NORMAL

distribution = pkg_resources.get_distribution('brainslug')
version = f'v{distribution.version}'

BANNER = (f"""
{P}  ______            __      {G} _______ __
{P} |   __ .----.---.-|__.-----{G}|     __|  .--.--.-----.
github BuysDB / SingleCellMultiOmics / singlecellmultiomics / barcodeFileParser / barcodeFileParser.py View on Github external
def list(self, showBarcodes=5):  # showBarcodes=None show all
        for barcodeAlias, mapping in self.barcodes.items():
            print(
                f'{len(mapping)} barcodes{Style.DIM} obtained from {Style.RESET_ALL}{barcodeAlias}')
            if len(mapping):
                for bcId in list(mapping.keys())[:showBarcodes]:
                    try:
                        print(('%s%s%s%s%s%s' % (Fore.GREEN, bcId,
                                                 Fore.WHITE, '→', mapping[bcId], Style.RESET_ALL)))
                    except Exception as e:
                        print(('%s%s%s%s%s%s' % (Fore.GREEN, bcId,
                                                 Fore.WHITE, '->', mapping[bcId], Style.RESET_ALL)))
                if showBarcodes is not None and len(mapping) > showBarcodes:
                    print(
                        f'{Style.DIM} %s more ...\n{Style.RESET_ALL}' %
                        (len(mapping) - showBarcodes))
github biojppm / cmany / src / c4 / cmany / util.py View on Github external
def logcmd(*args, **kwargs):
    # print(*args, **kwargs)
    print("--------")
    color_log(colorama.Fore.WHITE + colorama.Style.BRIGHT, *args, **kwargs)
    # this print here is needed to prevent the command output
    # from being colored. Need to address this somehow.
    print("--------")
github Azure / simdem / simdem.py View on Github external
def prompt(self):
        """Display the prompt for the user. This is intended to indicate that
        the user is expected to take an action at this point.
        """
        self.display("$ ", colorama.Fore.WHITE)
github animeshkundu / torrent-dl / Pyflix / torrent / __init__.py View on Github external
def screen_data(self, defrag=False):
        status = self.status
        text = Fore.WHITE
        text += term.bold('Pyflix\n\n')
        text += STATES[status.state]
        text += term.yellow(' %.2f%% complete ' % (status.progress * 100))
        rates = self.rates()
        rate_text = '(down: %.1f kB/s up: %.1f kB/s peers: %d)\n' % \
                    (rates[0], rates[1], status.num_peers)
        text += term.green(rate_text)

        if defrag:
            text += self.defrag()
            text += Fore.WHITE
            text += "\n\n"

        if self._video_file is not None:
            text += term.white("Serving ")
            text += term.yellow(self.video_file[0])