From 19838bc2a2a23ccdedf1588decb2ea0980df8ac0 Mon Sep 17 00:00:00 2001 From: Ian Jauslin Date: Fri, 18 Feb 2022 17:51:13 -0500 Subject: [PATCH] color names in 'set color' command --- src/colors.py | 6 +++--- src/command_prompt.py | 48 +++++++++++++++++-------------------------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/src/colors.py b/src/colors.py index d62b115..39d77a1 100644 --- a/src/colors.py +++ b/src/colors.py @@ -2,10 +2,10 @@ def closest_color(rgb,names): name="" mindist=float('inf') - for i in range(len(names)): - dist=(rgb[0]-names[i][1])**2+(rgb[1]-names[i][2])**2+(rgb[2]-names[i][3])**2 + for color in names: + dist=(rgb[0]-color[1])**2+(rgb[1]-color[2])**2+(rgb[2]-color[3])**2 if dist