My father is color blind and given that I work in games where the visuals are important, I\'ve always wanted to write a filter for screen shots (or even some type of shader) tha
I have these transformations and code explained in detail on my color blindness page. Essentially, for each type of color blindness you first linearize the RGB values then apply a transformation matrix (this is a product of 5 matrices that I list individually) and then clip to [0,1] and de-linearize back to sRGB.
For example, for deuteranopia, the matrix product is
0.33066007 0.66933993 0
0.33066007 0.66933993 0
-0.02785538 0.02785538 1
This is a combination of: rgb -> XYZ -> LMS -> deuteranopia correction -> XYZ -> rgb.
You can download my R code that illustrates these calculations.