473,795 Members | 3,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calculating Color Range

Hi,

I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!

Thanks!

Joy

May 10 '07 #1
5 4229
On May 10, 1:32 pm, "simchajoy2...@ yahoo.com"
<simchajoy2...@ yahoo.comwrote:
Hi,

I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!

Thanks!

Joy
Are you doing this for painting? If so you might look at the gradient
brushes which do this automatically.

As far as colors go, the following site might be a good read:

http://www.web-colors-explained.com/

Thanks,

Seth Rowe

May 10 '07 #2
On May 10, 11:36 am, rowe_newsgroups <rowe_em...@yah oo.comwrote:
On May 10, 1:32 pm, "simchajoy2...@ yahoo.com"

<simchajoy2...@ yahoo.comwrote:
Hi,
I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!
Thanks!
Joy

Are you doing this for painting? If so you might look at the gradient
brushes which do this automatically.

As far as colors go, the following site might be a good read:

http://www.web-colors-explained.com/

Thanks,

Seth Rowe
Actually, I just have a VB.NET form where a user can specify a color
range and a range of values associated with it. They can also specify
the increment, so for example: the color range is blue - red, the
value range is 1 - 1,000 and the increment is 50. I will divide 1,000
by 50 to get the number of individual ranges - for each range I need a
color that falls within the range of blue - red. The only way I can
figure out how to do this is to use the hex values and somehow
increment them to get a color for each range. Does that make sense?

Thanks for your help!

Joy

May 10 '07 #3
si***********@y ahoo.com wrote:
I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!
You'll find it easier to get the range of colours in HSB colour space, where
you simply vary the hue across the desired range, then convert back to RGB.

http://en.wikipedia.org/wiki/HSV_color_space

Andrew
May 11 '07 #4
On May 11, 1:32 am, "Andrew Morton" <a...@in-press.co.uk.inv alid>
wrote:
simchajoy2...@y ahoo.com wrote:
I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!

You'll find it easier to get the range of colours in HSB colour space, where
you simply vary the hue across the desired range, then convert back to RGB.

http://en.wikipedia.org/wiki/HSV_color_space

Andrew
Thank you! That's a great idea. Just for clarification though - HSB
is the same as HSV correct? And do you know of any VB.NET example
code that works with HSB?

Joy

May 11 '07 #5
si***********@y ahoo.com wrote:
On May 11, 1:32 am, "Andrew Morton" <a...@in-press.co.uk.inv alid>
wrote:
>simchajoy2...@ yahoo.com wrote:
>>I need to calculate a range of colors given the beginning and ending
colors in hex values (i.e. blue to red). I know there is a logic to
hex numbers and there is probably a fairly simple way to increment
from one color to the next - but I have no idea what it is. Does
anyone know how to do this? Any suggestions greatly appreciated!!

You'll find it easier to get the range of colours in HSB colour
space, where you simply vary the hue across the desired range, then
convert back to RGB.

http://en.wikipedia.org/wiki/HSV_color_space

Andrew

Thank you! That's a great idea. Just for clarification though - HSB
is the same as HSV correct?
Yes: HSB=hue, saturation, brightness; HSV=hue, saturation, value.
And do you know of any VB.NET example
code that works with HSB?
Google for
vb.net (hsv OR hsb)

Andrew
May 14 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
8808
by: Ron Adam | last post by:
Hi, I'm having fun learning Python and want to say thanks to everyone here for a great programming language. Below is my first Python program (not my first program) and I'd apreciate any feedback on how I might do things differently to make it either more consice, readable, or faster. ie... are there better ways to do it in Python? It won't break any records for calculating pi, that wasn't my goal, learning Python was. But it might...
5
4175
by: Mr. Ken | last post by:
I am calculating the phase of an IQ signal, which are polluted by AWGN gaussian noise. Thus, near pi/2, direct division of atan(Q/I) may yield outputs either +pi/2 or -pi/2. How do I handle this situation? Thanks.
2
2094
by: Carl | last post by:
Hi, I have a query that produces an output similar to the sample shown below. These records are based on certain criteria and a date range selected from a form. I need to create some kind of calcualtion or record manipulation to do the following: I need to subtract dates from one another, for example for ID 1 I want to find the difference between 24-Jun-04 and 25-Jan-06 for the 2 applications for Person1.
38
5920
by: jdcrief | last post by:
Complier: Visual C++ 2005 Express Edition The program I wrote will compile and execute, but the output is always the same, no matter what number is entered in for the radius of the circle. Someone please help! I am extremely new at this, as you can probably tell. What am I missing with the code below? #include "stdafx.h"
1
2469
by: josecruz | last post by:
I have created a main report, which is controlled with a date range parameter from the main form. The report has several sub reports, which perform calculations (counts and averages at the subreport level) based on the date range from the main form. My question or problem is that I have to calculate a percentage based on the result of two of the subreports. I created a text box on the main report and I enterd the following to calculate the...
22
2088
by: dos.fishing | last post by:
Hello, I'm writing a function that should do the following: /** * Calculate and return fraction of valueA where max fractions is 31. * param valueA A five bit value, 0-31. * param valueB The fraction, a five bit value, 0-31. * */
25
5030
by: Umesh | last post by:
i want to calculate the time required to execute a program. Also i want to calcute the time remaining for the execution of the program. how can i do that? pl mention some good websites for learning advanced C.thx.
1
2812
by: Del | last post by:
I have a parameter query that requires the user to enter a Start Date: and End Date: and pull data between that date range. I am currently using the following parameter; Select * From mytable Where between and This query will always be run on a Monday and the start date will always be the previous Sunday. The end date will be the previous
3
2644
Claus Mygind
by: Claus Mygind | last post by:
My date calculation do not seem to work out. I have a list box with a character string value of dates ie: 03/28/2009. I want to create a date range for the week. So I would like to get the starting and ending date for this week. In the code below is what I attempted, but the results I got were Tuesday Apr 28 and Wednesday Apr22. what am I doing wrong: var cW = document.getElementById('resetNonUnionTime').value; var dEnd = new...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10439
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9043
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7541
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.