Hi all,

I know I can make a color lighter programatically, by augmenting some of the RGB values. But is there a standard way to do so or is it just trial and error? And why is a blue component needed to make orange lighter?
Perhaps C# .NET has some functions to do this? I did not found them.

e.g.
Color.Orange has
R=255
G=165
B=0
a ligther orange would be
R=255
G=180
B=60

Any help or suggestion is as always very much appreciated:)

Hi all,

I know I can make a color lighter programatically, by augmenting some of the RGB values. But is there a standard way to do so or is it just trial and error? And why is a blue component needed to make orange lighter?
Perhaps C# .NET has some functions to do this? I did not found them.

e.g.
Color.Orange has
R=255
G=165
B=0
a ligther orange would be
R=255
G=180
B=60

Any help or suggestion is as always very much appreciated:)

I have read a lot of your posts, you have a better understanding of C# progammng skills compared to me, but I did stumble across this link that may prove to be benefitial to you, it uses HTML colors to convert to RGB.
http://www.vcskicks.com/hex-to-rgb.php

I don't know how applicable this may be, but it's interesting nonetheless. Here's an article on using GDI+ and doing color transformations with a matrix of floats.

http://www.aspfree.com/c/a/C-Sharp/Performing-Color-Transformation-Operations-in-Csharp-GDIplus/

I also don't know of any (other) methods to tweak colors besides, as you said, simply messing with the RGB values. As for the blue component making the orange lighter, don't think of it so much as introducing blue, but more along the lines of bringing the color closer to white (very much like white light being a combination of the visible light spectrum). As I'm sure you know, you can start with RGB(0,0,0) for solid black, increment each color equally and steadily progress through the grays until you finally arrive at white. Similarly, if you have a color value that's relatively high on one or more of the components, increasing the value of the other component(s) will lighten the color for the same reason as the black moved to gray. You are equalizing the colors in the direction closer to pure white, and therefore your color is lighter.

Edited 6 Years Ago by apegram: n/a

I have read a lot of your posts, you have a better understanding of C# progammng skills compared to me

That may possibly be true, thanks for your reply anyway jamesonh20. I understand hex code quite well, Knowing that 165 is 0xA5 it is not the problem at hand here. Suggest you start learning reading hex, it comes in handy from time to time, believe me!

@apegram : Thanks for the fantastic link! A matrix to transform the RGBs may indeed be better than messing around with individual RGB values. This may very well be what I need, gonna read it know, thanks again.

Edited 6 Years Ago by ddanbe: n/a

@apegram your link was not what I realy needed, but in a way you put me on the right track!
I only need to manipulate the Brightness or Luminance of a Color to do what I want!
Strangly enough the Color struct only lets you get a Brightness and not set one. But I remembered an old thread I responded to http://www.daniweb.com/forums/thread237654.html
and this leaded me finally to http://www.codeproject.com/KB/recipes/colorspace1.aspx#hsb
I'm a happy man now;) Thanks.

To make a color lighter or darker you should apply a given correction factor to the brightness of the color.

For more details and sample implementation in C# take a look at the following article:

Make Color Lighter or Darker in C#

Edited 4 Years Ago by pvladov

This question has already been answered. Start a new discussion instead.