[Gambas-user] Color

Benoît Minisini gambas at ...1...
Tue Jul 15 15:07:40 CEST 2014


Le 15/07/2014 00:52, B Bruen a écrit :
> I am working on a project where the colors used on the forms need to
> be adjusted for different ambient light situations, "low light" and
> "daylight".  (The application is used outdoors at dawn and during the
> day. So at dawn we need to have a fairly dull and low contrast set of
> colors so the user does not have to adjust their vision between a
> very "bright" screen and the low light view of the racehorse in
> training. Alternatively, during the day we need a higher contrast set
> of colors so the screen is readable.)
>
> Up to now we have used two copies of the application to achieve the
> desired result. So I want instead to use gb.settings to hold the two
> color sets and load the selected set from a toggle button on the main
> form. I have overridden the Color class to make the gb.qt4 color
> names (e.g. SelectedBackground) read/write.  This seems to work
> perfectly, but I have the following problems:
>
> 1) I'd like to define some new color names (e.g. DarkBackground) as
> there is just not enough standard color names to do all I need. This
> is not a problem with the Color override as I can define as many
> different names as I like. My problem is the IDE.  It wont let me
> type a color name in the Background field on the properties panel,
> the only way to set a color name is via the button and the "Select a
> Color" popup which, of course, has never heard of my "DarkBackground"
> color.  So, is the textbox part of the Background property control
> really read only or have I done something silly to our local version
> of the IDE?
>

You should not expect the IDE to be modified by your single own personal 
program.

The pre-defined system colors are a common subset of system colors 
defined by QT4 and GTK+. Some of them, like Color.LightBackground and 
Color.LightForeground are actually a mix of two system colors.


> 2) I can't work out how the background/foreground colors are set when
> they are "default". Any clues?
>

"Default" means that Gambas does not try to define a background or a 
foreground color, and let the toolkit does its job. Usually, no 
background is drawn, and/or the color is taken from the parent control.

> 3) Is there some way to change the highlight color used for the
> selected row in list type controls, e.g. a gridview.  The standard
> dark color is close to our lowlight background, so the selected row
> is impossible to discern. Id like to use a lighter version of the
> selected highlight.  In fact it would be nice to change the entire
> style of the selected row, e.g. bold,+1 font but I don't think that
> is possible.

I will think about that. In the meantime, GridView being written in 
Gambas, you can take the source code, put it in your project, and modify 
it as you need.

>
> 4) Some controls, e.g. DirChooser, don't set the background color
> according to the Background property. It seems to set the background
> color of the bar at the top of the chooser.  Is there any reason for
> this?

Yes, DirChooser is a compound control, so if I do nothing, the 
background color is not taken by the inner controls that uses the system 
TextBackground color (for example).

I have to fix the controls case by case (i.e. decide which part of the 
compound control should take the global background color).

Regards,

-- 
Benoît Minisini




More information about the User mailing list