I am working on one project where I want people to have choice of visualizing graphs and illustrations in 'Color-blind' scale (design should emulate colors which will be visible to color-blind person). This is to avoid use of any 'bad' colors which can confuse color-blind person (Protanopia, Deuteranopia etc.) There are indeed many plugins and websites which provide option to emulate such thing. However, I want to know the actual transformation equations so that I can use them anywhere and not rely on such third party plugins.
I found some posts related to this but they are essentially asking for ready-made colors or palette. I tried searching for such transformation equations but couldn't find it. It will be great if someone can tell me how to do this transformation or point me to appropriate resource.
Note: I am NOT looking for third party website/plugin/package which does this neither looking for color-blind safe palettes. I am searching for theory behind this conversion.