[Flash 10+]

October 2014

Enlarge your target Enhance your accessibility

According to colourblindawareness website you can learn that 1 in 12 men (8%) and 1 in 200 women in the world are affected.

Here is a list of ColorMatrixFilter you can apply on your gameView.

package
{
import flash.filters.ColorMatrixFilter;

/**
* ...
* @author YopSolo
*/
public class ColorBlindFilter
{
private const _NONE:ColorMatrixFilter = null;
private const _PROTANOPIA:ColorMatrixFilter = null;
private const _PROTANOMALY:ColorMatrixFilter = null;
private const _DEUTERANOPIA:ColorMatrixFilter = null;
private const _DEUTERANOMALY:ColorMatrixFilter = null;
private const _TRITANOPIA:ColorMatrixFilter = null;
private const _TRITANOMALY:ColorMatrixFilter = null;
private const _ACHROMATOPSIA:ColorMatrixFilter = null;
private const _ACHROMATOMALY:ColorMatrixFilter = null;

public function ColorBlindFilter()
{}

public static function get list():Array
{
return [
"NONE",
"PROTANOPIA",
"PROTANOMALY",
"DEUTERANOPIA",
"DEUTERANOMALY",
"TRITANOPIA",
"TRITANOMALY",
"ACHROMATOPSIA",
"ACHROMATOMALY"
];
}

public static function get NONE():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 1, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get PROTANOPIA():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.567, 0.433, 0.0, 0, 0,
0.558, 0.442, 0.0, 0, 0,
0.0  , 0.242, 0.758, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get PROTANOMALY():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.817, 0.183, 0.0, 0, 0,
0.333, 0.667, 0.0, 0, 0,
0.0  , 0.125 ,0.875, 0, 0,
0, 0, 0, 1, 0,
]);
}

public static function get DEUTERANOPIA():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.625, 0.375, 0.0, 0, 0,
0.7  , 0.3  , 0.0, 0, 0,
0.0  , 0.3   ,0.7, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get DEUTERANOMALY():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.8  , 0.2  , 0.0, 0, 0,
0.258, 0.742, 0.0, 0, 0,
0.0  , 0.142 ,0.858, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get TRITANOPIA():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.95 , 0.05 , 0.0, 0, 0,
0.0  , 0.433, 0.567, 0, 0,
0.0  , 0.475 ,0.525, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get TRITANOMALY():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.967, 0.033, 0.0, 0, 0,
0.0  , 0.733, 0.267, 0, 0,
0.0  , 0.183 ,0.817, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get ACHROMATOPSIA():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.299, 0.587, 0.114, 0, 0,
0.299, 0.587, 0.114, 0, 0,
0.299, 0.587 ,0.114, 0, 0,
0, 0, 0, 1, 0
]);
}

public static function get ACHROMATOMALY():ColorMatrixFilter
{
return new ColorMatrixFilter(	[	0.618, 0.320, 0.062, 0, 0,
0.163, 0.775, 0.062, 0, 0,
0.163, 0.320 ,0.516, 0, 0,
0, 0, 0, 1, 0
]);
}
}

}