Im having trouble getting the correct translation of the sentence because of the で particle, i dont know if its being use as a particle or is the imperative form of 元気
The で is a particle. According to 明鏡国語辞典:
The で expresses 動作を行うときの様態, the manner of an action, how or in what manner an action is done.
In 「元気で過ごす」, 「元気で」 (vigorously, cheerfully, healthily) describes how the action 「過ごす」 (spend the day) is done.
the imperative form of 元気
元気 is a noun or na-adjective, so it has no imperative form, at least in the modern Japanese grammar.
で in the above sentence is used as a particle not as the imperative form of 元気.
"で is a case particle that indicates state or condition of action" in the given sentence, which is made from にて by a euphonic change.
These explanations are written here as:
The given sentence could be written as: