Relative Luminance - Contrast Ratio - Colour Brightness - Colour Difference - Online Calculator

This is an online calculator for the relative luminance, the contrast ratio, the colour brightness and the colour difference of two RGB colours.

It was created to understand and facilitate some work related to the W3C Web Content Accessibility Guidelines (WCAG) 2.0, especially the success criterion 1.4.3: Contrast (Minimum).
Colour Input
Foreground
RGB #
Background
RGB #

ColoursForeground: #FFFF00RGB: 255 255 0 

Background: #00FF00RGB: 0 255 0 

Relative Luminance
The relative brightness of any point in a colorspace, normalized to 0 for darkest black and 1 for lightest white. [w3.org]

To understand the formular behind the above link, this php-function might help:

function adjustValue($val) {
// Parameter $val:
// Hexadecimal value of colour component (00-FF)

	$val = hexdec($val)/255;
	if ($val <= 0.03928) {
		$val = $val / 12.92;
	} else {
		$val = pow((($val + 0.055) / 1.055), 2.4);
	}
	return $val;
} 

->  Luminance = (0.2126 × red) + (0.7152 × green) + (0.0722 × blue) 
Foreground: 0.93
Background: 0.72
Difference: 0.2126

Luminosity Contrast Ratio
(L1 + 0.05) / (L2 + 0.05)
where L1 is the relative luminance of the lighter of the colors, and L2 is the relative luminance of the darker of the colors. Contrast ratios can range from 1 to 21 (commonly written 1:1 to 21:1). [w3.org]
1.28:1

Colour Brightness
Colour brightness is:
[ (Red * 299) + (Green * 587) + (Blue * 114) ] / 1000
[paciellogroup.com]
Foreground: 225.93
Background: 149.685
Difference: 76

Colour Difference
Colour difference is determined by the following formula:
( maximum (Red value 1, Red value 2) 
- minimum (Red value 1, Red value 2)) 
+
( maximum (Green value 1, Green value 2) 
- minimum (Green value 1, Green value 2))
+ 
( maximum (Blue value 1, Blue value 2) 
- minimum (Blue value 1, Blue value 2))
The difference between the background colour and the foreground colour should be greater than 500. [paciellogroup.com]
255