目标C查找最接近的颜色(rgb)匹配 [英] Objective C Find closest color (rgb) match

查看:698
本文介绍了目标C查找最接近的颜色(rgb)匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个预定义的rgb值数组。我想能够将用户定义的颜色与我的数组进行比较,并返回Objective C中最接近的匹配。

I have a predefined array of rgb values. I want to be able to compare a user defined color to my array and return the closest match in Objective C.

任何帮助都非常感激。

HSL可以说是一个可以被用来测试的颜色空间。

解决方案

推荐答案

比RGB更好的色彩空间,因为你可以给色调差异更多的权重,而不是轻便。在RGB空间中,你需要扭曲你的差异,因为眼睛比其他颜色更能识别绿色。

HSL is arguably a better colour space than RGB because you can give more weight to "hue difference" and less to "lightness". In RGB space you need to skew your differences because the eye is better at discerning shades of green than other colours.

这篇关于目标C查找最接近的颜色(rgb)匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆