how to deal with gamma on screens?

hi i was using gamma ramp but i know this couldded be done in a better way because messing with the gamma ramp is ok but if my game crashed then the gamma wont restore back

also i would like to have more flexibiliti
should i use a pixel shader? kind of post-processing?

any exampels?

what is the best method for playing with the gamma contrast etc of everything that is being renderet?