Re: system colors

"corvid" <[email protected]>
Newsgroups gmane.comp.web.dillo.devel
Message-ID <20110911060346.GA1530@local>
Benjamin wrote:
> As it happens, I have a patch that does both:
>   http://dillo-win32.sourceforge.net/patches/24-colors.diff

Here's some more assorted ripping-out of hardcoded colors added to that.

As for X, I found out that I can set the secondary background
color (e.g., background of Fl_Input) as well if I do something like

dillo.foreground: purple
dillo.background: green
*Text.background: brown

There's a big comment in fltk that goes:

// XGetDefault does not do the expected thing: it does not like
// periods in either word. Therefore it cannot match class.Text.background.
// However *.Text.background is matched by pretending the program is "Text".
// But this will also match *.background if there is no *.Text.background
// entry, requiring users to put in both (unless they want the text fields
// the same color as the windows).

_______________________________________________
Dillo-dev mailing list
[email protected]
http://lists.auriga.wearlab.de/cgi-bin/mailman/listinfo/dillo-dev
colors.diff (text/plain, 5.8 KB)
diff -r f5cb88e18908 src/dialog.cc
--- a/src/dialog.cc	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/dialog.cc	Sun Sep 11 05:53:42 2011 +0000
@@ -171,7 +171,6 @@
     ch->tooltip("Select search engine");
     ch->menu(pm);
     ch->value(prefs.search_url_idx);
-    ch->textcolor(FL_DARK_BLUE);
 
     int xpos = ww-2*(gap+bw), ypos = ih+3*gap;
     Fl_Return_Button *rb = new Fl_Return_Button(xpos, ypos, bw, bh, "OK");
diff -r f5cb88e18908 src/dillo.cc
--- a/src/dillo.cc	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/dillo.cc	Sun Sep 11 05:53:42 2011 +0000
@@ -393,6 +393,8 @@
     */
    ((Fl_Widget *)bw->ui)->window()->make_current();
 
+   Fl::get_system_colors();
+
    /* Proxy authentication */
    if (prefs.http_proxyuser && !a_Http_proxy_auth()) {
       const char *passwd = a_UIcmd_get_passwd(prefs.http_proxyuser);
diff -r f5cb88e18908 src/findbar.cc
--- a/src/findbar.cc	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/findbar.cc	Sun Sep 11 05:53:42 2011 +0000
@@ -131,7 +131,6 @@
     i = new MyInput(x, border, input_width, height);
     x += input_width + gap;
     resizable(i);
-    i->color(206);
     i->when(FL_WHEN_NEVER);
    add(i);
 
diff -r f5cb88e18908 src/ui.cc
--- a/src/ui.cc	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/ui.cc	Sun Sep 11 05:53:42 2011 +0000
@@ -219,10 +219,6 @@
 
    if (b == FL_LEFT_MOUSE) {
       a_UIcmd_search_dialog(a_UIcmd_get_bw_by_widget(wid));
-   } else if (b == FL_MIDDLE_MOUSE) {
-      ((UI*)data)->color_change_cb_i();
-   } else if (b == FL_RIGHT_MOUSE) {
-      // nothing ATM
    }
 }
 
@@ -434,7 +430,6 @@
     p_xpos += b->w();
 
     Fl_Input *i = Location = new CustInput(p_xpos,0,ww-p_xpos-32,lh,0);
-    i->color(CuteColor);
     i->when(FL_WHEN_ENTER_KEY);
     i->callback(location_cb, this);
     i->tooltip("Location");
@@ -467,14 +462,12 @@
     IProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
     IProg->labelsize(12);
     IProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
-    IProg->labelcolor(FL_GRAY_RAMP + 2);
     IProg->update_label(wide ? "Images\n0 of 0" : "0 of 0");
     p_xpos += pw;
     // Page
     PProg = new CustProgressBox(p_xpos,p_ypos,pw,bh);
     PProg->labelsize(12);
     PProg->box(thin_up ? FL_THIN_UP_BOX : FL_EMBOSSED_BOX);
-    PProg->labelcolor(FL_GRAY_RAMP + 2);
     PProg->update_label(wide ? "Page\n0.0KB" : "0.0KB");
 }
 
@@ -635,14 +628,12 @@
    PanelTemporary = false;
    if (cur_ui) {
       PanelSize = cur_ui->PanelSize;
-      CuteColor = cur_ui->CuteColor;
       Small_Icons = cur_ui->Small_Icons;
       Panelmode = cur_ui->Panelmode;
    } else {
      // Set some default values
      PanelSize = prefs.panel_size;
      Small_Icons = prefs.small_icons;
-     CuteColor = 206;
      Panelmode = (prefs.fullwindow_start) ? UI_HIDDEN : UI_NORMAL;
    }
 
@@ -654,11 +645,9 @@
     Main = new Fl_Group(0,0,0,0,"Welcome..."); // size is set by rearrange()
     Main->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
     Main->box(FL_FLAT_BOX);
-    Main->color(FL_GRAY_RAMP + 3);
     Main->labelfont(FL_HELVETICA_BOLD_ITALIC);
     Main->labelsize(36);
     Main->labeltype(FL_SHADOW_LABEL);
-    Main->labelcolor(FL_WHITE);
     TopGroup->add(Main);
     TopGroup->resizable(Main);
     MainIdx = TopGroup->find(Main);
@@ -971,21 +960,6 @@
 }
 
 /*
- * On-the-fly color style change
- */
-void UI::color_change_cb_i()
-{
-   const int cols[] = {7,17,26,51,140,156,205,206,215,-1};
-   static int ncolor = 0;
-
-   ncolor = (cols[ncolor+1] < 0) ? 0 : ncolor + 1;
-   CuteColor = cols[ncolor];
-   MSG("Location color %d\n", CuteColor);
-   Location->color(CuteColor);
-   Location->redraw();
-}
-
-/*
  * Set 'nw' as the main render area widget
  */
 void UI::set_render_layout(Fl_Group *nw)
diff -r f5cb88e18908 src/ui.hh
--- a/src/ui.hh	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/ui.hh	Sun Sep 11 05:53:42 2011 +0000
@@ -161,7 +161,7 @@
 
    int MainIdx;
    // Panel customization variables
-   int PanelSize, CuteColor, Small_Icons;
+   int PanelSize, Small_Icons;
    int p_xpos, p_ypos, bw, bh, mh, lh, nh, fh, sh, pw, lbl;
    bool PanelTemporary;
 
diff -r f5cb88e18908 src/uicmd.cc
--- a/src/uicmd.cc	Sun Sep 11 05:45:34 2011 +0000
+++ b/src/uicmd.cc	Sun Sep 11 05:53:42 2011 +0000
@@ -107,7 +107,8 @@
       Fl_Group(0,0,ww,th,lbl) {
       Pack = NULL;
       tab_w = 50, tab_h = th, ctab_h = 1, btn_w = 20, ctl_w = 1*btn_w+2;
-      tabcolor_active = FL_DARK_CYAN; tabcolor_inactive = 206;
+      tabcolor_active = FL_SELECTION_COLOR;
+      tabcolor_inactive = FL_BACKGROUND_COLOR;
       resize(0,0,ww,ctab_h);
       /* tab buttons go inside a pack within a scroll */
       Scroll = new Fl_Scroll(0,0,ww-ctl_w,ctab_h);
@@ -124,8 +125,6 @@
       Control = new Fl_Group(ww-ctl_w,0,ctl_w,ctab_h);
        CloseBtn = new CustLightButton(ww-ctl_w+2,0,btn_w,ctab_h, "X");
        CloseBtn->box(FL_PLASTIC_ROUND_UP_BOX);
-       CloseBtn->labelcolor(0x00641000);
-       CloseBtn->hl_color(FL_WHITE);
        CloseBtn->clear_visible_focus();
        CloseBtn->tooltip(prefs.right_click_closes_tab ?
           "Close current tab.\nor Right-click tab label to close." :
@@ -254,6 +253,8 @@
    btn->clear_visible_focus();
    btn->box(FL_PLASTIC_ROUND_UP_BOX);
    btn->color(focus ? tabcolor_active : tabcolor_inactive);
+   btn->labelcolor(fl_contrast(FL_FOREGROUND_COLOR,
+                   focus ? tabcolor_active : tabcolor_inactive));
    btn->ui(new_ui);
    btn->callback(tab_btn_cb, this);
    Pack->add(btn); // append
@@ -366,10 +367,12 @@
       if ((idx = get_btn_idx(old_ui)) != -1) {
          btn = (CustTabButton*)Pack->child(idx);
          btn->color(tabcolor_inactive);
+         btn->labelcolor(fl_contrast(FL_FOREGROUND_COLOR, tabcolor_inactive));
          btn->redraw();
       }
       Wizard->value(cbtn->ui());
       cbtn->color(tabcolor_active);
+      cbtn->labelcolor(fl_contrast(FL_FOREGROUND_COLOR, tabcolor_active));
       cbtn->redraw();
       update_pack_offset();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.