aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2012-12-30 03:38:42 +0000
committercorvid <corvid@lavabit.com>2012-12-30 03:38:42 +0000
commitaaab52c26db7ab85b263820947232d7eff8eebb3 (patch)
treeeeeaa33783c6ec53f18638c1c7669128f31fcf1c
parent08fcee0f972badaa2dc71ae5008fc5ae71dde1a3 (diff)
ui color fg/bg preferences
Recent mailing list: http://lists.auriga.wearlab.de/pipermail/dillo-dev/2012-December/009661.html The earlier thread begins with: http://lists.auriga.wearlab.de/pipermail/dillo-dev/2011-September/008890.html
-rw-r--r--dillorc8
-rw-r--r--src/dialog.cc3
-rw-r--r--src/dillo.cc14
-rw-r--r--src/findbar.cc1
-rw-r--r--src/pixmaps.h3
-rw-r--r--src/prefs.c3
-rw-r--r--src/prefs.h3
-rw-r--r--src/prefsparser.cc3
-rw-r--r--src/tipwin.cc2
-rw-r--r--src/ui.cc53
-rw-r--r--src/ui.hh2
-rw-r--r--src/uicmd.cc9
12 files changed, 62 insertions, 42 deletions
diff --git a/dillorc b/dillorc
index 03932498..3071c08a 100644
--- a/dillorc
+++ b/dillorc
@@ -206,7 +206,13 @@ search_url="Google http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%s"
# COLORS SECTION
#-------------------------------------------------------------------------
-# Set the background color
+# Override the user interface colors.
+#
+# ui_fg_color=black
+# ui_main_bg_color=silver
+# ui_text_bg_color=white
+
+# Set the page background color
# bg_color=gray
# bg_color=0xd6d6c0
#bg_color=0xdcd1ba
diff --git a/src/dialog.cc b/src/dialog.cc
index 94c31fb1..83b9ed8b 100644
--- a/src/dialog.cc
+++ b/src/dialog.cc
@@ -166,8 +166,6 @@ const char *a_Dialog_input(const char *title, const char *msg)
o->box(FL_THIN_UP_BOX);
o->labelfont(FL_TIMES_BOLD);
o->labelsize(34);
- o->color(FL_WHITE);
- o->labelcolor(FL_BLUE);
o->label("?");
o->show();
@@ -196,7 +194,6 @@ const char *a_Dialog_input(const char *title, const char *msg)
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 --git a/src/dillo.cc b/src/dillo.cc
index 1b7ca4f5..7fa471c8 100644
--- a/src/dillo.cc
+++ b/src/dillo.cc
@@ -237,6 +237,12 @@ static void checkPreferredFonts()
checkFont(prefs.font_fantasy, "fantasy");
}
+static void setColor(int32_t color, void (*fn) (uchar, uchar, uchar))
+{
+ if (color != -1)
+ fn(color >> 16, (color >> 8) & 0xff, color & 0xff);
+}
+
/*
* Given a command line argument, build a DilloUrl for it.
*/
@@ -382,6 +388,14 @@ int main(int argc, char **argv)
Fl::scheme(prefs.theme);
+ setColor(prefs.ui_main_bg_color, Fl::background);
+ setColor(prefs.ui_text_bg_color, Fl::background2);
+ setColor(prefs.ui_fg_color, Fl::foreground);
+
+ unsigned rgb = Fl::get_color(fl_contrast(FL_SELECTION_COLOR,
+ FL_BACKGROUND2_COLOR));
+ Fl::set_color(FL_SELECTION_COLOR, rgb);
+
if (!prefs.show_tooltip) {
// turn off UI tooltips
Fl::option(Fl::OPTION_SHOW_TOOLTIPS, false);
diff --git a/src/findbar.cc b/src/findbar.cc
index f376895f..b72aefb6 100644
--- a/src/findbar.cc
+++ b/src/findbar.cc
@@ -131,7 +131,6 @@ Findbar::Findbar(int width, int height) :
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 --git a/src/pixmaps.h b/src/pixmaps.h
index c1c6c294..91fe9c7d 100644
--- a/src/pixmaps.h
+++ b/src/pixmaps.h
@@ -1578,6 +1578,8 @@ static const char *const mini_ok_xpm[] = {
" @ "
};
+#if 0
+
/* XPM */
static const char *const left_i_xpm[] = {
"22 22 3 1",
@@ -1732,5 +1734,6 @@ static const char *const right_si_xpm[] = {
" @@@@@@@@",
" @@ @ @ ",
" @ "};
+#endif
#endif /* __PIXMAPS_H__ */
diff --git a/src/prefs.c b/src/prefs.c
index 752da7e3..4ec95144 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -100,6 +100,9 @@ void a_Prefs_init(void)
prefs.small_icons = FALSE;
prefs.start_page = a_Url_new(PREFS_START_PAGE, NULL);
prefs.theme = dStrdup(PREFS_THEME);
+ prefs.ui_fg_color = -1;
+ prefs.ui_main_bg_color = -1;
+ prefs.ui_text_bg_color = -1;
prefs.w3c_plus_heuristics = TRUE;
prefs.penalty_hyphen = 100;
diff --git a/src/prefs.h b/src/prefs.h
index 0c392ae5..074c8bd5 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -44,6 +44,9 @@ struct _DilloPrefs {
DilloUrl *home;
bool_t allow_white_bg;
int32_t bg_color;
+ int32_t ui_fg_color;
+ int32_t ui_main_bg_color;
+ int32_t ui_text_bg_color;
bool_t contrast_visited_color;
bool_t show_tooltip;
char *theme;
diff --git a/src/prefsparser.cc b/src/prefsparser.cc
index 2a335450..76665093 100644
--- a/src/prefsparser.cc
+++ b/src/prefsparser.cc
@@ -110,6 +110,9 @@ int PrefsParser::parseOption(char *name, char *value)
{ "small_icons", &prefs.small_icons, PREFS_BOOL },
{ "start_page", &prefs.start_page, PREFS_URL },
{ "theme", &prefs.theme, PREFS_STRING },
+ { "ui_fg_color", &prefs.ui_fg_color, PREFS_COLOR },
+ { "ui_main_bg_color", &prefs.ui_main_bg_color, PREFS_COLOR },
+ { "ui_text_bg_color", &prefs.ui_text_bg_color, PREFS_COLOR },
{ "w3c_plus_heuristics", &prefs.w3c_plus_heuristics, PREFS_BOOL },
{ "penalty_hyphen", &prefs.penalty_hyphen, PREFS_FRACTION_100 },
{ "penalty_hyphen_2", &prefs.penalty_hyphen_2, PREFS_FRACTION_100 },
diff --git a/src/tipwin.cc b/src/tipwin.cc
index 35046218..960571a1 100644
--- a/src/tipwin.cc
+++ b/src/tipwin.cc
@@ -174,7 +174,7 @@ CustButton::CustButton(int x, int y, int w, int h, const char *l) :
TipWinButton(x,y,w,h,l)
{
norm_color = color();
- light_color = 17; // {17,26,51}
+ light_color = fl_lighter(norm_color);
}
int CustButton::handle(int e)
diff --git a/src/ui.cc b/src/ui.cc
index 2dab4954..e5f1f307 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -51,11 +51,11 @@ static struct iconset standard_icons = {
new Fl_Pixmap(search_xpm),
new Fl_Pixmap(help_xpm),
new Fl_Pixmap(left_xpm),
- new Fl_Pixmap(left_i_xpm),
+ NULL,
new Fl_Pixmap(right_xpm),
- new Fl_Pixmap(right_i_xpm),
+ NULL,
new Fl_Pixmap(stop_xpm),
- new Fl_Pixmap(stop_i_xpm),
+ NULL,
};
static struct iconset small_icons = {
@@ -70,11 +70,11 @@ static struct iconset small_icons = {
standard_icons.ImgSearch,
standard_icons.ImgHelp,
new Fl_Pixmap(left_s_xpm),
- new Fl_Pixmap(left_si_xpm),
+ NULL,
new Fl_Pixmap(right_s_xpm),
- new Fl_Pixmap(right_si_xpm),
+ NULL,
new Fl_Pixmap(stop_s_xpm),
- new Fl_Pixmap(stop_si_xpm),
+ NULL,
};
@@ -227,10 +227,6 @@ static void search_cb(Fl_Widget *wid, void *data)
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
}
}
@@ -410,6 +406,21 @@ CustButton *UI::make_button(const char *label, Fl_Image *img, Fl_Image *deimg,
*/
void UI::make_toolbar(int tw, int th)
{
+ if (!icons->ImgLeftIn) {
+ icons->ImgLeftIn = icons->ImgLeft->copy();
+ icons->ImgLeftIn->desaturate();
+ icons->ImgLeftIn->color_average(FL_GRAY, .5f);
+ }
+ if (!icons->ImgRightIn) {
+ icons->ImgRightIn = icons->ImgRight->copy();
+ icons->ImgRightIn->desaturate();
+ icons->ImgRightIn->color_average(FL_GRAY, .5f);
+ }
+ if (!icons->ImgStopIn) {
+ icons->ImgStopIn = icons->ImgStop->copy();
+ icons->ImgStopIn->desaturate();
+ icons->ImgStopIn->color_average(FL_GRAY, .5f);
+ }
Back = make_button("Back", icons->ImgLeft, icons->ImgLeftIn, UI_BACK, 1);
Forw = make_button("Forw", icons->ImgRight, icons->ImgRightIn, UI_FORW);
Home = make_button("Home", icons->ImgHome, NULL, UI_HOME);
@@ -446,7 +457,6 @@ void UI::make_location(int ww)
CustInput *i = new CustInput(p_xpos,0,ww-p_xpos-32,lh,0);
Location = i;
- i->color(CuteColor);
i->when(FL_WHEN_ENTER_KEY);
i->callback(location_cb, this);
i->set_tooltip("Location");
@@ -479,14 +489,12 @@ void UI::make_progress_bars(int wide, int thin_up)
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.0 KB" : "0.0 KB");
}
@@ -646,14 +654,12 @@ UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) :
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;
}
@@ -665,11 +671,9 @@ UI::UI(int x, int y, int ui_w, int ui_h, const char* label, const UI *cur_ui) :
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);
@@ -992,21 +996,6 @@ void UI::change_panel(int new_size, int small_icons)
}
/*
- * 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 --git a/src/ui.hh b/src/ui.hh
index ac47b13c..28bf71b2 100644
--- a/src/ui.hh
+++ b/src/ui.hh
@@ -135,7 +135,7 @@ class UI : public CustGroupVertical {
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 --git a/src/uicmd.cc b/src/uicmd.cc
index 0007813f..5ba565c5 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -136,7 +136,8 @@ public:
Pack = NULL;
focus_counter = 0;
tab_w = 50, tab_h = th, ctab_h = 1, btn_w = 20, ctl_w = 1*btn_w+2;
- tabcolor_active = 0x87aca700; tabcolor_inactive = 0xb7beb700;
+ tabcolor_active = fl_lighter(FL_BACKGROUND_COLOR);
+ tabcolor_inactive = fl_darker(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);
@@ -153,8 +154,6 @@ public:
Control = new Fl_Group(ww-ctl_w,0,ctl_w,ctab_h);
CloseBtn = new CustButton(ww-ctl_w+2,0,btn_w,ctab_h, "X");
CloseBtn->box(FL_THIN_UP_BOX);
- CloseBtn->labelcolor(0x00641000);
- CloseBtn->hl_color(FL_WHITE);
CloseBtn->clear_visible_focus();
CloseBtn->set_tooltip(prefs.right_click_closes_tab ?
"Close current tab.\nor Right-click tab label to close." :
@@ -283,6 +282,8 @@ UI *CustTabs::add_new_tab(UI *old_ui, int focus)
btn->clear_visible_focus();
btn->box(FL_GTK_THIN_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
@@ -411,10 +412,12 @@ void CustTabs::switch_tab(CustTabButton *cbtn)
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();