mirror of
https://github.com/kennethreitz/langchain.git
synced 2026-06-05 23:00:18 +00:00
update colors (#140)
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
"""Handle chained inputs."""
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
_COLOR_MAPPING = {"blue": 104, "yellow": 103, "red": 101, "green": 102}
|
||||
_COLOR_MAPPING = {"blue": 51, "yellow": 229, "pink": 219, "green": 85}
|
||||
|
||||
|
||||
def get_color_mapping(
|
||||
@@ -21,7 +21,7 @@ def print_text(text: str, color: Optional[str] = None, end: str = "") -> None:
|
||||
print(text, end=end)
|
||||
else:
|
||||
color_str = _COLOR_MAPPING[color]
|
||||
print(f"\x1b[{color_str}m{text}\x1b[0m", end=end)
|
||||
print(f"\u001b[48;5;{color_str}m{text}\x1b[0m", end=end)
|
||||
|
||||
|
||||
class ChainedInput:
|
||||
|
||||
@@ -48,7 +48,7 @@ def test_chained_input_verbose() -> None:
|
||||
chained_input.add("baz", color="blue")
|
||||
sys.stdout = old_stdout
|
||||
output = mystdout.getvalue()
|
||||
assert output == "\x1b[104mbaz\x1b[0m"
|
||||
assert output == "\x1b[48;5;51mbaz\x1b[0m"
|
||||
assert chained_input.input == "foobarbaz"
|
||||
|
||||
|
||||
@@ -70,5 +70,5 @@ def test_get_color_mapping_excluded_colors() -> None:
|
||||
"""Test getting of color mapping with excluded colors."""
|
||||
items = ["foo", "bar"]
|
||||
output = get_color_mapping(items, excluded_colors=["blue"])
|
||||
expected_output = {"foo": "yellow", "bar": "red"}
|
||||
expected_output = {"foo": "yellow", "bar": "pink"}
|
||||
assert output == expected_output
|
||||
|
||||
Reference in New Issue
Block a user