Skip to content
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

Fix tty detection logic #22

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion yachalk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .chalk_instance import chalk, create_chalk
from .types import ColorMode

VERSION = "0.1.6"
VERSION = "0.1.7"

__all__ = [
"chalk",
Expand Down
8 changes: 3 additions & 5 deletions yachalk/supports_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import platform
import re
import sys


from typing import Optional, TextIO

from .types import ColorMode
Expand Down Expand Up @@ -48,9 +46,6 @@ def detect_color_support(stream: TextIO = sys.stdout) -> ColorMode:
if force_color is not None:
return force_color

elif not is_tty:
return ColorMode.AllOff

elif os.environ.get("TERM") == "dumb":
return ColorMode.AllOff

Expand Down Expand Up @@ -99,6 +94,9 @@ def detect_color_support(stream: TextIO = sys.stdout) -> ColorMode:
else:
return ColorMode.AllOff

elif not is_tty:
return ColorMode.AllOff

elif os.environ.get("COLORTERM") == "truecolor":
return ColorMode.FullTrueColor

Expand Down
Loading