Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2002-09

GTK+ Theme colors

10 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro

I want my new control to use the local GTK+ theme when it displays. I tried defining colors for drawing objects using things like clWindow and cl3dlight but it gives me standard Windows colors with that.

How can I make my new control use the GTK theme colors of whatever system the app is run on?

<<winmail.dat>>

Reply by email

Mattias Gaertner
to Tony Maro
I want my new control to use the local GTK+ theme when it displays. I tried defining colors for drawing objects using things like clWindow and cl3dlight but it gives me standard Windows colors with that. How can I make my new control use the GTK theme colors of whatever system the app is run on?

The systemcolor mapping in the gtk-interface is currently deactivated. You can activate it by adding -dNewSysColors in the Build Lazarus options and rebuilding lazarus. It's deactivated, because
- there is no 1:1 mapping to windows colors. It depends on the current theme and the widget, where the color is used. e.g. a button can define clBackground different than a form.
- not all pixmap themes support colors for all states.
- system colors can change, when the theme is switched.

Andrew is working on a general solution, so that for example drawing with clBackground will result in drawing whatever the current theme defines as background (Color, pixmap, gradient, whatever).

Mattias

Reply by email

Michal Bukovjan
to Andrew Johnson: On Mon, 16 Sep 2002 22:59:15 +0200 So what is the dif. between these and…
Andrew Johnson wrote 28 lines
On Mon, 16 Sep 2002 22:59:15 +0200 "Michal Bukovjan" wrote: >> COLOR_3DDKSHADOW >> COLOR_3DLIGHT > > Shadow. The dark is top left, light is bottom right. Used to created > the shaded 3d effect. So what is the dif. between these and BTN_Shadow/BTN_Highlight?? If there isn't any they are easily mapped! > I recommend you look into Kylix help file. They introduced a concept > of ColorGroups and ColorRoles, and somehow remade mappings for color. > I attach for your reference TColor, TColorGroup and TColorRole from > Kylix 1 Help file. Granted this way makes more sense for GTK/QT/X, but for Win32 I don't think it would make as much sense yet.. not until a good portion of the Win32 is done and we can start redesigning Lazarus colors etc.. based on what makes most sense for everywhere. Until then simply mapping as much as is possible to Win32 colors makes most sense, esp. because most programs to be ported will be from Delphi not Kylix, and therefore will expect it that way.

Sure, I just thought we should perhaps design or create the compatibility with Kylix in mind.
Isn't it true that Delphi 6/7 is compatible with Kylix (i.e. in case of colors they use the Kylix/CLX design), and therefore if we stick to pre-Kylix (Windows only) design, we will be obsolete by the time of release?

I don't know; perhaps someone coding in Delphi 6/7 could shed a light on this?

Michal

Reply by email

Michal Bukovjan
to Andrew Johnson: On Fri, 13 Sep 2002 23:49:00 -0500 Just FYI, I have almost got the basics working theme…
Andrew Johnson wrote 28 lines
On Fri, 13 Sep 2002 23:49:00 -0500 "Tony Maro" wrote: > I want my new control to use the local GTK+ theme when it displays. > I tried defining colors for drawing objects using things like > clWindow and cl3dlight but it gives me standard Windows colors with > that. > How can I make my new control use the GTK theme colors of whatever > system the app is run on? Just FYI, I have almost got the basics working theme dependantly, clBtnFont, clBtnface, clBtnShadow, clBtnHighlight, and clGrayText work for Brush's. Unfortunately I Have not figured out how to make Pen's work this way yet, because Pixmaps are ignored by Pen Styles. But If I can get some more of the other commonly used colors working, you should be able to get at least FillRect etc.. to match by using these SysColors. I will also be trying the same with background color and Text Color, so that Fonts and Form Backgrounds will also work this way whenever possible. As soon as I get the bugs worked out, I will be sending in a small patch with these changes, hopefully by wed. which will enabled you to make at least some of your component work properly without having to enable the newsyscolors flag. Andrew

Sounds great!

FYI, it should be possible to support pixmap themes as well (somehow), as TForm, TButton and others have Bitmap properties in Kylix...

Michal

Reply by email

Andrew Johnson
Show quoted text 6 lines
I want my new control to use the local GTK+ theme when it displays. I tried defining colors for drawing objects using things like clWindow and cl3dlight but it gives me standard Windows colors with that. How can I make my new control use the GTK theme colors of whatever system the app is run on?

Just FYI, I have almost got the basics working theme dependantly, clBtnFont, clBtnface, clBtnShadow, clBtnHighlight, and clGrayText work for Brush's. Unfortunately I Have not figured out how to make Pen's work this way yet, because Pixmaps are ignored by Pen Styles. But If I can get some more of the other commonly used colors working, you should be able to get at least FillRect etc.. to match by using these SysColors. I will also be trying the same with background color and Text Color, so that Fonts and Form Backgrounds will also work this way whenever possible. As soon as I get the bugs worked out, I will be sending in a small patch with these changes, hopefully by wed. which will enabled you to make at least some of your component work properly without having to enable the newsyscolors flag.

Andrew

_________________________________________________________________ MSN Photos is the easiest way to share and print your photos: http://photos.msn.com/support/worldwide.aspx

Reply by email

Andrew Johnson

I could use some help on this: I can't remember what all the color flags corrsepond to how Win32 Draws things and so what the proper GC for them would be in GTK.

The bulk of the basics I am not certain of -

COLOR_WINDOW(default Window(Form) color?)
COLOR_WINDOWTEXT(default text color?)
COLOR_HIGHLIGHT(Isn't this the color used on selected Edits?) COLOR_HIGHLIGHTTEXT(..selected Edits Text?)

These are ones I don't think I can get(yet) -

COLOR_BACKGROUND(Is the desktop background?)
COLOR_ACTIVECAPTION(Forefront Window Title Text color?) COLOR_INACTIVECAPTION (background Window Title Text color?) COLOR_ACTIVEBORDER(Forefront Window border color?) COLOR_INACTIVEBORDER(background Window border color?) COLOR_APPWORKSPACE (What IS this?)

These I are ones I don't know what they are -

COLOR_CAPTIONTEXT
COLOR_WINDOWFRAME
COLOR_INACTIVECAPTIONTEXT
COLOR_3DDKSHADOW
COLOR_3DLIGHT
COLOR_INFOTEXT
COLOR_INFOBK

Any Feedback from anyone would be appreciated.

Andrew

_________________________________________________________________ Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com

Reply by email

Michal Bukovjan
to Andrew Johnson
Andrew Johnson wrote
I could use some help on this: I can't remember what all the color flags corrsepond to how Win32 Draws things and so what the proper GC for them would be in GTK.

I'll try to remember some :-)

Show quoted text 6 lines
The bulk of the basics I am not certain of - COLOR_WINDOW(default Window(Form) color?) COLOR_WINDOWTEXT(default text color?) COLOR_HIGHLIGHT(Isn't this the color used on selected Edits?)

- yes, selected background

COLOR_HIGHLIGHTTEXT(..selected Edits Text?)

- yes, background of selected text

Show quoted text 6 lines
These are ones I don't think I can get(yet) - COLOR_BACKGROUND(Is the desktop background?) COLOR_ACTIVECAPTION(Forefront Window Title Text color?)

- yes, and forget about this on Linux (this is window manager thingy)

COLOR_INACTIVECAPTION (background Window Title Text color?)

- yes, and forget about this on Linux (this is window manager thingy)

COLOR_ACTIVEBORDER(Forefront Window border color?)

- yes, and forget about this on Linux (this is window manager thingy)

COLOR_INACTIVEBORDER(background Window border color?)

- yes, and forget about this on Linux (this is window manager thingy)

COLOR_APPWORKSPACE (What IS this?)

- I guess this is the color of MDI application background (when there is no window). Not sure how to map this.

Show quoted text 6 lines
These I are ones I don't know what they are - COLOR_CAPTIONTEXT COLOR_WINDOWFRAME

- forget about this on Linux (this is window manager thingy)

COLOR_INACTIVECAPTIONTEXT COLOR_3DDKSHADOW COLOR_3DLIGHT

Shadow. The dark is top left, light is bottom right. Used to created the shaded 3d effect.

COLOR_INFOTEXT COLOR_INFOBK

Tooltips...

Show quoted text 5 lines
Any Feedback from anyone would be appreciated. Andrew

I recommend you look into Kylix help file. They introduced a concept of ColorGroups and ColorRoles, and somehow remade mappings for color. I attach for your reference TColor, TColorGroup and TColorRole from Kylix 1 Help file.

Michal

TColor is used to specify the color of an object.

Unit

QGraphics

type TColor = -$7FFFFFFF-1..$7FFFFFFF;

Description

TColor is used to specify the color of an object. It is used by the Color property of many components and by a number of other properties that specify color values.

The Graphics unit contains definitions of useful constants for TColor. These constants map to either directly to the closest matching color in the system palette (for example, clBlue maps to blue) or to the corresponding system screen element colors (for example, clNormalButton maps to the system color for button faces). In addition, there are a set of compatibility constants that map to system constants but have names to match system constants for the Windows-based colors.

If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color intensities for blue, green,and red, respectively. The value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red. $00000000 is black and $00FFFFFF is white.

If the highest-order byte is zero ($00), the color obtained is the closest matching color in the system palette. If the highest-order byte is one ($01), the color obtained is the closest matching color in the currently realized palette. If the highest-order byte is two ($02), the value is matched with the nearest color in the logical palette of the current device context.

The following tables lists the color constants from the Graphics unit. The first two columns list the colors that map to the closest matching color in the system palette followed by the compatibility constants, while the last two columns list the system color constants. The are defined in terms of the BaseColor of the current palette.

Value Meaning Value Meaning
clNone White. clForeground Base foreground color (for example, the color of lines or text). clAqua Aqua clNormalForeground Foreground color for enabled inactive controls. clBlack Black clDisabledForeground Foreground color for disabled controls. clBlue Blue clActiveForeground Foreground color for active controls. clDkGray Dark Gray clBackground Base background color. clFuchsia Fuchsia clNormalBackground Background color for enabled inactive controls. clGray Gray clBase Base background color for Text controls. clGreen Green clNormalBase Background color for enabled, inactive text controls clLime Lime green clDisabledBase Background color for disabled text controls. clLtGray Light Gray clActiveBase Background color for active text controls. clMaroon Maroon clText Base Foreground color for text controls clNavy Navy blue clNormalText Foreground color for enabled inactive text controls clOlive Olive green clDisabledText Foreground color for disabled text controls. clPurple Purple clActiveText Foreground color for active text controls clRed Red clButton Base background color for button controls. clSilver Silver clNormalButton Background color for enabled inactive button controls. clTeal Teal clDisabledButton Background color for disabled button controls. clWhite White clActiveButton Background color for active button controls. clYellow Yellow clButtonText Base foreground color for button controls. clNormalButtonText Foreground color for enabled inactive button controls. clScrollBar maps to clButton clDisabledButtonText Foreground color for disabled button controls. clActiveCaption maps to clActiveHighlightedText clActiveButtonText Foreground color for active button controls. clInactiveCaption maps to DisabledHighlightedText clBrightText Base contrasting text color clMenu maps to clMid clNormalBrightText Contrasting text color for enabled inactive controls. clWindow maps to clBase clDisabledBrightText Contrasting text color for disabled controls clWindowFrame maps to clHighlight clActiveBrightText Contrasting text color for active controls clMenuText maps to clButtonText clHighlight Base color for selected or highlighted items. clWindowText maps to clText clNormalHighlight Background color for enabled inactive selected or highlighted items. clCaptionText maps to clHighlightedText clDisabledHighlight Background color for disabled selected or highlighted items clActiveBorder maps to clActiveHighlight clActiveHighlight Background color for active selected or highlighted items. clInactiveBorder maps to clDisabledHighlight clHighlightedText Base foreground color for selected or highlighted items. clAppWorkspace maps to clMid clNormalHighlightedText Foreground color for enabled inactive selected or highlighted items. clBtnFace maps to clButton clDisabledHighlightedText Foreground color for disabled selected or highlighted items clBtnShadow maps to clDark clActiveHighlightedText Foreground color for active selected or highlighted items. clGrayText maps to clLight clLight Base color for light areas in 3-D effects clBtnText maps to clButtonText clNormalLight Light color in 3D effects on enabled inactive controls. clInactiveCaptionText maps to clDisabledHighlightedText clDisabledLight Light color in 3D effects on disabled controls. clBtnHighlight maps to clBrightText clActiveLight Light color in 3D effects on active controls. cl3DDkShadow maps to clMid clMidlight Base color for light (but darker than clLight) areas in 3-D effects cl3DLight maps to clMidlight clNormalMidlight Light (but darker than clNormalLight) color in 3D effects on enabled inactive controls. clInfoText maps to clText clDisabledMidlight Light (but darker than clDisabledLight) color in 3D effects on disabled controls. clInfoBk light brown clActiveMidlight Light (but darker than clActiveLight) color in 3D effects on active controls. clHighlightText maps to clHighlightedText clMid Base color for dark (but lighter than clDark) areas in 3-D effects clNormalMid Dark (but lighter than clNormalDark) color in 3D effects on enabled inactive controls. clDisabledMid Dark (but lighter than clDisabledDark) color in 3D effects on disabled controls. clActiveMid Dark (but darker than clActiveDark) color in 3D effects on active controls. clDark Base color for dark areas in 3-D effects
clNormalDark Dark color in 3D effects on enabled inactive controls. clDisabledDark Dark color in 3D effects on disabled controls. clActiveDark Dark color in 3D effects on active controls. clShadow Base color for darkest areas in 3-D effects clNormalShadow Darkest color in 3D effects on enabled inactive controls. clDisabledShadow Darkest color in 3D effects on disabled controls. clActiveShadow Darkest color in 3D effects on active controls.

TColorGroup is used to specify a group of colors that are used to paint objects in a specific state.

Unit

QGraphics

type TColorGroup = (cgInactive, cgDisabled, cgActive);

Description

Each palette generates a set of symbolic colors that reflect both a color group and a color role. TColorGroup is used to indicate the group of a symbolic color constant. It can have any of the following values:

Group Meaning

cgInactive Color is used on inactive controls. cgDisabled Color is used on disabled controls. cgActive Color is used on active controls.

TColorRole is used to specify the use of a color when painting a control.

Unit

QGraphics

type TColorRole = (crForeground, crButton, crLight, crMidlight, crDark, crMid, crText, crBrightText, crButtonText, crBase, crBackground, crShadow, crHighlight, crHighlightText, crNoRole);

Description

Each palette generates a set of symbolic colors that reflect both a color group and a color role. TColorRole is used to indicate the use of the color (what part of the control is being painted). The following table lists the possible values:

Role Meaning

crForeground Foreground color (for example, the color of lines or text). crButton Background color for button controls. crLight Lightest areas in 3-D effects
crMidlight Light (but darker than crLight) areas in 3-D effects crDark Dark areas in 3-D effects
crMid Dark (but lighter than crDark) areas in 3-D effects crText Foreground color on text controls (color of the font). crBrightText Bright contrasting text color. crButtonText Foreground color for the caption on buttons. crBase Background color for text controls. crBackground Background color (for example, the color of a window) crShadow Darkest areas in 3-D effects.
crHighlight Background color for selected or highlighted items. crHighlightText Foreground color for selected or highlighted items. crNoRole Unspecified role

Reply by email

Tony Maro
to Andrew Johnson: On Fri, 13 Sep 2002 23:49:00 -0500 Just FYI, I have almost got the basics working theme…
Andrew Johnson wrote 12 lines
Just FYI, I have almost got the basics working theme dependantly, clBtnFont, clBtnface, clBtnShadow, clBtnHighlight, and clGrayText work for Brush's. Unfortunately I Have not figured out how to make Pen's work this way yet, because Pixmaps are ignored by Pen Styles. But If I can get some more of the other commonly used colors working, you should be able to get at least FillRect etc.. to match by using these SysColors. I will also be trying the same with background color and Text Color, so that Fonts and Form Backgrounds will also work this way whenever possible. As soon as I get the bugs worked out, I will be sending in a small patch with these changes, hopefully by wed. which will enabled you to make at least some of your component work properly without having to enable the newsyscolors flag.

Great! I've been using the pieces in there with newsyscolors and at least the look and feel are somewhat correct, even without the pixmaps. However... I noticed that the clWindow color always seems to show white. Everything else at least grabbed a theme color, but clWindow and clWindowText stayed with the default white with black text.

Thanks,
Tony

Reply by email

Andrew Johnson
Show quoted text 9 lines
Sure, I just thought we should perhaps design or create the compatibility with Kylix in mind. Isn't it true that Delphi 6/7 is compatible with Kylix (i.e. in case of colors they use the Kylix/CLX design), and therefore if we stick to pre-Kylix (Windows only) design, we will be obsolete by the time of release? I don't know; perhaps someone coding in Delphi 6/7 could shed a light on this?

I checked out D6 Personal Edition, and it doesn't.. it has the option of separately downloading and installing a CLX version, which is very incompatible (IMO) with any prior Delphi code.. like no real printing.. minimal DB support(colors) etc etc.. So I think it will be a good while before we are obsolete, even if Delphi 7 is fully CLX. As for Kylix... well it was released before it was ready and it will be a good while before a lot of people will work with it.. our company bought Kylix 2... and it still looks like finishing Lazarus, and porting too IT would be faster than porting to Kylix. And while Lazarus has come along a way....well you can see my point. It will be a good while before Kylix compatibility will be serious issue.

Andrew

_________________________________________________________________ Join the world�s largest e-mail service with MSN Hotmail. http://www.hotmail.com

Reply by email

Andrew Johnson
Show quoted text 5 lines
>COLOR_3DDKSHADOW >COLOR_3DLIGHT Shadow. The dark is top left, light is bottom right. Used to created the shaded 3d effect.

So what is the dif. between these and BTN_Shadow/BTN_Highlight?? If there isn't any they are easily mapped!

I recommend you look into Kylix help file. They introduced a concept of ColorGroups and ColorRoles, and somehow remade mappings for color. I attach for your reference TColor, TColorGroup and TColorRole from Kylix 1 Help file.

Granted this way makes more sense for GTK/QT/X, but for Win32 I don't think it would make as much sense yet.. not until a good portion of the Win32 is done and we can start redesigning Lazarus colors etc.. based on what makes most sense for everywhere. Until then simply mapping as much as is possible to Win32 colors makes most sense, esp. because most programs to be ported will be from Delphi not Kylix, and therefore will expect it that way.

Andrew

_________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com

Reply by email