There is nothing wrong with exposing oneself to the rays of the sun or going to tanning salons for the purpose of changing the colour of the skin and making it darker, because this is a temporary change, like dyeing the hair or putting henna on the hands.
Al-Qurtubi (may Allah have mercy on him) said: All of these things [plucking eyebrows/facial hair, getting tattoos and so on] are things which the hadeeths testify that the one who does that is cursed and that they are major sins, but there is a difference of scholarly opinion as to the reason why they are forbidden. It was said that it is because they come under the heading of deception or that they come under the heading of altering the creation of Allah, may He be exalted, as Ibn Mas‘ood said, and this is the more correct opinion which also includes the first opinion. Then it was said that what is prohibited is only that which is permanent, because that comes under the heading of altering the creation of Allah, may He be exalted. As for that which is not permanent, such as kohl and adorning oneself with it in the case of women, the scholars said that this is permissible.
End quote from Tafseer al-Qurtubi, 5/393
In the case of tanning salons, if the one who goes there is a woman, it is stipulated that it should be safe from the gaze of men. Even though we say that it is permissible, it is better for the Muslim woman to avoid this frivolity on which money is spent without much benefit.
And Allah knows best.