Skip to content

Commit

Permalink
remove colr (#465)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <[email protected]>
  • Loading branch information
wagoodman authored Jan 10, 2025
1 parent 3c21f19 commit 6a4fb30
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ dependencies = [
"requests<3.0.0,>=2.32.3",
"GitPython<4.0.0,>=3.1.43",
"rfc3339<7.0,>=6.2",
"Colr<1.0.0,>=0.9.1",
"omitempty<1.0.0,>=0.1.1",
"importlib-metadata<9.0.0,>=7.0.1",
"mergedeep<2.0.0,>=1.3.4",
Expand Down
13 changes: 10 additions & 3 deletions src/yardstick/cli/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import json
from typing import Any, Union

from colr import color # type: ignore[import]
from tabulate import tabulate

from yardstick import artifact, comparison
Expand Down Expand Up @@ -75,6 +74,14 @@ def matches(comp: comparison.ByMatch, details=True, summary=True, common=True):
#############################################################################################################
# For label comparisons

def red(text: str) -> str:
return f"\033[91m{text}\033[0m"

def rgb_ansi(r, g, b):
return f"\033[38;2;{r};{g};{b}m"

def reset_ansi():
return "\033[0m"

def get_section_rgb_tuple(index, sections):
half_sections = int(sections / 2)
Expand Down Expand Up @@ -115,7 +122,7 @@ def format_value_red_green_spectrum(
)
color_rgb_tuple = get_section_rgb_tuple(index, sections)

formatted_value = color(f"{value:6.2f}", fore=color_rgb_tuple)
formatted_value = f"{rgb_ansi(*color_rgb_tuple)}{value:6.2f}{reset_ansi()}"

if value_ratio > 0.9:
# bold
Expand Down Expand Up @@ -264,7 +271,7 @@ def summarize_across_images(title, description, source, context_source=None):
f1_score_str = (
"error!"
if lower == -1 or upper == -1
else color(f"Impractical ({lower:0.2f}-{upper:0.2f})", fore="red")
else red(f"Impractical ({lower:0.2f}-{upper:0.2f})")
)
else:
f1_score_str = ""
Expand Down
10 changes: 1 addition & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6a4fb30

Please sign in to comment.