This structure has been designed to extend Mogre's native Colourvalue structure. It has static fields for all known colors and convert .Net colors to ogre colours (and vise versa).
Most of the helper class is based on Axiom's colourvalue class.
Table of contents
How to add to your project
The helper class is a single code file. There is a VB.Net and a C# version available.
Name the code file: ColorEx.vb or ColorEx.cs
#Region "LGPL License" ' 'Axiom Graphics Engine Library 'Copyright (C) 2003-2006 Axiom Project Team ' 'The overall design, and a majority of the core engine and rendering code 'contained within this library is a derivative of the open source Object Oriented 'Graphics Engine OGRE, which can be found at http://ogre.sourceforge.net. 'Many thanks to the OGRE team for maintaining such a high quality project. ' 'This library is free software; you can redistribute it and/or 'modify it under the terms of the GNU Lesser General Public 'License as published by the Free Software Foundation; either 'version 2.1 of the License, or (at your option) any later version. ' 'This library is distributed in the hope that it will be useful, 'but WITHOUT ANY WARRANTY; without even the implied warranty of 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 'Lesser General Public License for more details. ' 'You should have received a copy of the GNU Lesser General Public 'License along with this library; if not, write to the Free Software 'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ' #End Region #Region "SVN Version Information" ' <file> ' <license see="http://axiomengine.sf.net/wiki/index.php/license.txt"/> ' <id value="$Id: colourvalue.cs 1756 2009-09-10 10:15:10Z borrillis $"/> ' </file> #End Region #Region "Namespace Declarations" Imports System Imports Mogre #End Region ''' <summary> ''' This class is necessary so we can store the color components as floating ''' point values in the range [0,1]. It serves as an intermediary to System.Drawing.Color, which ''' stores them as byte values. This doesn't allow for slow color component ''' interpolation, because with the values always being cast back to a byte would lose ''' any small interpolated values (i.e. 223 - .25 as a byte is 223). ''' </summary> Public Structure ColorEx Implements IComparable #Region "Member variables" ''' <summary> ''' Alpha value [0,1]. ''' </summary> Public a As Single ''' <summary> ''' Red color component [0,1]. ''' </summary> Public r As Single ''' <summary> ''' Green color component [0,1]. ''' </summary> Public g As Single ''' <summary> ''' Blue color component [0,1]. ''' </summary> Public b As Single #End Region #Region "Constructors" ''' <summary> ''' Constructor taking RGB values ''' </summary> ''' <param name="r">Red color component.</param> ''' <param name="g">Green color component.</param> ''' <param name="b">Blue color component.</param> Public Sub New(ByVal r As Single, ByVal g As Single, ByVal b As Single) Me.New(1.0F, r, g, b) End Sub ''' <summary> ''' Create a new colourvalue from a .Net color ''' </summary> ''' <param name="Color"></param> ''' <remarks></remarks> Public Sub New(ByVal Color As Drawing.Color) Me.New(Color.R, Color.G, Color.B) End Sub ''' <summary> ''' Constructor taking all component values. ''' </summary> ''' <param name="a">Alpha value.</param> ''' <param name="r">Red color component.</param> ''' <param name="g">Green color component.</param> ''' <param name="b">Blue color component.</param> Public Sub New(ByVal a As Single, ByVal r As Single, ByVal g As Single, ByVal b As Single) 'Contract.Requires(a >= 0.0F AndAlso a <= 1.0F) 'Contract.Requires(r >= 0.0F AndAlso r <= 1.0F) 'Contract.Requires(g >= 0.0F AndAlso g <= 1.0F) 'Contract.Requires(b >= 0.0F AndAlso b <= 1.0F) Me.a = a Me.r = r Me.g = g Me.b = b End Sub ''' <summary> ''' Copy constructor. ''' </summary> ''' <param name="other">The colourvalue instance to copy</param> Public Sub New(ByVal other As ColourValue) Me.New(other.a, other.r, other.g, other.b) End Sub Public Function FromColor(ByVal Color As Drawing.Color) As ColourValue Return New ColourValue(Color.R / 255, Color.G / 255, Color.B / 255) End Function #End Region #Region "Methods" ''' <summary> ''' Returns a copy of this colourvalue instance. ''' </summary> ''' <returns></returns> Public Function Clone() As ColourValue Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = Me.a retVal.r = Me.r retVal.g = Me.g retVal.b = Me.g Return retVal End Function ''' <summary> ''' Converts this instance to a <see cref="System.Drawing.Color"/> structure. ''' </summary> Public Function ToColor() As System.Drawing.Color Return System.Drawing.Color.FromArgb((a * 255.0F), (r * 255.0F), (g * 255.0F), (b * 255.0F)) End Function Public Function ToRGBA() As Integer Dim result As Integer = 0 result += CInt((r * 255.0F)) << 24 result += CInt((g * 255.0F)) << 16 result += CInt((b * 255.0F)) << 8 result += CInt((a * 255.0F)) Return result End Function ''' <summary> ''' Converts this color value to packed ABGR format. ''' </summary> ''' <returns></returns> Public Function ToABGR() As Integer Dim result As Integer = 0 result += CInt((a * 255.0F)) << 24 result += CInt((b * 255.0F)) << 16 result += CInt((g * 255.0F)) << 8 result += CInt((r * 255.0F)) Return result End Function ''' <summary> ''' Converts this color value to packed ARBG format. ''' </summary> ''' <returns></returns> Public Function ToARGB() As Integer Dim result As Integer = 0 result += CInt((a * 255.0F)) << 24 result += CInt((r * 255.0F)) << 16 result += CInt((g * 255.0F)) << 8 result += CInt((b * 255.0F)) Return result End Function ''' <summary> ''' Populates the color components in a 4 elements array in RGBA order. ''' </summary> ''' <remarks> ''' Primarily used to help in OpenGL. ''' </remarks> Public Sub ToArrayRGBA(ByVal vals As Single()) vals(0) = r vals(1) = g vals(2) = b vals(3) = a End Sub Public Function ToColorValue() As ColourValue Return New ColourValue(Me.r, Me.g, Me.b) End Function #End Region Public Sub AA() Dim MyMogrePurple As New ColourValue(0.5019608F, 0.0F, 0.5019608F, 1.0F) Dim purple As Color = New ColorEx(MyMogrePurple).ToColor End Sub #Region "Static color properties" ''' <summary> ''' The color Transparent. ''' </summary> Public Shared ReadOnly Property Transparent() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 0.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color AliceBlue. ''' </summary> Public Shared ReadOnly Property AliceBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.972549F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color AntiqueWhite. ''' </summary> Public Shared ReadOnly Property AntiqueWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9215686F retVal.b = 0.8431373F Return retVal End Get End Property ''' <summary> ''' The color Aqua. ''' </summary> Public Shared ReadOnly Property Aqua() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Aquamarine. ''' </summary> Public Shared ReadOnly Property Aquamarine() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4980392F retVal.g = 1.0F retVal.b = 0.8313726F Return retVal End Get End Property ''' <summary> ''' The color Azure. ''' </summary> Public Shared ReadOnly Property Azure() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Beige. ''' </summary> Public Shared ReadOnly Property Beige() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.9607843F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color Bisque. ''' </summary> Public Shared ReadOnly Property Bisque() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.7686275F Return retVal End Get End Property ''' <summary> ''' The color Black. ''' </summary> Public Shared ReadOnly Property Black() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color BlanchedAlmond. ''' </summary> Public Shared ReadOnly Property BlanchedAlmond() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9215686F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color Blue. ''' </summary> Public Shared ReadOnly Property Blue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color BlueViolet. ''' </summary> Public Shared ReadOnly Property BlueViolet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5411765F retVal.g = 0.1686275F retVal.b = 0.8862745F Return retVal End Get End Property ''' <summary> ''' The color Brown. ''' </summary> Public Shared ReadOnly Property Brown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6470588F retVal.g = 0.1647059F retVal.b = 0.1647059F Return retVal End Get End Property ''' <summary> ''' The color BurlyWood. ''' </summary> Public Shared ReadOnly Property BurlyWood() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8705882F retVal.g = 0.7215686F retVal.b = 0.5294118F Return retVal End Get End Property ''' <summary> ''' The color CadetBlue. ''' </summary> Public Shared ReadOnly Property CadetBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.372549F retVal.g = 0.6196079F retVal.b = 0.627451F Return retVal End Get End Property ''' <summary> ''' The color Chartreuse. ''' </summary> Public Shared ReadOnly Property Chartreuse() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4980392F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Chocolate. ''' </summary> Public Shared ReadOnly Property Chocolate() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8235294F retVal.g = 0.4117647F retVal.b = 0.1176471F Return retVal End Get End Property ''' <summary> ''' The color Coral. ''' </summary> Public Shared ReadOnly Property Coral() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.4980392F retVal.b = 0.3137255F Return retVal End Get End Property ''' <summary> ''' The color CornflowerBlue. ''' </summary> Public Shared ReadOnly Property CornflowerBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.3921569F retVal.g = 0.5843138F retVal.b = 0.9294118F Return retVal End Get End Property ''' <summary> ''' The color Cornsilk. ''' </summary> Public Shared ReadOnly Property Cornsilk() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.972549F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color Crimson. ''' </summary> Public Shared ReadOnly Property Crimson() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8627451F retVal.g = 0.07843138F retVal.b = 0.2352941F Return retVal End Get End Property ''' <summary> ''' The color Cyan. ''' </summary> Public Shared ReadOnly Property Cyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color DarkBlue. ''' </summary> Public Shared ReadOnly Property DarkBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkCyan. ''' </summary> Public Shared ReadOnly Property DarkCyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5450981F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkGoldenrod. ''' </summary> Public Shared ReadOnly Property DarkGoldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7215686F retVal.g = 0.5254902F retVal.b = 0.04313726F Return retVal End Get End Property ''' <summary> ''' The color DarkGray. ''' </summary> Public Shared ReadOnly Property DarkGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6627451F retVal.g = 0.6627451F retVal.b = 0.6627451F Return retVal End Get End Property ''' <summary> ''' The color DarkGreen. ''' </summary> Public Shared ReadOnly Property DarkGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.3921569F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkKhaki. ''' </summary> Public Shared ReadOnly Property DarkKhaki() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7411765F retVal.g = 0.7176471F retVal.b = 0.4196078F Return retVal End Get End Property ''' <summary> ''' The color DarkMagenta. ''' </summary> Public Shared ReadOnly Property DarkMagenta() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.0F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkOliveGreen. ''' </summary> Public Shared ReadOnly Property DarkOliveGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.3333333F retVal.g = 0.4196078F retVal.b = 0.1843137F Return retVal End Get End Property ''' <summary> ''' The color DarkOrange. ''' </summary> Public Shared ReadOnly Property DarkOrange() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.5490196F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkOrchid. ''' </summary> Public Shared ReadOnly Property DarkOrchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6F retVal.g = 0.1960784F retVal.b = 0.8F Return retVal End Get End Property ''' <summary> ''' The color DarkRed. ''' </summary> Public Shared ReadOnly Property DarkRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color DarkSalmon. ''' </summary> Public Shared ReadOnly Property DarkSalmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9137255F retVal.g = 0.5882353F retVal.b = 0.4784314F Return retVal End Get End Property ''' <summary> ''' The color DarkSeaGreen. ''' </summary> Public Shared ReadOnly Property DarkSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5607843F retVal.g = 0.7372549F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkSlateBlue. ''' </summary> Public Shared ReadOnly Property DarkSlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.282353F retVal.g = 0.2392157F retVal.b = 0.5450981F Return retVal End Get End Property ''' <summary> ''' The color DarkSlateGray. ''' </summary> Public Shared ReadOnly Property DarkSlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1843137F retVal.g = 0.3098039F retVal.b = 0.3098039F Return retVal End Get End Property ''' <summary> ''' The color DarkTurquoise. ''' </summary> Public Shared ReadOnly Property DarkTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.8078431F retVal.b = 0.8196079F Return retVal End Get End Property ''' <summary> ''' The color DarkViolet. ''' </summary> Public Shared ReadOnly Property DarkViolet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5803922F retVal.g = 0.0F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color DeepPink. ''' </summary> Public Shared ReadOnly Property DeepPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.07843138F retVal.b = 0.5764706F Return retVal End Get End Property ''' <summary> ''' The color DeepSkyBlue. ''' </summary> Public Shared ReadOnly Property DeepSkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.7490196F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color DimGray. ''' </summary> Public Shared ReadOnly Property DimGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4117647F retVal.g = 0.4117647F retVal.b = 0.4117647F Return retVal End Get End Property ''' <summary> ''' The color DodgerBlue. ''' </summary> Public Shared ReadOnly Property DodgerBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1176471F retVal.g = 0.5647059F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Firebrick. ''' </summary> Public Shared ReadOnly Property Firebrick() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6980392F retVal.g = 0.1333333F retVal.b = 0.1333333F Return retVal End Get End Property ''' <summary> ''' The color FloralWhite. ''' </summary> Public Shared ReadOnly Property FloralWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color ForestGreen. ''' </summary> Public Shared ReadOnly Property ForestGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1333333F retVal.g = 0.5450981F retVal.b = 0.1333333F Return retVal End Get End Property ''' <summary> ''' The color Fuchsia. ''' </summary> Public Shared ReadOnly Property Fuchsia() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Gainsboro. ''' </summary> Public Shared ReadOnly Property Gainsboro() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8627451F retVal.g = 0.8627451F retVal.b = 0.8627451F Return retVal End Get End Property ''' <summary> ''' The color GhostWhite. ''' </summary> Public Shared ReadOnly Property GhostWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.972549F retVal.g = 0.972549F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Gold. ''' </summary> Public Shared ReadOnly Property Gold() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8431373F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Goldenrod. ''' </summary> Public Shared ReadOnly Property Goldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.854902F retVal.g = 0.6470588F retVal.b = 0.1254902F Return retVal End Get End Property ''' <summary> ''' The color Gray. ''' </summary> Public Shared ReadOnly Property Gray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Green. ''' </summary> Public Shared ReadOnly Property Green() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5019608F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color GreenYellow. ''' </summary> Public Shared ReadOnly Property GreenYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6784314F retVal.g = 1.0F retVal.b = 0.1843137F Return retVal End Get End Property ''' <summary> ''' The color Honeydew. ''' </summary> Public Shared ReadOnly Property Honeydew() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 1.0F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color HotPink. ''' </summary> Public Shared ReadOnly Property HotPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.4117647F retVal.b = 0.7058824F Return retVal End Get End Property ''' <summary> ''' The color IndianRed. ''' </summary> Public Shared ReadOnly Property IndianRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8039216F retVal.g = 0.3607843F retVal.b = 0.3607843F Return retVal End Get End Property ''' <summary> ''' The color Indigo. ''' </summary> Public Shared ReadOnly Property Indigo() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2941177F retVal.g = 0.0F retVal.b = 0.509804F Return retVal End Get End Property ''' <summary> ''' The color Ivory. ''' </summary> Public Shared ReadOnly Property Ivory() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.9411765F Return retVal End Get End Property ''' <summary> ''' The color Khaki. ''' </summary> Public Shared ReadOnly Property Khaki() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.9019608F retVal.b = 0.5490196F Return retVal End Get End Property ''' <summary> ''' The color Lavender. ''' </summary> Public Shared ReadOnly Property Lavender() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9019608F retVal.g = 0.9019608F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color LavenderBlush. ''' </summary> Public Shared ReadOnly Property LavenderBlush() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9411765F retVal.b = 0.9607843F Return retVal End Get End Property ''' <summary> ''' The color LawnGreen. ''' </summary> Public Shared ReadOnly Property LawnGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4862745F retVal.g = 0.9882353F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color LemonChiffon. ''' </summary> Public Shared ReadOnly Property LemonChiffon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color LightBlue. ''' </summary> Public Shared ReadOnly Property LightBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6784314F retVal.g = 0.8470588F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color LightCoral. ''' </summary> Public Shared ReadOnly Property LightCoral() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9411765F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color LightCyan. ''' </summary> Public Shared ReadOnly Property LightCyan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8784314F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color LightGoldenrodYellow. ''' </summary> Public Shared ReadOnly Property LightGoldenrodYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9803922F retVal.b = 0.8235294F Return retVal End Get End Property ''' <summary> ''' The color LightGreen. ''' </summary> Public Shared ReadOnly Property LightGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5647059F retVal.g = 0.9333333F retVal.b = 0.5647059F Return retVal End Get End Property ''' <summary> ''' The color LightGray. ''' </summary> Public Shared ReadOnly Property LightGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.827451F retVal.g = 0.827451F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color LightPink. ''' </summary> Public Shared ReadOnly Property LightPink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.7137255F retVal.b = 0.7568628F Return retVal End Get End Property ''' <summary> ''' The color LightSalmon. ''' </summary> Public Shared ReadOnly Property LightSalmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.627451F retVal.b = 0.4784314F Return retVal End Get End Property ''' <summary> ''' The color LightSeaGreen. ''' </summary> Public Shared ReadOnly Property LightSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1254902F retVal.g = 0.6980392F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color LightSkyBlue. ''' </summary> Public Shared ReadOnly Property LightSkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5294118F retVal.g = 0.8078431F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color LightSlateGray. ''' </summary> Public Shared ReadOnly Property LightSlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4666667F retVal.g = 0.5333334F retVal.b = 0.6F Return retVal End Get End Property ''' <summary> ''' The color LightSteelBlue. ''' </summary> Public Shared ReadOnly Property LightSteelBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6901961F retVal.g = 0.7686275F retVal.b = 0.8705882F Return retVal End Get End Property ''' <summary> ''' The color LightYellow. ''' </summary> Public Shared ReadOnly Property LightYellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.8784314F Return retVal End Get End Property ''' <summary> ''' The color Lime. ''' </summary> Public Shared ReadOnly Property Lime() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color LimeGreen. ''' </summary> Public Shared ReadOnly Property LimeGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1960784F retVal.g = 0.8039216F retVal.b = 0.1960784F Return retVal End Get End Property ''' <summary> ''' The color Linen. ''' </summary> Public Shared ReadOnly Property Linen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.9411765F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Magenta. ''' </summary> Public Shared ReadOnly Property Magenta() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color Maroon. ''' </summary> Public Shared ReadOnly Property Maroon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color MediumAquamarine. ''' </summary> Public Shared ReadOnly Property MediumAquamarine() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4F retVal.g = 0.8039216F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color MediumBlue. ''' </summary> Public Shared ReadOnly Property MediumBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color MediumOrchid. ''' </summary> Public Shared ReadOnly Property MediumOrchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7294118F retVal.g = 0.3333333F retVal.b = 0.827451F Return retVal End Get End Property ''' <summary> ''' The color MediumPurple. ''' </summary> Public Shared ReadOnly Property MediumPurple() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5764706F retVal.g = 0.4392157F retVal.b = 0.8588235F Return retVal End Get End Property ''' <summary> ''' The color MediumSeaGreen. ''' </summary> Public Shared ReadOnly Property MediumSeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2352941F retVal.g = 0.7019608F retVal.b = 0.4431373F Return retVal End Get End Property ''' <summary> ''' The color MediumSlateBlue. ''' </summary> Public Shared ReadOnly Property MediumSlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4823529F retVal.g = 0.4078431F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color MediumSpringGreen. ''' </summary> Public Shared ReadOnly Property MediumSpringGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.9803922F retVal.b = 0.6039216F Return retVal End Get End Property ''' <summary> ''' The color MediumTurquoise. ''' </summary> Public Shared ReadOnly Property MediumTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.282353F retVal.g = 0.8196079F retVal.b = 0.8F Return retVal End Get End Property ''' <summary> ''' The color MediumVioletRed. ''' </summary> Public Shared ReadOnly Property MediumVioletRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7803922F retVal.g = 0.08235294F retVal.b = 0.5215687F Return retVal End Get End Property ''' <summary> ''' The color MidnightBlue. ''' </summary> Public Shared ReadOnly Property MidnightBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.09803922F retVal.g = 0.09803922F retVal.b = 0.4392157F Return retVal End Get End Property ''' <summary> ''' The color MintCream. ''' </summary> Public Shared ReadOnly Property MintCream() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 1.0F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color MistyRose. ''' </summary> Public Shared ReadOnly Property MistyRose() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.8823529F Return retVal End Get End Property ''' <summary> ''' The color Moccasin. ''' </summary> Public Shared ReadOnly Property Moccasin() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8941177F retVal.b = 0.7098039F Return retVal End Get End Property ''' <summary> ''' The color NavajoWhite. ''' </summary> Public Shared ReadOnly Property NavajoWhite() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.8705882F retVal.b = 0.6784314F Return retVal End Get End Property ''' <summary> ''' The color Navy. ''' </summary> Public Shared ReadOnly Property Navy() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.0F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color OldLace. ''' </summary> Public Shared ReadOnly Property OldLace() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9921569F retVal.g = 0.9607843F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Olive. ''' </summary> Public Shared ReadOnly Property Olive() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.5019608F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color OliveDrab. ''' </summary> Public Shared ReadOnly Property OliveDrab() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4196078F retVal.g = 0.5568628F retVal.b = 0.1372549F Return retVal End Get End Property ''' <summary> ''' The color Orange. ''' </summary> Public Shared ReadOnly Property Orange() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.6470588F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color OrangeRed. ''' </summary> Public Shared ReadOnly Property OrangeRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.2705882F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color Orchid. ''' </summary> Public Shared ReadOnly Property Orchid() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.854902F retVal.g = 0.4392157F retVal.b = 0.8392157F Return retVal End Get End Property ''' <summary> ''' The color PaleGoldenrod. ''' </summary> Public Shared ReadOnly Property PaleGoldenrod() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9333333F retVal.g = 0.9098039F retVal.b = 0.6666667F Return retVal End Get End Property ''' <summary> ''' The color PaleGreen. ''' </summary> Public Shared ReadOnly Property PaleGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5960785F retVal.g = 0.9843137F retVal.b = 0.5960785F Return retVal End Get End Property ''' <summary> ''' The color PaleTurquoise. ''' </summary> Public Shared ReadOnly Property PaleTurquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6862745F retVal.g = 0.9333333F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color PaleVioletRed. ''' </summary> Public Shared ReadOnly Property PaleVioletRed() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8588235F retVal.g = 0.4392157F retVal.b = 0.5764706F Return retVal End Get End Property ''' <summary> ''' The color PapayaWhip. ''' </summary> Public Shared ReadOnly Property PapayaWhip() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9372549F retVal.b = 0.8352941F Return retVal End Get End Property ''' <summary> ''' The color PeachPuff. ''' </summary> Public Shared ReadOnly Property PeachPuff() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.854902F retVal.b = 0.7254902F Return retVal End Get End Property ''' <summary> ''' The color Peru. ''' </summary> Public Shared ReadOnly Property Peru() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8039216F retVal.g = 0.5215687F retVal.b = 0.2470588F Return retVal End Get End Property ''' <summary> ''' The color Pink. ''' </summary> Public Shared ReadOnly Property Pink() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.7529412F retVal.b = 0.7960784F Return retVal End Get End Property ''' <summary> ''' The color Plum. ''' </summary> Public Shared ReadOnly Property Plum() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8666667F retVal.g = 0.627451F retVal.b = 0.8666667F Return retVal End Get End Property ''' <summary> ''' The color PowderBlue. ''' </summary> Public Shared ReadOnly Property PowderBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6901961F retVal.g = 0.8784314F retVal.b = 0.9019608F Return retVal End Get End Property ''' <summary> ''' The color Purple. ''' </summary> Public Shared ReadOnly Property Purple() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5019608F retVal.g = 0.0F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Red. ''' </summary> Public Shared ReadOnly Property Red() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color RosyBrown. ''' </summary> Public Shared ReadOnly Property RosyBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7372549F retVal.g = 0.5607843F retVal.b = 0.5607843F Return retVal End Get End Property ''' <summary> ''' The color RoyalBlue. ''' </summary> Public Shared ReadOnly Property RoyalBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.254902F retVal.g = 0.4117647F retVal.b = 0.8823529F Return retVal End Get End Property ''' <summary> ''' The color SaddleBrown. ''' </summary> Public Shared ReadOnly Property SaddleBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5450981F retVal.g = 0.2705882F retVal.b = 0.07450981F Return retVal End Get End Property ''' <summary> ''' The color Salmon. ''' </summary> Public Shared ReadOnly Property Salmon() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9803922F retVal.g = 0.5019608F retVal.b = 0.4470588F Return retVal End Get End Property ''' <summary> ''' The color SandyBrown. ''' </summary> Public Shared ReadOnly Property SandyBrown() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9568627F retVal.g = 0.6431373F retVal.b = 0.3764706F Return retVal End Get End Property ''' <summary> ''' The color SeaGreen. ''' </summary> Public Shared ReadOnly Property SeaGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.1803922F retVal.g = 0.5450981F retVal.b = 0.3411765F Return retVal End Get End Property ''' <summary> ''' The color SeaShell. ''' </summary> Public Shared ReadOnly Property SeaShell() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9607843F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color Sienna. ''' </summary> Public Shared ReadOnly Property Sienna() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.627451F retVal.g = 0.3215686F retVal.b = 0.1764706F Return retVal End Get End Property ''' <summary> ''' The color Silver. ''' </summary> Public Shared ReadOnly Property Silver() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.7529412F retVal.g = 0.7529412F retVal.b = 0.7529412F Return retVal End Get End Property ''' <summary> ''' The color SkyBlue. ''' </summary> Public Shared ReadOnly Property SkyBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.5294118F retVal.g = 0.8078431F retVal.b = 0.9215686F Return retVal End Get End Property ''' <summary> ''' The color SlateBlue. ''' </summary> Public Shared ReadOnly Property SlateBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4156863F retVal.g = 0.3529412F retVal.b = 0.8039216F Return retVal End Get End Property ''' <summary> ''' The color SlateGray. ''' </summary> Public Shared ReadOnly Property SlateGray() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.4392157F retVal.g = 0.5019608F retVal.b = 0.5647059F Return retVal End Get End Property ''' <summary> ''' The color Snow. ''' </summary> Public Shared ReadOnly Property Snow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.9803922F retVal.b = 0.9803922F Return retVal End Get End Property ''' <summary> ''' The color SpringGreen. ''' </summary> Public Shared ReadOnly Property SpringGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 1.0F retVal.b = 0.4980392F Return retVal End Get End Property ''' <summary> ''' The color SteelBlue. ''' </summary> Public Shared ReadOnly Property SteelBlue() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2745098F retVal.g = 0.509804F retVal.b = 0.7058824F Return retVal End Get End Property ''' <summary> ''' The color Tan. ''' </summary> Public Shared ReadOnly Property Tan() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8235294F retVal.g = 0.7058824F retVal.b = 0.5490196F Return retVal End Get End Property ''' <summary> ''' The color Teal. ''' </summary> Public Shared ReadOnly Property Teal() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.0F retVal.g = 0.5019608F retVal.b = 0.5019608F Return retVal End Get End Property ''' <summary> ''' The color Thistle. ''' </summary> Public Shared ReadOnly Property Thistle() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.8470588F retVal.g = 0.7490196F retVal.b = 0.8470588F Return retVal End Get End Property ''' <summary> ''' The color Tomato. ''' </summary> Public Shared ReadOnly Property Tomato() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 0.3882353F retVal.b = 0.2784314F Return retVal End Get End Property ''' <summary> ''' The color Turquoise. ''' </summary> Public Shared ReadOnly Property Turquoise() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.2509804F retVal.g = 0.8784314F retVal.b = 0.8156863F Return retVal End Get End Property ''' <summary> ''' The color Violet. ''' </summary> Public Shared ReadOnly Property Violet() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9333333F retVal.g = 0.509804F retVal.b = 0.9333333F Return retVal End Get End Property ''' <summary> ''' The color Wheat. ''' </summary> Public Shared ReadOnly Property Wheat() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.8705882F retVal.b = 0.7019608F Return retVal End Get End Property ''' <summary> ''' The color White. ''' </summary> Public Shared ReadOnly Property White() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 1.0F Return retVal End Get End Property ''' <summary> ''' The color WhiteSmoke. ''' </summary> Public Shared ReadOnly Property WhiteSmoke() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.9607843F retVal.g = 0.9607843F retVal.b = 0.9607843F Return retVal End Get End Property ''' <summary> ''' The color Yellow. ''' </summary> Public Shared ReadOnly Property Yellow() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 1.0F retVal.g = 1.0F retVal.b = 0.0F Return retVal End Get End Property ''' <summary> ''' The color YellowGreen. ''' </summary> Public Shared ReadOnly Property YellowGreen() As ColourValue Get Dim retVal As New ColourValue(0, 0, 0, 0) retVal.a = 1.0F retVal.r = 0.6039216F retVal.g = 0.8039216F retVal.b = 0.1960784F Return retVal End Get End Property 'TODO : Move this to StringConverter Public Shared Function Parse_0_255_String(ByVal parsableText As String) As ColourValue Dim retVal As New ColourValue(0, 0, 0, 0) If parsableText Is Nothing Then Throw New ArgumentException("The parsableText parameter cannot be null.") End If Dim vals As String() = parsableText.TrimStart("("c, "["c, "<"c).TrimEnd(")"c, "]"c, ">"c).Split(","c) If vals.Length < 3 Then Throw New FormatException(String.Format("Cannot parse the text '{0}' because it must of the form (r,g,b) or (r,g,b,a)", parsableText)) End If 'float r, g, b, a; Try retVal.r = Integer.Parse(vals(0).Trim()) / 255.0F retVal.g = Integer.Parse(vals(1).Trim()) / 255.0F retVal.b = Integer.Parse(vals(2).Trim()) / 255.0F If vals.Length = 4 Then retVal.a = Integer.Parse(vals(3).Trim()) / 255.0F Else retVal.a = 1.0F End If Catch e As Exception Throw New FormatException("The parts of the colourvalue in Parse_0_255 must be integers") End Try Return retVal End Function 'TODO : Move this to StringConverter Public Function To_0_255_String() As String Return String.Format("({0},{1},{2},{3})", CInt((r * 255.0F)), CInt((g * 255.0F)), CInt((b * 255.0F)), CInt((a * 255.0F))) End Function #End Region #Region "Object overloads" ''' <summary> ''' Override GetHashCode. ''' </summary> ''' <remarks> ''' Done mainly to quash warnings, no real need for it. ''' </remarks> ''' <returns></returns> Public Overloads Overrides Function GetHashCode() As Integer Return Me.ToARGB() End Function Public Overloads Overrides Function ToString() As String Return Me.To_0_255_String() End Function Overloads Shared Narrowing Operator CType(ByVal ColourValue As ColourValue) As ColorEx Return New ColorEx(ColourValue) End Operator Overloads Shared Narrowing Operator CType(ByVal ColorEx As ColorEx) As ColourValue Return ColorEx.ToColorValue End Operator Overloads Shared Narrowing Operator CType(ByVal ColorEx As ColorEx) As Color Return ColorEx.ToColor End Operator Public Shared Function ToColor(ByVal ColourValue As Mogre.ColourValue) As Color Return New ColorEx(ColourValue).ToColor End Function Public Shared Function ToColourValue(ByVal Color As Color) As ColourValue Return New ColorEx(Color).ToColorValue End Function #End Region #Region "IComparable Members" ''' <summary> ''' Used to compare 2 colourvalue objects for equality. ''' </summary> ''' <param name="obj">An instance of a colourvalue object to compare to this instance.</param> ''' <returns>0 if they are equal, 1 if they are not.</returns> Public Function CompareTo(ByVal obj As Object) As Integer Implements IComparable.CompareTo Dim other As ColourValue = DirectCast(obj, ColourValue) If Me.a = other.a AndAlso Me.r = other.r AndAlso Me.g = other.g AndAlso Me.b = other.b Then Return 0 End If Return 1 End Function #End Region End structure
Example usage
Get Colourvalue
'Use ColorEx's shared fields to get our color: Dim color As Mogre.ColourValue = ColorEx.Purple 'Or use the constructor: Dim color As Mogre.ColourValue = New ColorEx(Drawing.Color.Purple) 'Or use the constructor and call ToColourValue: Dim color As Mogre.ColourValue = New ColorEx(Drawing.Color.Purple).ToColourValue
Information
The helper class is converted to mogrecolour automatically (see above) and vice versa.
Convert a Colourvalue to .Net Color
' Mogre colourvalue (yes, that's the RGBA code for purple) Dim MyMogrePurple As New ColourValue(0.5019608F, 0.0F, 0.5019608F, 1.0F) ' Now we convert this to Drawing.Color: Dim purple As Color = New ColorEx(MyMogrePurple).ToColor ' or shorter (but the same): Dim purple As Color = New ColorEx(MyMogrePurple)
Information
There are static methods, too, but they do exactly thte same thing ;)
- ColorEx.ToColor
- ColorEx.ToColourValue