Update ANSI_color_terminal.py

This commit is contained in:
Anne Barela 2025-07-15 18:27:49 -04:00 committed by GitHub
parent aada1d7b11
commit 06a13af737
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,7 +8,7 @@
#
import gc
import supervisor
import displayio
import displayio
from lvfontio import OnDiskFont
from adafruit_fruitjam.peripherals import request_display_config
from adafruit_color_terminal import ColorTerminal
@ -50,13 +50,13 @@ def out_char(value, row, column, color):
def set_color(palette_index):
"""Set FOREGROUND color only"""
if not (0 <= palette_index <= 7):
if not (0 <= palette_index <= 7): # pylint: disable=superfluous-parens
raise ValueError("Palette index must be between 0 and 7")
terminal.write(f"\033[3{palette_index}m")
def set_bgcolor(palette_index):
"""Set BACKGROUND color only"""
if not (0 <= palette_index <= 7):
if not (0 <= palette_index <= 7): # pylint: disable=superfluous-parens
raise ValueError("Palette index must be between 0 and 7")
terminal.write(f"\033[4{palette_index}m")