How to use the colorama.init 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 nvbn / thefuck / thefuck / system / win32.py View on Github external
def init_output():
    import colorama
    win_unicode_console.enable()
    colorama.init()
github X-Vector / X-RSA / RSA5.py View on Github external
clear = "clear"
os.system(clear)
is_windows = sys.platform.startswith('win')

# Console Colors
if is_windows:
    # Windows deserves coloring too :D
    G = '\033[92m'  # green
    Y = '\033[93m'  # yellow
    B = '\033[94m'  # blue
    R = '\033[91m'  # red
    W = '\033[0m'   # white
    try:
        import win_unicode_console , colorama
        win_unicode_console.enable()
        colorama.init()
        #Now the unicode will work ^_^
    except:
        print("[!] Error: Coloring libraries not installed, no coloring will be used")
        G = Y = B = R = W = G = Y = B = R = W = ''


else:
    G = '\033[92m'  # green
    Y = '\033[93m'  # yellow
    B = '\033[94m'  # blue
    R = '\033[91m'  # red
    W = '\033[0m'   # white


def banner():
    print("""%s
github papis / papis / papis / commands / default.py View on Github external
def run(
        verbose,
        config,
        lib,
        log,
        pick_lib,
        clear_cache,
        set_list,
        color
        ):

    if color == "no" or (color == "auto" and not sys.stdout.isatty()):
        # Turn off colorama (strip escape sequences from the output)
        colorama.init(strip=True)
    else:
        colorama.init()

    log_format = (
        colorama.Fore.YELLOW +
        '%(levelname)s' +
        ':' +
        colorama.Fore.GREEN +
        '%(name)s' +
        colorama.Style.RESET_ALL +
        ':' +
        '%(message)s'
    )
    if verbose:
        log = "DEBUG"
        log_format = '%(relativeCreated)d-'+log_format
    logging.basicConfig(
        level=getattr(logging, log),
github numerai / numerai-cli / numerai_compute / cli.py View on Github external
def main():
    init(autoreset=True)

    cli.add_command(setup)
    cli.add_command(destroy)

    cli.add_command(docker)
    cli.add_command(compute)
    cli()
github rednafi / protomate / build / scripts-3.6 / protomate.py View on Github external
import getpass
import os
import subprocess
import sys
from pprint import pprint
import shutil
from colorama import init
from github import Github
from termcolor import cprint

from pyfiglet import figlet_format
from PyInquirer import Token, print_json, prompt, style_from_dict

init(strip=not sys.stdout.isatty())


def cli():

    text = "Protomate"
    ascii_banner = figlet_format(text, font="standard")
    cprint(ascii_banner, "cyan", attrs=["bold"])

    style = style_from_dict(
        {
            Token.QuestionMark: "#E91E63 bold",
            Token.Answer: "#fac731 bold",
            Token.Instruction: "#ef8a62",
            Token.Separator: "#cc5454",
            Token.Selected: "#7fc97f",
            Token.Pointer: "#fdc086",
github unifiedfx / automationfx-python / smtp_client.py View on Github external
import smtplib
import ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import pystache
from datetime import datetime
import os
import json
from colorama import init
init(True)

class SmtpClient:
    sender_email = "my@gmail.com"
    password = "mypassword"
    smtp_server = "smtp.gmail.com"
    port = 465
    text_template = "template.txt"
    html_template = "template.html"
    filename = os.path.join(os.getcwd(), 'smtp_settings.json')
    def __init__(self):
        if not os.path.isfile(self.filename):
            with open(self.filename, 'w') as outfile:
                json.dump({
                    'sender_email': self.sender_email,
                    'password': self.password,
                    'smtp_server': self.smtp_server,
github h2oai / h2o-3 / h2o-py / h2o / utils / debugging.py View on Github external
def _handle_soft_error(exc_type, exc_value, exc_tb):
    colorama.init()
    err((Fore.LIGHTRED_EX + "%s: %s" + Style.RESET_ALL) % (exc_type.__name__, exc_value))

    # Convert to the list of frames
    tb = exc_tb
    frames = []
    while tb:
        frames.append(tb.tb_frame)
        tb = tb.tb_next

    i0 = len(frames) - 1 - getattr(exc_value, "skip_frames", 0)
    indent = " " * (len(exc_type.__name__) + 2)
    for i in range(i0, 0, -1):
        co = frames[i].f_code
        func = _find_function_from_code(frames[i - 1], co)
        fullname = _get_method_full_name(func) if func else "???." + co.co_name
        highlight = getattr(exc_value, "var_name", None) if i == i0 else None
github detexploit / DetExploit / main.py View on Github external
def main_init(sid=None, cfn='config.ini', from_cmd=False):
    init(strip=not sys.stdout.isatty())

    run_on = platform.system()
    cp = configparser.ConfigParser()
    cp.read(cfn, 'UTF-8')
    langdata = langpack.load_langpack(cp)

    if from_cmd:
        if run_on == 'Windows':
            main(sid, cp, langdata)
            exit(0)
        else:
            print('Currently, this platform is not supported.')
            exit(1)

    cprint(figlet_format('   DetExploit'), 'red', attrs=['bold'], end='')
    print('===========================================================')
github cowboy8625 / WordRPG / script / Screen.py View on Github external
# This module is to handle all the print screens for the menus

# All Imports
import os
import textwrap
import time
from colorama import Fore, init
from Mechanics.ui_mechanics import *

init(convert=True)

# Font Colors
white = Fore.WHITE
red = Fore.RED
green = Fore.GREEN
yellow = Fore.YELLOW
blue = Fore.BLUE
magenta = Fore.MAGENTA
light_red = Fore.LIGHTRED_EX
cyan = Fore.CYAN


# Main Menu I have Ideas for a better more custom and reusable screen
def main_menu_screen():
    first = light_red + 'WELECOME TO THE WASTE LAND' + cyan
    num1 = green + '1' + cyan