Although some forms of ocular pathology can result in disturbance of color vision, as can some changes associated with aging, nearly all color deficiency of significant degree is hereditary, congenital (you're born with it), and permanent.
The commonest forms of congenital defective color vision, the red-green deficiencies, are due to "sex-linked X chromosomes" and "simple recessive hereditary traits". Men are mainly affected because women have two X chromosomes and men have only one X and a Y chromosome. If a man's one X chromosome is color defective he will be color deficient, where as , a woman must inherit two color defective X chromosomes to be color deficient. For a woman to be color deficient, her father must be colorblind and her mother colorblind or be a carrier. All possible patterns of inheritance of any one of these color defects are shown here:
A color-defective male always inherits his deficiency from his mother, who usually has normal color vision and is therefore a carrier of the defect. She may have received her color-deficiency gene from either her father (but only if he was color defective), or from her mother (who could have been a carrier herself, or rarely, who was color-defective).
Another color deficiency "blue-yellow defect" also exists, but need not be discussed here because of it's comparative rarity and lack of commonly available tests for blue-yellow abnormalities.