[O] Optimize grayscale

This commit is contained in:
Azalea (on HyDEV-Daisy) 2022-04-10 22:45:56 -04:00
parent 39e14aec90
commit 9ec3f74c0d

View file

@ -72,15 +72,12 @@ class RGB(NamedTuple):
:return: ANSI 256 escape code like \033[38;5;206m'
"""
r, g, b = self.r, self.g, self.b
gray_possible = True
gray = False
sep = 42.5
while gray_possible:
while True:
if r < sep or g < sep or b < sep:
gray = r < sep and g < sep and b < sep
gray_possible = False
break
sep += 42.5
if gray: