Convert HEX to closest X11 Color Number

后端 未结 5 1808
醉梦人生
醉梦人生 2021-02-01 08:43

I\'m looking for a Algorithm/Way to convert given HEX (e.g. #111111 R:0x11, G:0x11, B:0x11) to the closest X11 color number (Terminal is either 88 or 256 colors) using either Py

5条回答
  •  春和景丽
    2021-02-01 09:36

    Once you know the RGB values of the X11 colors, you can determine to which of those colors a given input color is "nearest".

    There is a good, quick measure of color distance here

    https://stackoverflow.com/a/74033/141172

提交回复
热议问题