use colorama light colors instead of bright style

This commit is contained in:
Robert Kaussow 2020-04-05 23:56:26 +02:00
parent ddbe38dee0
commit 258f1a21f0
9 changed files with 13 additions and 10 deletions

View File

@ -158,25 +158,25 @@ def _get_critical_handler(json=False):
def critical(message): def critical(message):
"""Format critical messages and return string.""" """Format critical messages and return string."""
return color_text(colorama.Fore.RED, message) return color_text(colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, message)
def error(message): def error(message):
"""Format error messages and return string.""" """Format error messages and return string."""
return color_text(colorama.Fore.RED, message) return color_text(colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, message)
def warn(message): def warn(message):
"""Format warn messages and return string.""" """Format warn messages and return string."""
return color_text(colorama.Fore.YELLOW, message) return color_text(colorama.Fore.YELLOW, colorama.Fore.LIGHTYELLOW_EX, message)
def info(message): def info(message):
"""Format info messages and return string.""" """Format info messages and return string."""
return color_text(colorama.Fore.BLUE, message) return color_text(colorama.Fore.BLUE, colorama.Fore.LIGHTBLUE_EX, message)
def color_text(color, msg): def color_text(color, light, msg):
""" """
Colorize strings. Colorize strings.
@ -185,5 +185,5 @@ def color_text(color, msg):
:returns: string :returns: string
""" """
msg = msg.format(colorama.Style.BRIGHT) msg = msg.format(light)
return "{}{}{}".format(color, msg, colorama.Style.RESET_ALL) return "{}{}{}".format(color, msg, colorama.Style.RESET_ALL)

View File

@ -23,7 +23,7 @@ def test_critical(capsys, mocker):
print( print(
"{}CRITICAL: {}foo\n{}".format( "{}CRITICAL: {}foo\n{}".format(
colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, colorama.Style.RESET_ALL
) )
) )
x, _ = capsys.readouterr() x, _ = capsys.readouterr()
@ -38,7 +38,7 @@ def test_error(capsys, mocker):
print( print(
"{}ERROR: {}foo\n{}".format( "{}ERROR: {}foo\n{}".format(
colorama.Fore.RED, colorama.Style.BRIGHT, colorama.Style.RESET_ALL colorama.Fore.RED, colorama.Fore.LIGHTRED_EX, colorama.Style.RESET_ALL
) )
) )
x, _ = capsys.readouterr() x, _ = capsys.readouterr()
@ -53,7 +53,7 @@ def test_warn(capsys, mocker):
print( print(
"{}WARNING: {}foo\n{}".format( "{}WARNING: {}foo\n{}".format(
colorama.Fore.YELLOW, colorama.Style.BRIGHT, colorama.Style.RESET_ALL colorama.Fore.YELLOW, colorama.Fore.LIGHTYELLOW_EX, colorama.Style.RESET_ALL
) )
) )
x, _ = capsys.readouterr() x, _ = capsys.readouterr()
@ -68,7 +68,7 @@ def test_info(capsys, mocker):
print( print(
"{}INFO: {}foo\n{}".format( "{}INFO: {}foo\n{}".format(
colorama.Fore.BLUE, colorama.Style.BRIGHT, colorama.Style.RESET_ALL colorama.Fore.BLUE, colorama.Fore.LIGHTBLUE_EX, colorama.Style.RESET_ALL
) )
) )
x, _ = capsys.readouterr() x, _ = capsys.readouterr()

View File

@ -1,3 +1,5 @@
"""Test settings module."""
import pytest import pytest
from ansiblelater import settings from ansiblelater import settings

View File

@ -21,6 +21,7 @@ coalesce_brackets = true
split_before_logical_operator = true split_before_logical_operator = true
[tool:pytest] [tool:pytest]
addopts = --pyargs ansiblelater
filterwarnings = filterwarnings =
ignore::FutureWarning ignore::FutureWarning
ignore:.*collections.*:DeprecationWarning ignore:.*collections.*:DeprecationWarning