What exactly is BGR color space?

Its about endianness. RGB is a byte-order. But a deliberate implementation choice of most vanilla Graphics libraries is that they treat colours as unsigned 32-bit integers internally, with the three (or four, as alpha is typically included) components packed into the integer. On a little-endian machine (such as x86) the integer 0x01020304 will actually be … Read more

Android L – Material design on SwipeRefreshLayout color scheme

The Material design spec has been updated with the new guidelines for the swipe to refresh pattern. As of revision 21 of the support library, SwipeRefreshLayout now displays a circular indicator. When you start swiping down, the indicator has an arrow (which suggests refreshing). When you release it, it loses the arrow and starts spinning. … Read more

detect color space with openCV

Unfortunately, OpenCV doesn’t provide any sort of indication as to the color space in the IplImage structure, so if you blindly pick up an IplImage from somewhere there is just no way to know how it was encoded. Furthermore, no algorithm can definitively tell you if an image should be interpreted as HSV vs. RGB … Read more

Converting hex color to RGB and vice-versa

In python: def hex_to_rgb(value): “””Return (red, green, blue) for the color given as #rrggbb.””” value = value.lstrip(‘#’) lv = len(value) return tuple(int(value[i:i + lv // 3], 16) for i in range(0, lv, lv // 3)) def rgb_to_hex(red, green, blue): “””Return color as #rrggbb for the given color values.””” return ‘#%02x%02x%02x’ % (red, green, blue) hex_to_rgb(“#ffffff”) … Read more

Are web-safe colors still relevant?

For me web safe color palette is no longer primary concern. Optimize for the largest target audience. According to w3schools site visitors: In January 2009 1% of site visitors had 256 color displays, 95% of users had 24 or 32 bit. [Update] In January 2015 0.5% had 256 colours, 0.5% had 24 bit and 99% … Read more

RGB to HSL conversion

I’ve been reading several wiki pages and checking different calculations, and creating visualizations of RGB cube projection onto a hexagon. And I’d like to post my understanding of this conversion. Since I find this conversion (representations of color models using geometric shapes) interesting, I’ll try to be as thorough as I can be. First, let’s … Read more

How to find good looking font color if background color is known? [closed]

If you need an algorithm, try this: Convert the color from RGB space to HSV space (Hue, Saturation, Value). If your UI framework can’t do it, check this article: http://en.wikipedia.org/wiki/HSL_and_HSV#Conversion_from_RGB_to_HSL_or_HSV Hue is in [0,360). To find the “opposite” color (think colorwheel), just add 180 degrees: h = (h + 180) % 360; For saturation and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)