Support terminals that implement `truecolor`

pull/83911/head
Sviatoslav Sydorenko 4 months ago
parent 8e74cdc7b2
commit 05e3fdf5e9
No known key found for this signature in database
GPG Key ID: 9345E8FEA89CA455

@ -4,6 +4,7 @@
from __future__ import annotations
import os
import re
from string import ascii_letters, digits
@ -117,6 +118,13 @@ COLOR_CODES = {
'magenta': u'0;35', 'bright magenta': u'1;35',
'normal': u'0',
}
COLOR_CODES = {
name:
str(int(re.search(r'1;(?P<color_code>3\d)', ansi_seq).group('color_code')) + 60)
if os.getenv('COLORTERM') == 'truecolor' and '1;3' in ansi_seq
else ansi_seq
for name, ansi_seq in COLOR_CODES.items()
}
REJECT_EXTS = ('.pyc', '.pyo', '.swp', '.bak', '~', '.rpm', '.md', '.txt', '.rst')
BOOL_TRUE = BOOLEANS_TRUE
COLLECTION_PTYPE_COMPAT = {'module': 'modules'}

@ -118,6 +118,8 @@ def ansible_environment(args: CommonConfig, color: bool = True, ansible_config:
# ansible-test specific environment variables require an 'ANSIBLE_TEST_' prefix to distinguish them from ansible-core env vars defined by config
ANSIBLE_TEST_ANSIBLE_LIB_ROOT=ANSIBLE_LIB_ROOT, # used by the coverage injector
)
if color_term := os.getenv('COLORTERM'):
ansible['COLORTERM'] = color_term
if isinstance(args, IntegrationConfig) and args.coverage:
# standard path injection is not effective for the persistent connection helper, instead the location must be configured

Loading…
Cancel
Save