Skip to content

Commit

Permalink
Merge pull request #22 from bluenote10/fix_tty_detection
Browse files Browse the repository at this point in the history
Fix tty detection logic
  • Loading branch information
bluenote10 authored Jan 9, 2025
2 parents 652af7f + ad3b8b5 commit 6332a65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit 6332a65

Please sign in to comment.