-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove dependency on ansible.utils.color #833
Conversation
"""Color styles.""" | ||
|
||
reset = "0" | ||
error_code = "1;31" # bright red |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is problematic because it'll only work in terminals that support misusing the bold setting for bright. Standard-compliant terminals don't work like that.
It's roughly summarized here: kovidgoyal/kitty#197 (comment). And while for red it's semi-okay, for things like grey it's a disaster because it looks the same as the background == looks like empty lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My change does not touch current behavior. ANSI support is a can of worms due to the variance in implementations. I am ok to investigate drop of bold but in a different change, also after looking at what other linters are doing with output (is likely that ansible-lint would be used in parallel with others too).
lib/ansiblelint/color.py
Outdated
line = "0;35" # purple | ||
|
||
|
||
def stringc(text: str, color: Color): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's a function, it should be a verb:
def stringc(text: str, color: Color): | |
def colorize(text: str, color: Color): |
Removes dependency on internal Ansible coloring implementation. This was a problem for multiple reasons: - use of private APIs - licensing (Ansible is GPL) - premature initialization of Ansible before our cli loads The colors are kept but use styles instead of hardcoded colors.
Removes dependency on internal Ansible coloring implementation. This
was a problem for multiple reasons:
The same colors are kept but now we set them using styles, making easier to restyle it if needed and to assure consistency.