News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Colors

Started by Shooter, December 31, 2010, 02:41:52 AM

Previous topic - Next topic

Shooter

I noticed in OllyDbg that when I make the call GDI32.SetTextColor with a setting of "Red", OllyDbg shows that the color is actually "LightRed"; and when I use "Green", it's actually "LightGreen".

I looked in windows.inc and found some EQU's for a few colors, but none of them were "Light___". I've performed a search through all of the files that came with MASM32, but none of them have "LightRed" or "LightGreen". MSDN hasn't really done much at helping me cross-reference at least these colors to SetTextColor. I know that the macro RGB can be called, but a list of predefined colors could come in useful.

I was wondering if there was a master list available that shows all of the predefined colors SetTextColor recognizes. I know that the macro RGB can be called, but a list of predefined colors could come in useful.

Thanks,
-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

Tight_Coder_Ex

What is light and what is dark is subjective.  If you experment, you'll notice Light_Red could be interpreted anywhere from 0x00FFB7B7 to 0x00FFF0F0.  That gives us 56 shades, so your best solution is to define a list of your own.  CCS & HTML documentation have some charts that may help, but probably quite a bit of work.  This page may be of some help establishing colors

http://www.w3schools.com/css/css_colors.asp

Shooter

Quote from: Tight_Coder_Ex on December 31, 2010, 02:57:47 AM
What is light and what is dark is subjective. 

I realize that colors are subjective in the light and dark sense, but when I wrote my code, I used the textual term "Red"; however, after compiling it, OllyDbg shows that the SetTextColor call to GDI32 actually uses the textual term "LightRed", not Red. This tells me that GDI32 has a predefined set of accepted colors. It's there that I'm curious about, as well as why there's a difference between my .asm file and .exe file.
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

Gunner

the gdi functions don't know the meaning of "red". "blue", "light_whatever" they only know numbers.... i think that is ollys interp of what the color is   the word red that you used is an equ for a number in windows.inc
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

Shooter

Quote from: Gunner on December 31, 2010, 03:07:03 AM
i think that is ollys interp of what the color is

That's what I was wondering.
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

dedndave

and....
the human eye is more sensitive to green light, and less sensitive to blue light
the "brightness" of a specific color value (refered to as luminance) may be calculated from a simple formula
Y = 0.299 R + 0.587 G + 0.114 B
this is the formula you might use to convert a color image to grey-shade, like a B&W photo
i used to wrok for a company that made LCD display panels - back in the days of grey-shade stuff - lol
i found that you could make a pretty good image if you had at least 24 grey shades

Shooter

Quote from: Gunner on December 31, 2010, 03:07:03 AM
the gdi functions don't know the meaning of "red". "blue", "light_whatever" they only know numbers.... i think that is ollys interp of what the color is   the word red that you used is an equ for a number in windows.inc

I've used a multitude of tools from hex editors to a few debuggers, as well as Windows Search, and I can't seem to find any string that matches that of "LightGreen" or "LightRed" in OllyDbg.exe. This leads me to believe that it's not Olly interpreting the colors, it's something else.

Anyone got any ideas?
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

GregL

I have seen the standard console colors labeled two different ways.

1.

BLACK         EQU  0
DARKBLUE      EQU  1
DARKGREEN     EQU  2
DARKCYAN      EQU  3
DARKRED       EQU  4
DARKMAGENTA   EQU  5
DARKYELLOW    EQU  6
GRAY          EQU  7
DARKGRAY      EQU  8
BLUE          EQU  9
GREEN         EQU 10
CYAN          EQU 11
RED           EQU 12
MAGENTA       EQU 13
YELLOW        EQU 14
WHITE         EQU 15

2.

BLACK         EQU  0
BLUE          EQU  1
GREEN         EQU  2
CYAN          EQU  3
RED           EQU  4
MAGENTA       EQU  5
YELLOW        EQU  6
LIGHTGRAY     EQU  7
GRAY          EQU  8
LIGHTBLUE     EQU  9
LIGHTGREEN    EQU 10
LIGHTCYAN     EQU 11
LIGHTRED      EQU 12
LIGHTMAGENTA  EQU 13
LIGHTYELLOW   EQU 14
WHITE         EQU 15


Just a matter of perspective I guess.


Shooter

GregL,
Which ones come from where?

-Shooter
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

Gunner

You could download the source for Olly and see if you can figure out how they decode the numbers to names?
~Rob (Gunner)
- IE Zone Editor
- Gunners File Type Editor
http://www.gunnerinc.com

donkey

Quote from: Shooter on January 02, 2011, 04:24:48 AM
Quote from: Gunner on December 31, 2010, 03:07:03 AM
the gdi functions don't know the meaning of "red". "blue", "light_whatever" they only know numbers.... i think that is ollys interp of what the color is   the word red that you used is an equ for a number in windows.inc

I've used a multitude of tools from hex editors to a few debuggers, as well as Windows Search, and I can't seem to find any string that matches that of "LightGreen" or "LightRed" in OllyDbg.exe. This leads me to believe that it's not Olly interpreting the colors, it's something else.

Anyone got any ideas?

That's because they don't come from OllyDbg, they come from the symbol server  :wink
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Shooter

QuoteThat's because they don't come from OllyDbg, they come from the symbol server

OK, I think I'm gonna need an education on how that works.
Never use direct references to anything ever. Bury everything in
macros. Bury the macros in include files. Reference those include
files indirectly from other include files. Use macros to reference
those include files.

donkey

Quote from: Shooter on January 02, 2011, 06:57:16 AM
QuoteThat's because they don't come from OllyDbg, they come from the symbol server

OK, I think I'm gonna need an education on how that works.

No, that is so far beyond where you're at right now it would be a waste of time for you and the person trying to explain it. There are other things that you can learn that will have more impact on your ability to program in MASM. This is an area that requires years of experience and if you don't understand it that's probably because you're not ready to. Learn to write a program first, taking it apart you can save for when you're ready.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

dedndave

i happen to be working on some code where i wanted to create several colors - more than the "normal 16"
i may add a couple greys, but as it stands, the code provides for selection from 27 colors...
TCOLOR_000 EQU 0000000h ;black
TCOLOR_001 EQU 07F0000h ;navy
TCOLOR_002 EQU 0FF0000h ;blue
TCOLOR_010 EQU 000007Fh ;maroon
TCOLOR_011 EQU 07F007Fh ;purple
TCOLOR_012 EQU 0FF007Fh ;violet
TCOLOR_020 EQU 00000FFh ;red
TCOLOR_021 EQU 07F00FFh ;rose
TCOLOR_022 EQU 0FF00FFh ;magenta
TCOLOR_100 EQU 0007F00h ;ao (dark green)
TCOLOR_101 EQU 07F7F00h ;teal
TCOLOR_102 EQU 0FF7F00h ;azure
TCOLOR_110 EQU 0007F7Fh ;olive
TCOLOR_111 EQU 07F7F7Fh ;grey
TCOLOR_112 EQU 0FF7F7Fh ;lavendar
TCOLOR_120 EQU 0007FFFh ;orange (amber)
TCOLOR_121 EQU 07F7FFFh ;pink
TCOLOR_122 EQU 0FF7FFFh ;light magenta
TCOLOR_200 EQU 000FF00h ;green (lime)
TCOLOR_201 EQU 07FFF00h ;spring green
TCOLOR_202 EQU 0FFFF00h ;cyan
TCOLOR_210 EQU 000FF7Fh ;chartreuse
TCOLOR_211 EQU 07FFF7Fh ;light green
TCOLOR_212 EQU 0FFFF7Fh ;light cyan
TCOLOR_220 EQU 000FFFFh ;yellow
TCOLOR_221 EQU 07FFFFFh ;light yellow
TCOLOR_222 EQU 0FFFFFFh ;white

the list is organized, more or less, by lowest-to-highest luminance (GRB order)
i wanted names for the colors - although, i may or may not put them in the menu - lol
i want to put owner-drawn "color swatches" on the selection menu

at any rate, the standard names/colors for html was a bit limited, even thought they use more colors
i found a great website where you can plug in the color value as part of the URL and it shows a page about that color - including the name
(you can also use their applet to enter a value)
note - for our purposes, they are organized in BGR order - the order is reversed for HTML purposes (RGB)
so, 0FF7F00h in masm-speak becomes #007FFF for html

http://www.perbang.dk/rgb/FFFF7F/
you have to scroll down a little to see the color name

dedndave

here's the toolbar bitmap...



that should be enough colors to pick a background and foreground   :P
in fact, i could toss out a half dozen of em