colourPair

Undocumented in source. Be warned that the author may not have intended to support it.
ColourPair!(Foreground, Background)
colourPair
(
Foreground
Background
)
(
Foreground foreground
,
Background background
)
if (
isColourFormat!Foreground &&
isColourFormat!Background
)

Examples

import std.math : isClose;
with(colourPair(RGB888(0, 0, 0), RGB888(255, 255, 255))) {
	assert(contrast.isClose(21.0));
	assert(meetsWCAGAACriteria);
	assert(meetsWCAGAAACriteria);
}
with(colourPair(RGB888(255, 255, 255), RGB888(255, 255, 255))) {
	assert(contrast.isClose(1.0));
	assert(!meetsWCAGAACriteria);
	assert(!meetsWCAGAAACriteria);
}
with(colourPair(RGB888(0, 128, 255), RGB888(0, 0, 0))) {
	assert(contrast.isClose(5.5316685936));
	assert(meetsWCAGAACriteria);
	assert(!meetsWCAGAAACriteria);
}
with(colourPair(BGR555(0, 16, 31), RGB888(0, 0, 0))) {
	assert(contrast.isClose(5.7235463090));
	assert(meetsWCAGAACriteria);
	assert(!meetsWCAGAAACriteria);
}

Meta