I'm looking for some kind of formula or algorithm to determine the brightness of a color given the rgb values. I know it can't be as simple as adding the rgb values together and having higher sums Blue = &hb7dee8 results in a completely different color.

I'm trying to write a function to shift the hue of an rgb color. Specifically i'm using it in an ios app, but the math is universal. The graph below shows how the r, g, and b values change with re