Python colorama.Fore.MAGENTA Examples

The following are 30 code examples of colorama.Fore.MAGENTA(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module colorama.Fore , or try the search function .
Example #1
Source File: colors.py    From chepy with GNU General Public License v3.0 6 votes vote down vote up
def magenta(s: str) -> str:  # pragma: no cover
    """Magenta color string if tty
    
    Args:
        s (str): String to color
    
    Returns:
        str: Colored string

    Examples:
        >>> from chepy.modules.internal.colors import magenta
        >>> print(MAGENTA("some string"))
    """
    if sys.stdout.isatty():
        return Fore.MAGENTA + s + Fore.RESET
    else:
        return s 
Example #2
Source File: text.py    From insights-core with Apache License 2.0 6 votes vote down vote up
def preprocess(self):
        response = namedtuple('response', 'color label intl title')
        self.responses = {
            'pass': response(color=Fore.GREEN, label="PASS", intl='P', title="Passed      : "),
            'rule': response(color=Fore.RED, label="FAIL", intl='F', title="Failed      : "),
            'info': response(color=Fore.WHITE, label="INFO", intl='I', title="Info        : "),
            'skip': response(color=Fore.BLUE, label="SKIP", intl='S', title="Missing Deps: "),
            'fingerprint': response(color=Fore.YELLOW, label="FINGERPRINT", intl='P',
                                  title="Fingerprint : "),
            'metadata': response(color=Fore.YELLOW, label="META", intl='M', title="Metadata    : "),
            'metadata_key': response(color=Fore.MAGENTA, label="META", intl='K', title="Metadata Key: "),
            'exception': response(color=Fore.RED, label="EXCEPT", intl='E', title="Exceptions  : ")
        }

        self.counts = {}
        for key in self.responses:
            self.counts[key] = 0

        self.print_header("Progress:", Fore.CYAN)
        self.broker.add_observer(self.progress_bar, rule)
        self.broker.add_observer(self.progress_bar, condition)
        self.broker.add_observer(self.progress_bar, incident)
        self.broker.add_observer(self.progress_bar, parser) 
Example #3
Source File: utils.py    From Search4 with GNU General Public License v3.0 6 votes vote down vote up
def banner():
    print(
        Style.BRIGHT
        + Color.MAGENTA
        + """


          _/_/_/                                          _/        _/  _/
       _/          _/_/      _/_/_/  _/  _/_/    _/_/_/  _/_/_/    _/  _/
        _/_/    _/_/_/_/  _/    _/  _/_/      _/        _/    _/  _/_/_/_/
           _/  _/        _/    _/  _/        _/        _/    _/      _/
    _/_/_/      _/_/_/    _/_/_/  _/          _/_/_/  _/    _/      _/


        > version 1.0
        > Script to find user account on various platforms.
        """
        + Style.RESET_ALL
    ) 
Example #4
Source File: logging_helpers.py    From dephell with MIT License 6 votes vote down vote up
def format(self, record):
        # add color
        if self.colors and record.levelname in COLORS:
            start = COLORS[record.levelname]
            record.levelname = start + record.levelname + Fore.RESET
            record.msg = Fore.WHITE + record.msg + Fore.RESET

        # add extras
        if self.extras:
            extras = merge_record_extra(record=record, target=dict(), reserved=RESERVED_ATTRS)
            record.extras = ', '.join('{}={}'.format(k, v) for k, v in extras.items())
            if record.extras:
                record.extras = Fore.MAGENTA + '({})'.format(record.extras) + Fore.RESET

        # hide traceback
        if not self.traceback:
            record.exc_text = None
            record.exc_info = None
            record.stack_info = None

        return super().format(record) 
Example #5
Source File: cache.py    From ytmdl with MIT License 6 votes vote down vote up
def main(SONG_NAME=''):
    """Run on program call."""
    cache = Cache()
    match = cache.search(SONG_NAME)
    if match:
        PREPEND(1)
        print(Fore.MAGENTA, end='')
        print('{} '.format(SONG_NAME), end='')
        print(Style.RESET_ALL, end='')
        print('found.')
        while True:
            choice = input('Do you still want to continue[y/n]')
            choice = choice.lower()
            if choice == 'y' or choice == 'Y':
                return True
            elif choice == 'n' or choice == 'N':
                return False
    else:
        return True 
Example #6
Source File: reminder.py    From Jarvis with MIT License 6 votes vote down vote up
def first_time_init(self, jarvis):
        remind_still_active = []
        for item in self.get_data(jarvis):
            timestamp = item['timestamp']
            if timestamp < time.time():
                time_format = self.timestamp_to_string(timestamp)
                jarvis.say(
                    "Reminder: {} missed ({})".format(
                        item['message'], time_format), Fore.MAGENTA)
                continue

            schedule_id = jarvis.schedule(timestamp, self.reminder_exec,
                                          item['message'])
            item['schedule_id'] = schedule_id
            remind_still_active += [item]
        self.save_data(jarvis, remind_still_active) 
Example #7
Source File: _grep.py    From nbcommands with Apache License 2.0 6 votes vote down vote up
def color(s, c, style="bright"):
    color_map = {
        "black": Fore.BLACK,
        "red": Fore.RED,
        "green": Fore.GREEN,
        "yellow": Fore.YELLOW,
        "blue": Fore.BLUE,
        "magenta": Fore.MAGENTA,
        "cyan": Fore.CYAN,
        "white": Fore.WHITE,
    }
    style_map = {
        "dim": Style.DIM,
        "normal": Style.NORMAL,
        "bright": Style.BRIGHT,
    }

    return color_map[c] + style_map[style] + s + Style.RESET_ALL 
Example #8
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def recv(self, str, mode):
    if str: print(Back.MAGENTA + str + Style.RESET_ALL)
    if str and mode == 'hex':
      print(Fore.MAGENTA + conv().hex(str, ':') + Style.RESET_ALL)

  # show information 
Example #9
Source File: display.py    From lightnovel-crawler with Apache License 2.0 5 votes vote down vote up
def cancel_method():
    print()
    print(Icons.RIGHT_ARROW, 'Press', Fore.MAGENTA,
          'Ctrl + C', Fore.RESET, 'to exit')
    print()
# end def 
Example #10
Source File: cli.py    From pynubank with MIT License 5 votes vote down vote up
def main():
    init()

    log(f'Starting {Fore.MAGENTA}{Style.DIM}PyNubank{Style.NORMAL}{Fore.LIGHTBLUE_EX} context creation.')

    device_id = generate_random_id()

    log(f'Generated random id: {device_id}')

    cpf = input(f'[>] Enter your CPF(Numbers only): ')
    password = getpass('[>] Enter your password (Used on the app/website): ')

    generator = CertificateGenerator(cpf, password, device_id)

    log('Requesting e-mail code')
    try:
        email = generator.request_code()
    except NuException:
        log(f'{Fore.RED}Failed to request code. Check your credentials!', Fore.RED)
        return

    log(f'Email sent to {Fore.LIGHTBLACK_EX}{email}{Fore.LIGHTBLUE_EX}')
    code = input('[>] Type the code received by email: ')

    cert1, cert2 = generator.exchange_certs(code)

    save_cert(cert1, 'cert.p12')

    print(f'{Fore.GREEN}Certificates generated successfully. (cert.pem)')
    print(f'{Fore.YELLOW}Warning, keep these certificates safe (Do not share or version in git)') 
Example #11
Source File: color_console.py    From PyMicroChat with GNU General Public License v3.0 5 votes vote down vote up
def magenta(s):
        """前景色:洋红色  背景色:默认"""
        return Fore.MAGENTA + s 
Example #12
Source File: color.py    From opbasm with MIT License 5 votes vote down vote up
def note(t):
        return colorize(t, Fore.MAGENTA) 
Example #13
Source File: utils.py    From fbchat-archive-parser with MIT License 5 votes vote down vote up
def magenta(text):
    return colorize(Fore.MAGENTA, text) 
Example #14
Source File: netbyte.py    From netbyte with MIT License 5 votes vote down vote up
def print_ascii(string):
    '''
    Print string with ASCII color configuration
    '''
    if string.isspace():
        # Add a space to show colors on a non-ASCII line
        string = ' ' + string
    print(Fore.MAGENTA + Style.BRIGHT + string + Style.RESET_ALL) 
Example #15
Source File: color_utils.py    From jaide with GNU General Public License v2.0 5 votes vote down vote up
def color(out_string, color='grn'):
    """ Highlight string for terminal color coding.

    Purpose: We use this utility function to insert a ANSI/win32 color code
           | and Bright style marker before a string, and reset the color and
           | style after the string. We then return the string with these
           | codes inserted.

    @param out_string: the string to be colored
    @type out_string: str
    @param color: a string signifying which color to use. Defaults to 'grn'.
                | Accepts the following colors:
                |     ['blk', 'blu', 'cyn', 'grn', 'mag', 'red', 'wht', 'yel']
    @type color: str

    @returns: the modified string, including the ANSI/win32 color codes.
    @rtype: str
    """
    c = {
        'blk': Fore.BLACK,
        'blu': Fore.BLUE,
        'cyn': Fore.CYAN,
        'grn': Fore.GREEN,
        'mag': Fore.MAGENTA,
        'red': Fore.RED,
        'wht': Fore.WHITE,
        'yel': Fore.YELLOW,
    }
    try:
        init()
        return (c[color] + Style.BRIGHT + out_string + Fore.RESET + Style.NORMAL)
    except AttributeError:
        return out_string 
Example #16
Source File: multiprocess.py    From PyFunceble with Apache License 2.0 5 votes vote down vote up
def __merge_processes_data(self, manager_data):
        """
        Reads all results and put them at the right location.
        """

        if manager_data is not None:
            if (
                not self.autosave.authorized
                and PyFunceble.CONFIGURATION.multiprocess_merging_mode != "live"
                and not PyFunceble.CONFIGURATION.quiet
            ):
                print(
                    Fore.MAGENTA
                    + Style.BRIGHT
                    + "\nMerging cross processes data... This process may take some time."
                )

            for test_output in manager_data:
                if self.autosave.authorized:
                    print(Fore.MAGENTA + Style.BRIGHT + "Merging process data ...")

                self.post_test_treatment(
                    test_output,
                    self.file_type,
                    complements_test_started=self.complements_test_started,
                    auto_continue_db=self.autocontinue,
                    inactive_db=self.inactive_db,
                    mining=self.mining,
                    whois_db=self.whois_db,
                )

            manager_data[:] = []

        self.autocontinue.save()
        self.inactive_db.save()
        self.mining.save()

        self.cleanup(self.autocontinue, self.autosave, test_completed=False) 
Example #17
Source File: cli.py    From PyFunceble with Apache License 2.0 5 votes vote down vote up
def logs_sharing(cls):
        """
        Prints an information message when the logs sharing
        is activated.
        """

        if PyFunceble.CONFIGURATION.share_logs:
            print(Fore.GREEN + Style.BRIGHT + "You are sharing your logs!")
            print(
                Fore.MAGENTA + Style.BRIGHT + "Please find more about it at "
                "https://pyfunceble.readthedocs.io/en/master/logs-sharing.html !"
            ) 
Example #18
Source File: test_core_cli.py    From PyFunceble with Apache License 2.0 5 votes vote down vote up
def test_log_sharing(self):
        """
        Tests the correctness of the desired message.
        """

        PyFunceble.CONFIGURATION.share_logs = True

        expected = f"""{Fore.GREEN}{Style.BRIGHT}You are sharing your logs!
{Fore.MAGENTA}{Style.BRIGHT}Please find more about it at https://pyfunceble.readthedocs.io/en/master/logs-sharing.html !
"""
        self.cli_core.logs_sharing()
        actual = sys.stdout.getvalue()

        self.assertEqual(expected, actual) 
Example #19
Source File: ctu.py    From CageTheUnicorn with ISC License 5 votes vote down vote up
def colorDepth(depth):
	colors = [Fore.RED, Fore.WHITE, Fore.GREEN, Fore.YELLOW, Style.BRIGHT + Fore.BLUE, Fore.MAGENTA, Fore.CYAN]

	return colors[depth % len(colors)] 
Example #20
Source File: onsets_frames_transcription_realtime.py    From magenta with Apache License 2.0 5 votes vote down vote up
def result_collector(result_queue):
  """Collect and display results."""

  def notename(n, space):
    if space:
      return [' ', '  ', ' ', ' ', '  ', ' ', '  ', ' ', ' ', '  ', ' ',
              '  '][n % 12]
    return [
        Fore.BLUE + 'A' + Style.RESET_ALL,
        Fore.LIGHTBLUE_EX + 'A#' + Style.RESET_ALL,
        Fore.GREEN + 'B' + Style.RESET_ALL,
        Fore.CYAN + 'C' + Style.RESET_ALL,
        Fore.LIGHTCYAN_EX + 'C#' + Style.RESET_ALL,
        Fore.RED + 'D' + Style.RESET_ALL,
        Fore.LIGHTRED_EX + 'D#' + Style.RESET_ALL,
        Fore.YELLOW + 'E' + Style.RESET_ALL,
        Fore.WHITE + 'F' + Style.RESET_ALL,
        Fore.LIGHTBLACK_EX + 'F#' + Style.RESET_ALL,
        Fore.MAGENTA + 'G' + Style.RESET_ALL,
        Fore.LIGHTMAGENTA_EX + 'G#' + Style.RESET_ALL,
    ][n % 12]  #+ str(n//12)

  print('Listening to results..')
  # TODO(mtyka) Ensure serial stitching of results (no guarantee that
  # the blocks come in in order but they are all timestamped)
  while True:
    result = result_queue.get()
    serial = result.audio_chunk.serial
    result_roll = result.result
    if serial > 0:
      result_roll = result_roll[4:]
    for notes in result_roll:
      for i in range(6, len(notes) - 6):
        note = notes[i]
        is_frame = note[0] > 0.0
        notestr = notename(i, not is_frame)
        print(notestr, end='')
      print('|') 
Example #21
Source File: timeIn.py    From Jarvis with MIT License 5 votes vote down vote up
def main(self, s):
    # Trims input s to be just the city/region name
    s = s.replace('time ', '').replace('in ', '')

    exists = os.path.isfile(module_path + 'key_timein.json')
    if not exists:
        shutil.copy2(
            module_path
            + 'samplekey_timein.json',
            module_path
            + 'key_timein.json')
        print(
            Fore.RED
            + "Generate api key here: https://developers.google.com/maps/documentation/geocoding/start?hl=en_US")
        print(
            Fore.RED
            + "and add it to jarviscli/data/key_timein.json"
            + Fore.RESET)
        return

    # Transforms a city name into coordinates using Google Maps API
    loc = getLocation(s)
    if loc is None:
        return
    # Gets current date and time using TimeZoneDB API
    send_url = (
        "http://api.timezonedb.com/v2/get-time-zone?"
        "key=BFA6XBCZ8AL5&format=json"
        "&by=position&lat={:.6f}&lng={:.6f}".format(*loc)
    )
    r = requests.get(send_url)
    j = json.loads(r.text)
    time = j['formatted']
    self.dst = j['dst']
    # Prints current date and time as YYYY-MM-DD HH:MM:SS
    print("{COLOR}The current date and time in {LOC} is: {TIME}{COLOR_RESET}"
          .format(COLOR=Fore.MAGENTA, COLOR_RESET=Fore.RESET,
                  LOC=str(s).title(), TIME=str(time))) 
Example #22
Source File: reminder.py    From Jarvis with MIT License 5 votes vote down vote up
def remind_add(self, jarvis, s, time_in_parser, example):
        s = s.split(" to ")
        if len(s) != 2:
            jarvis.say("Sorry, please say something like:", Fore.MAGENTA)
            jarvis.say(" > {}".format(example), Fore.MAGENTA)
            return

        time_in = time_in_parser(s[0])
        while time_in is None:
            jarvis.say("Sorry, when should I remind you?", Fore.MAGENTA)
            time_in = time_in_parser(jarvis.input("Time: "))
        timestamp = time.time() + time_in

        message = s[1]
        notification_message = message

        todo_refere_id = None
        if message == 'todo':
            message = ''
            todo_refere_entry = self.interact().select_one_remind(jarvis)
            if todo_refere_entry is None:
                jarvis.say("Nothing selected", Fore.MAGENTA)
                return
            notification_message = todo_refere_entry['message']
            notification_message = "TODO: {}".format(notification_message)
            todo_refere_id = todo_refere_entry['id']

        # schedule
        schedule_id = jarvis.schedule(time_in, self.reminder_exec,
                                      notification_message)
        self.add(jarvis, message, timestamp=timestamp, schedule_id=schedule_id,
                 todo_refere_id=todo_refere_id) 
Example #23
Source File: colors.py    From drone with MIT License 5 votes vote down vote up
def bright_foreground(self):
        color = {
            'red'       : '{0}{1}'.format(Fore.RED, Style.BRIGHT),
            'cyan'      : '{0}{1}'.format(Fore.CYAN, Style.BRIGHT),
            'green'     : '{0}{1}'.format(Fore.GREEN, Style.BRIGHT),
            'yellow'    : '{0}{1}'.format(Fore.YELLOW, Style.BRIGHT),
            'blue'      : '{0}{1}'.format(Fore.BLUE, Style.BRIGHT),
            'magenta'   : '{0}{1}'.format(Fore.MAGENTA, Style.BRIGHT),
            'white'     : '{0}{1}'.format(Fore.WHITE, Style.BRIGHT),
            'grey'      : '{0}{1}'.format(Fore.WHITE, Style.RESET_ALL)
        }
        return color 
Example #24
Source File: colors.py    From drone with MIT License 5 votes vote down vote up
def bright_foreground(self):
        color = {
            'red'       : '{0}{1}'.format(Fore.RED, Style.BRIGHT),
            'cyan'      : '{0}{1}'.format(Fore.CYAN, Style.BRIGHT),
            'green'     : '{0}{1}'.format(Fore.GREEN, Style.BRIGHT),
            'yellow'    : '{0}{1}'.format(Fore.YELLOW, Style.BRIGHT),
            'blue'      : '{0}{1}'.format(Fore.BLUE, Style.BRIGHT),
            'magenta'   : '{0}{1}'.format(Fore.MAGENTA, Style.BRIGHT),
            'white'     : '{0}{1}'.format(Fore.WHITE, Style.BRIGHT),
            'grey'      : '{0}{1}'.format(Fore.WHITE, Style.RESET_ALL)
        }
        return color 
Example #25
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_purpul(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.MAGENTA + raw))

#---------------------------------------------------------------------- 
Example #26
Source File: print_utils.py    From g3ar with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def print_purpul(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.MAGENTA + raw))

#---------------------------------------------------------------------- 
Example #27
Source File: Pocket.py    From WebPocket with GNU General Public License v3.0 5 votes vote down vote up
def do_banner(self, args):
        """Print WebPocket banner"""
        ascii_text = text2art("WebPocket", "rand")
        self.poutput("\n\n")
        self.poutput(ascii_text, '\n\n', color=Fore.LIGHTCYAN_EX)
        self.poutput("{art} WebPocket has {count} modules".format(art=art("inlove"), count=self.get_module_count()), "\n\n", color=Fore.MAGENTA) 
Example #28
Source File: display.py    From SQL-scanner with MIT License 5 votes vote down vote up
def banner(self):        
        self.clear() 

        banner = choice(banners)
        color = choice([Fore.GREEN, Fore.YELLOW, Fore.RED, Fore.MAGENTA, Fore.BLUE, Fore.CYAN])

        print(color)
        print(banner.format('{0}V.{1}{2}'.format(Fore.WHITE, version, Fore.RESET))) 
Example #29
Source File: colors.py    From CIRTKit with MIT License 5 votes vote down vote up
def magenta(text, readline=False):
    return Fore.MAGENTA + str(text) + Fore.RESET 
Example #30
Source File: __init__.py    From pysslscan with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self):
        if colorama_init:
            colorama_init(autoreset=False)
            self.colors = {
                "RESET": Fore.RESET,
                "BLACK": Fore.BLACK,
                "RED": Fore.RED,
                "GREEN": Fore.GREEN,
                "YELLOW": Fore.YELLOW,
                "BLUE": Fore.BLUE,
                "MAGENTA": Fore.MAGENTA,
                "CYAN": Fore.CYAN
                #"GRAY": Fore.GRAY
            }
        else:
            CSI = "\33["
            self.CSI = CSI
            self.colors = {
                "RESET": CSI + "0m",
                "BLACK": CSI + "0;30m",
                "RED": CSI + "0;31m",
                "GREEN": CSI + "0;32m",
                "YELLOW": CSI + "0;33m",
                "BLUE": CSI + "0;34m",
                "MAGENTA": CSI + "0;35m",
                "CYAN": CSI + "0;36m"
                #"GRAY": CSI + "0;37m"
            }

        self.mapped_colors = {}
        self.mapped_colors["default"] = {
            "DANGER": "RED",
            "ERROR": "RED",
            "OK": "GREEN",
            "SUCCESS": "GREEN",
            "WARNING": "YELLOW"
        }