~ By washing machine:
Washing by hand is always the best choice, but if machine is your only option, skip the detergent or at least use one that doesn’t contain bleach at 30°C.
~ With vinegar:
Water itself will wash away your denim’s dye over time, and soap will only hasten the process.
By soaking your jeans in cold water with vinegar, prevents the lose of indigo dye keeping the original dark colour for a longer time. Add one cup of distilled white vinegar to a cold water bath and soak your jeans for about an hour. Remove from water and hang dry, ideally outdoors and in the sun. Τhe odor of vinegar goes away after your pants dry.
And if you must use a washing machine, toss in a cup of vinegar on a hand-wash setting with no detergent.