Casting a int as a enum

I have a enum of colors.

Please show how this is defined.

I'm using this when calling certain functions of a class.

Which class?

the thing is i want to also be able to call those functions but use a int in place of the enum.

Do you have control over the class? The class members should be defined to take ints as input. Then, you could pass an int or an enumerated value.

Basically so i can map a analog input to the enum range

This should be easy.

and also select it that way.

"it"? What is "it" that you are trying to select?