From 9ec3f74c0d15d7952fab0a2c4f73d1a8ff1e96df Mon Sep 17 00:00:00 2001 From: "Azalea (on HyDEV-Daisy)" Date: Sun, 10 Apr 2022 22:45:56 -0400 Subject: [PATCH] [O] Optimize grayscale --- hyfetch/color_util.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hyfetch/color_util.py b/hyfetch/color_util.py index 911893b7..0fbc5c2c 100644 --- a/hyfetch/color_util.py +++ b/hyfetch/color_util.py @@ -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: