Skip to content

Commit 61d4735

Browse files
committed
Add color mode to the window title
1 parent 760c5ed commit 61d4735

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

gambaterm/colors.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ def cycle(self) -> ColorMode:
2020
value += 1
2121
return ColorMode(value)
2222

23+
def report(self) -> str:
24+
"""Return a human-readable report of the color mode."""
25+
if self == ColorMode.COULD_NOT_DETECT:
26+
return "Could not detect color mode"
27+
if self == ColorMode.HAS_2_BIT_COLOR:
28+
return "4 colors"
29+
if self == ColorMode.HAS_4_BIT_COLOR:
30+
return "16 colors"
31+
if self == ColorMode.HAS_8_BIT_COLOR:
32+
return "256 colors"
33+
if self == ColorMode.HAS_24_BIT_COLOR:
34+
return "True color"
35+
assert False
36+
2337

2438
def detect_local_color_mode(term: Terminal) -> ColorMode:
2539
"""Detect the color mode of the local terminal using blessed."""

gambaterm/run.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def run(
205205
title += f"Emu: {emu_fps:.0f} FPS - {emu_percent:.0f}% CPU | "
206206
title += f"Video: {video_fps:.0f} FPS - {video_percent:.0f}% CPU - "
207207
title += f"{data_rate:.0f} KB/s | "
208-
title += f"Audio: {audio_percent:.0f}% CPU"
208+
title += f"Audio: {audio_percent:.0f}% CPU | "
209+
title += f"{color_mode.report()} mode"
209210
term.stream.write(term.set_window_title(title))
210211
term.stream.flush()

0 commit comments

Comments
 (0)