🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #2503

Re: Standard Way to Specify Colors?

#2503
From: Curt Johnson
Date: Tue, 07 May 1991 21:52
50 lines
2819 bytes
In article <1991May7.011322.12743@mnemosyne.cs.du.edu> ebergman@isis.cs.du.edu (Eric Bergman-Terrell) writes:
| 
| I am writing a graphical application - hence I am wondering how I should
| let the user specify colors...  The program is an astronomy simulation/
| graphing/simulation program.
| 
| I suppose I can set up one dialog box for specifying the appearance of
| 16 colors (i.e. by specifying their RGB values).  Then another dialog
| box would associate the colors with various objects (i.e. sun is color 1,
| stars are color 15, etc).

I don't think there is a standard "get a color" dialog for windows.  If you
write something I hope it's better than just typing in R, G & B.

| However, is there a built-in way to do this (I'm dreading writing the code -
| which I expect won't be too bad).  For example, the "colors" option of the
| control panel lets the user specify some colors, but I cannot find any
| routines to access those colors (I have Petzold, Guide to Programming, &
| Programmer's Reference).  Let me know if you know of some routines that
| can get the RGB values of those colors...

GetPrivateProfileString(); will read .INIs other than WIN.INI.  You can
get the custom colors from the [Custom Colors] section of CONTROL.INI.

You will be getting a string of 6 hex characters that you have to convert
to a long to use as a rgb color.  It should be very simple to write this
code.

| Another option that I'm entertaining is to give the users 16 colors that
| can't be changed.  Is this feasible?  I'm wondering if RGB(x, y, z) might
| be attractive on a VGA card, but unattractive or even invisible on a different
| (color) graphics card...

I suspect that the 16 standard colors would be reasonable, unless you have
better than standard VGA, that's all you have anyway.  It depends on what
is expected of the program.  You should still allow your users to assign
any color to any object.

There are only minor problems (that I can think of) if you only use 16
colors.

	1) Light gray is not available on EGA
	2) On a b&w monitor, some colors map to black, some to white,
	   you probably what the sky to be black and everything else
	   to be white.
	3) On a gray-scale monitor some colors will be difficult to
	   distinguish (but only for colors with low contrast anyway).


Curt Johnson == curt@cctb.wa.com
Technical Details
Message-ID: <917470ql@cctb.wa.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!pilchuck!amc-gw!quick!cctb!curt
References: <1991May7.011322.12743@mnemosyne.cs.du.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!uunet!pilchuck!amc-gw!quick!cctb!curt
From: curt@cctb.wa.com (Curt Johnson)
Newsgroups: comp.windows.ms.programmer
Subject: Re: Standard Way to Specify Colors?
Message-ID: <917470ql@cctb.wa.com>
Date: 7 May 91 21:52:54 GMT
References: <1991May7.011322.12743@mnemosyne.cs.du.edu>
Organization: Chemical Computer Thinking Battery, Redmond, WA
Lines: 50