2 * Copyright 2007-2011, Haiku Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * François Revol, revol@free.fr
7 * Axel Dörfler, axeld@pinc-software.de
14 #include <Application.h>
15 #include <InterfaceDefs.h>
18 #include <private/interface/DecoratorPrivate.h>
21 using namespace BPrivate
;
24 static int sColorWhich
= -1;
25 static struct option
const kLongOptions
[] = {
26 {"activetab", required_argument
, &sColorWhich
, B_WINDOW_TAB_COLOR
},
27 {"frame", required_argument
, &sColorWhich
, B_WINDOW_INACTIVE_TAB_COLOR
}, //XXX:??
28 {"activeborder", required_argument
, &sColorWhich
, -1}, //XXX:??
29 {"inactiveborder", required_argument
, &sColorWhich
, -1}, //XXX:??
30 {"activetitle", required_argument
, &sColorWhich
, B_WINDOW_TEXT_COLOR
},
31 {"inactivetitle", required_argument
, &sColorWhich
, B_WINDOW_INACTIVE_TEXT_COLOR
},
33 // grep ' B_.*_COLOR' headers/os/interface/InterfaceDefs.h | awk '{ print "I(" substr(tolower($1),3) ", " $1 ")," }'
35 { #l, required_argument, &sColorWhich, v }, \
36 { #v, required_argument, &sColorWhich, v }
38 I(panel_background_color
, B_PANEL_BACKGROUND_COLOR
),
39 I(panel_text_color
, B_PANEL_TEXT_COLOR
),
40 I(document_background_color
, B_DOCUMENT_BACKGROUND_COLOR
),
41 I(document_text_color
, B_DOCUMENT_TEXT_COLOR
),
42 I(control_background_color
, B_CONTROL_BACKGROUND_COLOR
),
43 I(control_text_color
, B_CONTROL_TEXT_COLOR
),
44 I(control_border_color
, B_CONTROL_BORDER_COLOR
),
45 I(control_highlight_color
, B_CONTROL_HIGHLIGHT_COLOR
),
46 I(control_mark_color
, B_CONTROL_MARK_COLOR
),
47 I(navigation_base_color
, B_NAVIGATION_BASE_COLOR
),
48 I(navigation_pulse_color
, B_NAVIGATION_PULSE_COLOR
),
49 I(shine_color
, B_SHINE_COLOR
),
50 I(shadow_color
, B_SHADOW_COLOR
),
51 I(link_text_color
, B_LINK_TEXT_COLOR
),
52 I(link_hover_color
, B_LINK_HOVER_COLOR
),
53 I(link_visited_color
, B_LINK_VISITED_COLOR
),
54 I(link_active_color
, B_LINK_ACTIVE_COLOR
),
55 I(menu_background_color
, B_MENU_BACKGROUND_COLOR
),
56 I(menu_selected_background_color
, B_MENU_SELECTED_BACKGROUND_COLOR
),
57 I(menu_item_text_color
, B_MENU_ITEM_TEXT_COLOR
),
58 I(menu_selected_item_text_color
, B_MENU_SELECTED_ITEM_TEXT_COLOR
),
59 I(menu_selected_border_color
, B_MENU_SELECTED_BORDER_COLOR
),
60 I(list_background_color
, B_LIST_BACKGROUND_COLOR
),
61 I(list_selected_background_color
, B_LIST_SELECTED_BACKGROUND_COLOR
),
62 I(list_item_text_color
, B_LIST_ITEM_TEXT_COLOR
),
63 I(list_selected_item_text_color
, B_LIST_SELECTED_ITEM_TEXT_COLOR
),
64 I(scroll_bar_thumb_color
, B_SCROLL_BAR_THUMB_COLOR
),
65 I(tooltip_background_color
, B_TOOL_TIP_BACKGROUND_COLOR
),
66 I(tooltip_text_color
, B_TOOL_TIP_TEXT_COLOR
),
67 I(success_color
, B_SUCCESS_COLOR
),
68 I(failure_color
, B_FAILURE_COLOR
),
69 I(keyboard_navigation_color
, B_KEYBOARD_NAVIGATION_COLOR
),
70 I(menu_selection_background_color
, B_MENU_SELECTION_BACKGROUND_COLOR
),
71 I(desktop_color
, B_DESKTOP_COLOR
),
72 I(window_tab_color
, B_WINDOW_TAB_COLOR
),
73 I(window_text_color
, B_WINDOW_TEXT_COLOR
),
74 I(window_inactive_tab_color
, B_WINDOW_INACTIVE_TAB_COLOR
),
75 I(window_inactive_text_color
, B_WINDOW_INACTIVE_TEXT_COLOR
),
76 I(window_border_color
, B_WINDOW_BORDER_COLOR
),
77 I(window_inactive_border_color
, B_WINDOW_INACTIVE_BORDER_COLOR
),
78 {"sum", required_argument
, 0, 's'},
79 {"refresh", no_argument
, 0, 'r'},
80 {"help", no_argument
, 0, 'h'},
85 extern const char *__progname
;
86 static const char *sProgramName
= __progname
;
92 printf("%s [-sum md5sum] [colID colspec] [-refresh]\n", sProgramName
);
93 printf("Tweak the default window decorator colors.\n");
94 printf("\t-sum deprecated option, kept for compatibility\n");
95 printf("\t-refresh refresh the entire display (force update)\n");
96 printf("\tcolID can be:\n");
97 printf("\t-activetab\n");
99 printf("\t-activeborder\n");
100 printf("\t-inactiveborder\n");
101 printf("\t-activetitle\n");
102 printf("\t-inactivetitle\n");
103 printf("\tcolspec is a 6 digit hexadecimal color number. \n"
104 "\t\t\t(rrggbb, html format)\n");
109 UpdateUIColor(color_which which
, const char *str
)
112 unsigned int r
, g
, b
;
120 if (sscanf(str
, "%02x%02x%02x", &r
, &g
, &b
) < 3)
126 //printf("setting %d to {%d, %d, %d, %d}\n", which, r, g, b, 255);
127 set_ui_color(which
, color
);
132 main(int argc
, char **argv
)
134 BApplication
app("application/x-vnd.Haiku-WindowShade");
137 // parse command line parameters
139 while ((c
= getopt_long_only(argc
, argv
, "h", kLongOptions
, NULL
)) != -1) {
142 UpdateUIColor((color_which
)sColorWhich
, optarg
);
153 // TODO: refresh (but shouldn't be needed)
155 if (get_decorator(name
))
161 // IGNORED, for compatibility with original app