View full-text article in PMC Sensors (Basel). 2025 Jun 5;25(11):3572. doi: 10.3390/s25113572 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/). PMC Copyright notice Algorithm A1 Find the nearest color 1:function closest_color( requested_color ) 2: for (key,name)∈webcolors.CSS3_HEX_TO_NAMES.items() do 3: (r_c,g_c,b_c)←webcolors.hex_to_rgb(key) 4: distance←(r_c−requested_color[0])2+(g_c−requested_color[1])2+(b_c−requested_color[2])2 5: min_colors[distance]←name 6: end for 7: return min_colors[min(min_colors.keys())] 8:end function