File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,11 @@ def from_env(cls) -> ColorDepth | None:
42
42
This is a way to enforce a certain color depth in all prompt_toolkit
43
43
applications.
44
44
"""
45
+ # Disable color if a `NO_COLOR` environment variable is set.
46
+ # See: https://no-color.org/
47
+ if os .environ .get ("NO_COLOR" ):
48
+ return cls .DEPTH_1_BIT
49
+
45
50
# Check the `PROMPT_TOOLKIT_COLOR_DEPTH` environment variable.
46
51
all_values = [i .value for i in ColorDepth ]
47
52
if os .environ .get ("PROMPT_TOOLKIT_COLOR_DEPTH" ) in all_values :
Original file line number Diff line number Diff line change 63
63
# Completions menu.
64
64
("completion-menu" , "bg:#bbbbbb #000000" ),
65
65
("completion-menu.completion" , "" ),
66
- ("completion-menu.completion.current" , "bg:#888888 #ffffff" ),
66
+ # (Note: for the current completion, we use 'reverse' on top of fg/bg
67
+ # colors. This is to have proper rendering with NO_COLOR=1).
68
+ ("completion-menu.completion.current" , "fg:#888888 bg:#ffffff reverse" ),
67
69
("completion-menu.meta.completion" , "bg:#999999 #000000" ),
68
70
("completion-menu.meta.completion.current" , "bg:#aaaaaa #000000" ),
69
71
("completion-menu.multi-column-meta" , "bg:#aaaaaa #000000" ),
You can’t perform that action at this time.
0 commit comments