Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get RGB numerical equivalent of color in vb.net

net there are many standard colors are available . But how to know there numerical value. I want those numerical values so that by changing those I can obtain the required shades which are not available as standard colors.

E.g for black we know numerical RGB equivalent is 0, 0, 0 But what are RGB values for olive color?

how to do this color name to numeric RGB value conversion

like image 690
vaichidrewar Avatar asked Oct 25 '25 18:10

vaichidrewar


2 Answers

The Color struct has .A, .R, .G and .B fields.

For example:

Dim color As Color = Color.Olive
Dim r As Integer = color.R
Dim g As Integer = color.G
Dim b As Integer = color.B
like image 116
MusiGenesis Avatar answered Oct 28 '25 05:10

MusiGenesis


Since all of the colors are of the Color object, you simply need to instantiate the color and call the Color methods that you want to.

You probably want something like this:

Console.Write(Color.Olive.R & " " & Color.Olive.G & " " & Color.Olive.B)
like image 38
Bobort Avatar answered Oct 28 '25 04:10

Bobort