Re: Themable colors
- From: Stefan Kost <ensonic hora-obscura de>
- To: nshmyrev yandex ru
- Cc: gtk-devel-list gnome org
- Subject: Re: Themable colors
- Date: Tue, 29 Mar 2005 08:39:16 +0200
Hi,
why using named colors. Wouldnt it be better to have some more aliases instead.
Like SELECTION, HIGHLIGHT, MARKER.
Stefan
Hello.
There is a problem that meets every implementor of custom widget. It is
described here:
http://bugzilla.gnome.org/show_bug.cgi?id=114355
There are not so many predefined colors. Current situation is not shiny.
We have 20 colors already allocated.
fg[NORMAL, SELECTED, ACTIVE, PRELIGHT, INSENSITIVE]
bg[NORMAL, SELECTED, ACTIVE, PRELIGHT, INSENSITIVE]
text[NORMAL, SELECTED, ACTIVE, PRELIGHT, INSENSITIVE]
base[NORMAL, SELECTED, ACTIVE, PRELIGHT, INSENSITIVE]
Also we have some utility colors in style (dark, light, mid, text_aa).
But they cannot be adjusted from rc files, also they are very rarely
used. They are only initialized in default implementation of GtkStyle
object, so they are not usable when theme applied.
Those colors are sufficient to draw most gtk widgets, but they often
aren't sufficient for custom widgets implementation. The problem is also
that it's hard to choose the colors from style accordingly to it's
usage. Many applications like GEdit or Multiload applet or network
applet are forced to introduce hard-coded colors and dialogs to change
So there can be the following suggestions:
1. Hide utility colors from API.
2. Create array of named colors in style so that it would be possible to
change them from the rc files. I suggest the following
typedef enum {
GTK_PALETTE_DARK,
GTK_PALETTE_SEMI_DARK,
GTK_PALETTE_MID,
GTK_PALETTE_SEMI_LIGHT,
GTK_PALETTE_LIGHT,
GTK_PALETTE_RED
GTK_PALETTE_PURPLE
GTK_PALETTE_BLUE
GTK_PALETTE_LIGHT_BLUE
GTK_PALETTE_GREEN
GTK_PALETTE_YELLOW
GTK_PALETTE_ORANGE
GTK_PALETTE_LAVENDER,
GTK_PALETTE_BROWN
GTK_PALETTE_PINK,
GTK_PALETTE_GOLDEN
GTK_PALETTE_LIGHT_BLUE,
GTK_PALETTE_LIGHT_GREEN
} GtkPaletteType;
struct _GtkStyle
{
GObject parent_instance;
/*< public >*/
GdkColor fg[5];
GdkColor bg[5];
GdkColor text[5];
GdkColor base[5];
GdkColor black;
GdkColor white;
GdkColor* palette;
PangoFontDescription *font_desc;
gint xthickness;
gint ythickness;
GdkGC *fg_gc[5];
GdkGC *bg_gc[5];
GdkGC *text_gc[5];
GdkGC *base_gc[5];
GdkGC *black_gc;
GdkGC *white_gc;
GdkGC **palette_gc;
GdkPixmap *bg_pixmap[5];
/*< private >*/
GtkStylePrivate *private;
};
struct _GtkStylePrivate {
GdkColor light[5];
GdkColor dark[5];
GdkColor mid[5];
GdkColor text_aa[5]; /* Halfway between text/base */
GdkGC *light_gc[5];
GdkGC *dark_gc[5];
GdkGC *mid_gc[5];
GdkGC *text_aa_gc[5];
gint attach_count;
gint depth;
GdkColormap *colormap;
GdkFont *private_font;
PangoFontDescription *private_font_desc; /* Font description for style->private_font or %NULL */
/* the RcStyle from which this style was created */
GtkRcStyle *rc_style;
GSList *styles; /* of type GtkStyle* */
GArray *property_cache;
GSList *icon_factories; /* of type GtkIconFactory* */
}
3. Create corresponding tokens in rc files.
4. Probably there is need to create function to access those colors
(Useful for bindings, for example, gtk-sharp is forced to use such
functions).
5. Try to use it somewhere, at least in GtkColorChooser and GtkSourceView
Of course, this is just simple proposal. Probably, some other way is much
better.
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]