color helper notes/api calls

you can make api calls by setting the GET variable, "api". api calls are returned in the form of JSON. this tool is creative commons by-nc-sa 3.0. please don't flood the servers.

example call (http://michaeltang.me/color/color.php?api=inputString):

{
	"text":"inputString",
	"color":"#3d922f",
	"textcolor":"#000000",
	"perceivedbrightness":"0.71791346175016"
}
text

text is the input string passed through the url

color

color value is calculated using the input string (case-insensitive) and a one-way function that outputs a color code (reimplementation of md5 hash).

textcolor

text color reads the preceivedbrightness value and outputs black (#000000) or white (#FFFFFF) based on a threshold of 0.51.

perceivedbrightness

perceivedbrightness value determines approximate brightness of a color (from a range of 0 to 1) and is calculated with the color using the formula (from http://alienryderflex.com/hsp.html):

brightness = sqrt((0.299 * red ^ 2) + (0.587 * green ^ 2) + (0.114 * blue ^ 2));

yes, this page is ugly. i'm sorry.

back to the fun