Tag: ColorUtils

  • Black or white text on a colour background?

    Black or white text on a colour background?

    Written by

    in

    How to calculate programmatically whether black text or white text is more readable on a colour background? Here are some algorithms to calculate the brightness of a color. The example code is written in PHP, but you should be able to adapt the code examples to any other programming language. All of the algorithmns are…

    Read more

  • PHP ColorUtils

    PHP ColorUtils

    Written by

    in

    A neat collection of useful methods to convert colors between different color spaces is available on GitHub (MIT License). It can convert any values between RGB, HSL, CMYK, YUV and HEX colors. I created a ready-to-use php class out of this method collection: https://github.com/mixable/color-utils Usage The methods itself are mostly self-explaining. To use the class,…

    Read more