I have a color in hex format ex (c3d8f7 (light blue), 303f5a (dark blue)). How to find out if that color is light or dark?
Asked
Active
Viewed 1,265 times
1 Answers
3
Very rough algorithm: Convert the color to HSV and check e.g. if V
is above (light) 75% or below (dark) 25%.

Ocaso Protal
- 19,362
- 8
- 76
- 83
-
Are you know a function in javascript to convert hex to hsv? – StoneHeart Jan 20 '12 at 14:45
-
1This link should help: http://matthaynes.net/blog/2008/08/07/javascript-colour-functions/ – Ocaso Protal Jan 20 '12 at 14:51
-
@sam360 See: http://stackoverflow.com/questions/359612/how-to-change-rgb-color-to-hsv (and maybe http://stackoverflow.com/questions/74148/how-to-convert-numbers-between-hexadecimal-and-decimal-in-c) – Ocaso Protal Aug 21 '14 at 12:56