Detect similar colours from hex values

后端 未结 2 680
我在风中等你
我在风中等你 2021-02-04 17:36

Does anyone know of a way of taking two hex colour values and returning some kind of index to say how similar the colours are? e.g two shades of yellow might return a higher ind

2条回答
  •  孤街浪徒
    2021-02-04 18:19

    I've been searching Pascal code for a solution.

    I dropped the Pascal restriction and found this question.

    The Red(), Green() and Blue() functions replace the "parseInt"s.

    Result:=(R/255+G/255+B/255)/3
    

    replaced

    r /= 255;
    g /= 255;
    b /= 255;
    return (r + g + b) / 3;
    

    Bazza

提交回复
热议问题