public float this[int index] { get { switch(index) { case 0: return R; case 1: return G; case 2: return B; default: return 0; } } set { switch(index) { case 0: R = value; break; case 1: G = value; break; case 2: B = value; break; } } }