Potatoes produce glycoalkaloids when they are exposed to light. Glycoalkaloids are very toxic when consumed. If you notice a greenish tinge under the skin, then that a potato surely contains harmful glycoalkaloids, specifically solanine and chaconine. Regrettably, these toxins may be present even if the potatoes do not have any green tinge on them.
Glycoalkaloids are known to harm your digestive health and increase inflammatory bowel disease. Some even experience itchiness and drowsiness due to them. So it is necessary to limit the exposure of potatoes to light in order to minimize the production of these toxins. Around 60-70% of the glycoalkaloid is in the peel of the potatoes. So you can peel the potatoes before eating them, but the peel is what essentially makes the potato healthy since it contains most of the fiber.