Ethereal-users: Re: [Ethereal-users] Minor Bug : Foreground color seems not to work under Win XP

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 28 Feb 2003 17:11:45 -0800
On Sun, Feb 16, 2003 at 10:42:02PM -0800, Jack Jackson wrote:
> When selecting Background color, moving in the circle changes the Hue, 
> Saturation, Red, Green and Blue sliders.
> 
> When selecting Foreground color, moving in the circle changes the Hue and 
> Saturations sliders but not the Red, Green and Blue sliders.  They all stay 
> at 0, and the resulting color is always black.  You either have to select 
> in the vertical rectangle or move the Red, Green and Blue sliders manually.

That behavior is not unique to Windows XP.

It's not even unique to Windows - I get the same behavior on Solaris.

That particular manifestation of it is due to a change made back in 1999
(yes, that particular behavior dates back that far):

	revision 1.10
	date: 1999/10/05 04:33:59;  author: gram;  state: Exp;  lines: +34 -10
	Added Santeri Paavolainen's <santtu@xxxxxx> patch to set default colors
	in the color selection wheel.

Santeri's patch meant we called "gtk_color_selection_set_color()" to set
the starting color in the selection circle to the current foreground or
background color of the filter being edited.  For some reason, if that
color is black, the Red, Green, and Blue sliders get stuck at 0, but if
it's white, they can move - the initial foreground color for a filter is
black, and the initial background color is white, so....

This is actually consequence of the fact that there are *two* widgets
for selecting a color, not *one* widget.  Colors are points in a
3-dimensional space - or, rather, in one of many 3-dimensional spaces. 
A color wheel (that's the circle) can select only two dimensions; to the
right of the color wheel is a vertical color slider for selecting the
third dimension.

Those select points in HSV space - that space has a cylindrical
coordinate system, where the hue is the angular coordinate, the
saturation is the distance from the center, and the value is the
coordinate along the cylinder:

	http://www.gweep.net/~rocko/DocStuff/node2.html

	http://www.nacs.uci.edu/~wiedeman/cspace/me/infohsv.html

However, as the latter page notes:

	The HSV color space is cylindrical, but usually represented as a
	cone or a hexagonal cone (hexcone), as displayed in this
	picture, because this is the subset of the space with valid RGB
	values.

In effect, the color wheel represents a circular cross-section of that
cylinder, and the slider represents distance along the axis.

At the bottom of that slider is the bottom of the cone in the picture in
the latter page; the only color down there is "black" - it's irrelevant
what the hue or saturation is.  As such, if the slider is at the bottom,
it's irrelevant what you do with the color wheel - all you get is black.

This was the case even before that change back in 1999 - if you moved
the slider to the bottom, the wheel did nothing.  The only difference
the patch made is that, when the color selection dialog is popped up,
the initial color is set to the current foreground or background color
of the filter, using RGB coordinates in color space.  If that happens to
be black, the resulting HSV coordinates will put the slider at the
bottom.

So the rule is that, to select a color, you might need to select the
value, as well as the hue and saturation.

One alternative *might* be to convert the foreground and background
colors from RGB to HSV, forcibly set the V coordinate to 0, convert back
to RGB, and set the initial colors to *those* values.