/// <summary> /// This will build a color from an float from 0.0 - 1.0. /// It will have 0,0,0,1 Exept for what you change. /// </summary> /// <param name="value"> The float value between 0.0 - 1.0 </param> /// <param name="colType"> Lets you specify a colour type. </param> /// <returns> The built color from values passed to it </returns> public static Color BuildSingleColour(float value, ColourRGBAType colType) { var c = new Color(0f, 0f, 0f, 1f); switch (colType) { case ColourRGBAType.Red: c.r = value; return(c); case ColourRGBAType.Green: c.g = value; return(c); case ColourRGBAType.Blue: c.b = value; return(c); case ColourRGBAType.Alpha: c.a = value; return(c); } return(c); }
/// <summary> /// This will build a color from three float values. /// It will have 0,0,0,1 Exept for what you change. /// </summary> /// <param name="valueOne"> The first int value between 0 - 1 </param> /// <param name="valueTwo"> The second value between 0 - 1 </param> /// <param name="valueThree"> The third value between 0 - 1 </param> /// <param name="colType"> Lets you specify a colour type to exclude. </param> /// <returns>The built color from values passed to it</returns> public static Color BuildColourWithoutType(float valueOne, float valueTwo, float valueThree, ColourRGBAType colType) { var c = new Color(0f, 0f, 0f, 1f); switch (colType) { case ColourRGBAType.Red: c.g = valueOne; c.b = valueTwo; c.a = valueThree; return(c); case ColourRGBAType.Green: c.r = valueOne; c.b = valueTwo; c.a = valueThree; return(c); case ColourRGBAType.Blue: c.r = valueOne; c.g = valueTwo; c.a = valueThree; return(c); case ColourRGBAType.Alpha: c.r = valueOne; c.g = valueTwo; c.b = valueThree; return(c); } return(c); }
/// <summary> /// This will build a color from three Int values divided by 255. /// It will have 0,0,0,1 Exept for what you change. /// </summary> /// <param name="valueOne"> The first int value between 0 - 255 </param> /// <param name="valueTwo"> The second value between 0 - 255 </param> /// <param name="valueThree"> The third value between 0 - 255 </param> /// <param name="colType"> Lets you specify a colour type to exclude. </param> /// <returns>The built color from values passed to it</returns> public static Color BuildColourWithoutType255(byte valueOne, byte valueTwo, byte valueThree, ColourRGBAType colType) { var c = new Color(0f, 0f, 0f, 1f); switch (colType) { case ColourRGBAType.Red: c.g = valueOne / 255; c.b = valueTwo / 255; c.a = valueThree / 255; return(c); case ColourRGBAType.Green: c.r = valueOne / 255; c.b = valueTwo / 255; c.a = valueThree / 255; return(c); case ColourRGBAType.Blue: c.r = valueOne / 255; c.g = valueTwo / 255; c.a = valueThree / 255; return(c); case ColourRGBAType.Alpha: c.r = valueOne / 255; c.g = valueTwo / 255; c.b = valueThree / 255; return(c); } return(c); }