Skip to content

Commit 7cb7568

Browse files
committed
ds00: Color scheme and themes support
1 parent 86ac8fc commit 7cb7568

File tree

9 files changed

+218
-165
lines changed

9 files changed

+218
-165
lines changed

winu/core/ds/ds00/ui/createw.c

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ struct gws_window_d *do_create_titlebar(
337337
unsigned int ornament_color,
338338
int has_icon,
339339
int icon_id,
340-
int has_string )
340+
int has_string,
341+
unsigned long string_color )
341342
{
342343
struct gws_window_d *tbWindow;
343344

@@ -347,8 +348,9 @@ struct gws_window_d *do_create_titlebar(
347348
unsigned long TitleBarWidth=0; // Width of titlebar
348349
unsigned long TitleBarHeight = tb_height; // Height passed as parameter
349350

350-
// Color and rop.
351+
// Colors
351352
unsigned int TitleBarColor = color;
353+
unsigned int StringColor = string_color;
352354
unsigned long rop=0;
353355
//unsigned long rop= 0x20;
354356
int useIcon = FALSE;
@@ -561,22 +563,24 @@ struct gws_window_d *do_create_titlebar(
561563
// #bugbug: Use 'const char *'
562564

563565
tbWindow->name = (char *) strdup((const char *) parent->name);
564-
if ((void*) tbWindow->name == NULL){
566+
if ((void*) tbWindow->name == NULL)
567+
{
568+
// #todo: Recover
565569
printf("do_create_titlebar: Invalid name\n");
566570
return NULL;
567571
}
568572

569573
unsigned long sL=0;
570574
unsigned long sT=0;
571-
unsigned int sColor = (unsigned int) parent->titlebar_text_color;
575+
//unsigned int sColor = (unsigned int) parent->titlebar_text_color;
572576
if (useTitleString == TRUE)
573577
{
574578
// Saving relative position.
575579
parent->titlebar_text_left = StringLeftPad;
576580
parent->titlebar_text_top = StringTopPad;
577581
sL = (unsigned long) ((tbWindow->absolute_x) + StringLeftPad);
578582
sT = (unsigned long) ((tbWindow->absolute_y) + StringTopPad);
579-
grDrawString ( sL, sT, sColor, tbWindow->name );
583+
grDrawString ( sL, sT, StringColor, tbWindow->name );
580584
}
581585

582586
// ---------------------------------
@@ -675,9 +679,9 @@ doCreateWindowFrame (
675679
unsigned long TitleBarHeight =
676680
METRICS_TITLEBAR_DEFAULT_HEIGHT;
677681

678-
// Titlebar color for active window
679-
unsigned int TitleBarColor =
680-
(unsigned int) get_color(csiActiveWindowTitleBar);
682+
// Titlebar colors for active window
683+
unsigned int TitleBarColor = (unsigned int) get_color(csiActiveWindowTitleBar);
684+
unsigned int TitleBarStringColor = (unsigned int) get_color(csiTitleBarTextColor);
681685

682686
int icon_id = ICON_ID_APP; // Default
683687

@@ -952,7 +956,8 @@ doCreateWindowFrame (
952956
OrnamentColor1,
953957
useIcon,
954958
icon_id,
955-
useTitleString );
959+
useTitleString,
960+
TitleBarStringColor );
956961

957962
// Register window
958963
id = (int) RegisterWindow(tbWindow);
@@ -1125,6 +1130,17 @@ void *doCreateWindow (
11251130
ClientAreaColor = (unsigned int) client_color;
11261131
};
11271132

1133+
1134+
int isDarkTheme = FALSE;
1135+
if ((void *) GWSCurrentColorScheme != NULL)
1136+
{
1137+
if (GWSCurrentColorScheme->magic == 1234)
1138+
{
1139+
if (GWSCurrentColorScheme->is_dark == TRUE)
1140+
isDarkTheme = TRUE;
1141+
}
1142+
}
1143+
11281144
//
11291145
// Internal flags
11301146
//
@@ -2507,9 +2523,13 @@ void *doCreateWindow (
25072523
(unsigned int) buttonBorderColor2_light,
25082524
(unsigned int) buttonBorder_outercolor );
25092525

2510-
//#todo: Use the color scheme.
2511-
window->label_color_when_selected = xCOLOR_GRAY1;
2512-
window->label_color_when_not_selected = xCOLOR_BLACK;
2526+
window->label_color_when_not_selected = (unsigned int) get_color(csiSystemFontColor);
2527+
if (isDarkTheme == TRUE){
2528+
window->label_color_when_selected = COLOR_WHITE;
2529+
} else {
2530+
window->label_color_when_selected = xCOLOR_GRAY1;
2531+
}
2532+
25132533

25142534
// Setup the label's properties.
25152535
if (buttonSelected == TRUE){

winu/core/ds/ds00/ui/createw.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ struct gws_window_d *do_create_titlebar(
1616
unsigned int ornament_color,
1717
int has_icon,
1818
int icon_id,
19-
int has_string );
19+
int has_string,
20+
unsigned long string_color );
2021

2122
// #important:
2223
// O frame de uma janela deve fazer parte do window manager

winu/core/ds/ds00/ui/themes/honey.h

Lines changed: 28 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,73 +5,40 @@
55
#ifndef __HONEY_H
66
#define __HONEY_H 1
77

8-
/*
9-
#define HONEY_COLOR_BACKGROUND 0x00909497 //0x00008080
10-
#define HONEY_COLOR_WINDOW 0x00FFFFFF
11-
#define HONEY_COLOR_WINDOW_BACKGROUND COLOR_GRAY //0x00202020
12-
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x00404040
13-
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00606060
14-
// Titlebar for active window.
15-
// Light blue (Um pouco fosco)
16-
#define HONEY_COLOR_ACTIVE_WINDOW_TITLEBAR 0x00A9CCE3 //COLOR_BLUE1
17-
#define HONEY_COLOR_INACTIVE_WINDOW_TITLEBAR 0x00606060
18-
#define HONEY_COLOR_MENUBAR 0x00808080
19-
#define HONEY_COLOR_SCROLLBAR 0x00FFF5EE
20-
#define HONEY_COLOR_STATUSBAR 0x0083FCFF
21-
// Taskbar for the window manager.
22-
#define HONEY_COLOR_TASKBAR 0x00C3C3C3
23-
#define HONEY_COLOR_MESSAGEBOX 0x00404040
24-
#define HONEY_COLOR_SYSTEMFONT 0x00000000
25-
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF
26-
#define HONEY_COLOR_BUTTON 0x00C3C3C3
27-
// Window border
28-
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
29-
// Window with focus border
30-
#define HONEY_COLOR_WWF_BORDER COLOR_BLUE
31-
#define HONEY_COLOR_TITLEBAR_TEXT COLOR_WHITE
32-
// When mouse hover.
33-
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
34-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL COLOR_BLUE
35-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL COLOR_BLUE
36-
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL COLOR_RED
37-
//...
38-
// --------------------
39-
*/
8+
// Background
9+
#define HONEY_COLOR_BACKGROUND 0x00505050
10+
#define HONEY_COLOR_WINDOW_BACKGROUND COLOR_GRAY //0x00202020
11+
12+
// Window
13+
#define HONEY_COLOR_WINDOW 0x00d4d0c8
14+
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
15+
#define HONEY_COLOR_WWF_BORDER COLOR_BLUE
16+
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x006e2209
17+
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00808080
18+
19+
// Controls
20+
#define HONEY_COLOR_BUTTON 0x00d4d0c8
21+
22+
// Box
23+
#define HONEY_COLOR_MESSAGEBOX 0x00404040
24+
#define HONEY_COLOR_DIALOGBOX 0x00404040
25+
26+
// Bars
27+
#define HONEY_COLOR_MENUBAR 0x00808080
28+
#define HONEY_COLOR_SCROLLBAR 0x00FFF5EE
29+
#define HONEY_COLOR_STATUSBAR 0x0083FCFF
30+
#define HONEY_COLOR_TASKBAR 0x00C3C3C3
4031

41-
#define HONEY_COLOR_BACKGROUND 0x00505050
42-
#define HONEY_COLOR_WINDOW 0x00d4d0c8
43-
#define HONEY_COLOR_WINDOW_BACKGROUND COLOR_GRAY //0x00202020
44-
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x006e2209
45-
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00808080
46-
// Titlebar for active window.
47-
// Light blue (Um pouco fosco)
32+
// Titlebar
4833
#define HONEY_COLOR_ACTIVE_WINDOW_TITLEBAR 0x00A9CCE3 //COLOR_BLUE1
4934
#define HONEY_COLOR_INACTIVE_WINDOW_TITLEBAR 0x00606060
50-
#define HONEY_COLOR_MENUBAR 0x00808080
51-
#define HONEY_COLOR_SCROLLBAR 0x00FFF5EE
52-
#define HONEY_COLOR_STATUSBAR 0x0083FCFF
53-
// Taskbar for the window manager.
54-
#define HONEY_COLOR_TASKBAR 0x00C3C3C3
55-
#define HONEY_COLOR_MESSAGEBOX 0x00404040
56-
#define HONEY_COLOR_SYSTEMFONT 0x00000000
57-
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF
58-
#define HONEY_COLOR_BUTTON 0x00d4d0c8
59-
// Window border
60-
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
61-
// Window with focus border
62-
#define HONEY_COLOR_WWF_BORDER COLOR_BLUE
63-
//#define HONEY_COLOR_TITLEBAR_TEXT COLOR_WHITE
6435
#define HONEY_COLOR_TITLEBAR_TEXT COLOR_BLACK
6536

66-
/*
67-
// When mouse hover.
68-
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
69-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL COLOR_BLUE
70-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL COLOR_BLUE
71-
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL COLOR_RED
72-
*/
37+
// Fonts
38+
#define HONEY_COLOR_SYSTEMFONT 0x00000000
39+
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF
7340

74-
// When mouse hover.
41+
// When mouse hover
7542
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
7643
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL 0x0073A9C2 // steel blue
7744
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL 0x0073A9C2 // steel blue
@@ -80,4 +47,3 @@
8047

8148
#endif
8249

83-

winu/core/ds/ds00/ui/themes/res/honey1.h

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,45 @@
55
#ifndef __HONEY_H
66
#define __HONEY_H 1
77

8+
// Bakcground
89
#define HONEY_COLOR_BACKGROUND 0x00202040 // deep navy background
9-
#define HONEY_COLOR_WINDOW 0x00E0F7FA // light aqua window
1010
#define HONEY_COLOR_WINDOW_BACKGROUND COLOR_GRAY
11+
12+
// Window
13+
#define HONEY_COLOR_WINDOW 0x00E0F7FA // light aqua window
14+
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
15+
#define HONEY_COLOR_WWF_BORDER COLOR_BLUE
1116
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x00006699 // dark teal border
1217
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00707080 // muted gray border
1318

14-
// Titlebar for active window.
15-
// Bright ocean blue
16-
#define HONEY_COLOR_ACTIVE_WINDOW_TITLEBAR 0x0048A9E0 // vivid blue
17-
#define HONEY_COLOR_INACTIVE_WINDOW_TITLEBAR 0x00405060 // slate gray
19+
// Controls
20+
#define HONEY_COLOR_BUTTON 0x00B0C4DE // light steel blue
1821

22+
// Box
23+
#define HONEY_COLOR_MESSAGEBOX 0x00304050 // dark navy
24+
#define HONEY_COLOR_DIALOGBOX 0x00304050 // dark navy
25+
26+
// Bars
1927
#define HONEY_COLOR_MENUBAR 0x00608090 // teal gray
2028
#define HONEY_COLOR_SCROLLBAR 0x00B2EBF2 // pale aqua
2129
#define HONEY_COLOR_STATUSBAR 0x0048D1CC // turquoise
22-
23-
// Taskbar for the window manager.
2430
#define HONEY_COLOR_TASKBAR 0x0080A0B0 // steel blue
25-
#define HONEY_COLOR_MESSAGEBOX 0x00304050 // dark navy
26-
#define HONEY_COLOR_SYSTEMFONT 0x00000000 // black
27-
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF // white
28-
#define HONEY_COLOR_BUTTON 0x00B0C4DE // light steel blue
2931

30-
// Window border
31-
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
32-
// Window with focus border
33-
#define HONEY_COLOR_WWF_BORDER COLOR_BLUE
34-
35-
// Titlebar text
32+
// Titlebar for active window.
33+
// Bright ocean blue
34+
#define HONEY_COLOR_ACTIVE_WINDOW_TITLEBAR 0x0048A9E0 // vivid blue
35+
#define HONEY_COLOR_INACTIVE_WINDOW_TITLEBAR 0x00405060 // slate gray
3636
#define HONEY_COLOR_TITLEBAR_TEXT COLOR_WHITE
3737

38-
// When mouse hover.
39-
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
40-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL COLOR_BLUE
41-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL COLOR_BLUE
42-
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL COLOR_RED
38+
// Fonts
39+
#define HONEY_COLOR_SYSTEMFONT 0x00000000 // black
40+
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF // white
41+
42+
// When mouse hover
43+
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
44+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL 0x0073A9C2 // steel blue
45+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL 0x0073A9C2 // steel blue
46+
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL 0x00B22222 // firebrick red
47+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MENUITEM 0x00FFD580 // warm honey gold
4348

4449
#endif

winu/core/ds/ds00/ui/themes/res/honey2.h

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,48 @@
55
#ifndef __HONEY_H
66
#define __HONEY_H 1
77

8-
#define HONEY_COLOR_BACKGROUND 0x00101010 // near black background
9-
#define HONEY_COLOR_WINDOW 0x00202020 // dark gray window
10-
#define HONEY_COLOR_WINDOW_BACKGROUND COLOR_BLACK
11-
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x00404040 // medium gray border
12-
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00303030 // darker gray border
8+
// Background
9+
#define HONEY_COLOR_BACKGROUND 0x00102030 // almost black with a blue tint
10+
#define HONEY_COLOR_WINDOW_BACKGROUND 0x00303030 // soft dark gray
11+
12+
// Window
13+
#define HONEY_COLOR_WINDOW 0x00404040 // medium dark gray
14+
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
15+
#define HONEY_COLOR_WWF_BORDER COLOR_HIGHLIGHT // bright blue accent
16+
#define HONEY_COLOR_ACTIVE_WINDOW_BORDER 0x00404040 // medium gray border
17+
#define HONEY_COLOR_INACTIVE_WINDOW_BORDER 0x00303030 // darker gray border
18+
19+
// Controls
20+
#define HONEY_COLOR_BUTTON 0x00303030 // dark gray button
21+
22+
// Bars
23+
#define HONEY_COLOR_MENUBAR 0x00202020 // dark gray menubar
24+
#define HONEY_COLOR_SCROLLBAR 0x00404040 // medium gray scrollbar
25+
#define HONEY_COLOR_STATUSBAR 0x00202020 // dark status bar
26+
#define HONEY_COLOR_TASKBAR 0x00202020 // dark gray taskbar
1327

1428
// Titlebar for active window.
1529
// Deep charcoal with accent
1630
#define HONEY_COLOR_ACTIVE_WINDOW_TITLEBAR 0x00252525 // dark charcoal
1731
#define HONEY_COLOR_INACTIVE_WINDOW_TITLEBAR 0x00303030 // muted gray
32+
#define HONEY_COLOR_TITLEBAR_TEXT COLOR_WHITE
1833

19-
#define HONEY_COLOR_MENUBAR 0x00202020 // dark gray menubar
20-
#define HONEY_COLOR_SCROLLBAR 0x00404040 // medium gray scrollbar
21-
#define HONEY_COLOR_STATUSBAR 0x00202020 // dark status bar
22-
23-
// Taskbar for the window manager.
24-
#define HONEY_COLOR_TASKBAR 0x00202020 // dark gray taskbar
34+
// Box
2535
#define HONEY_COLOR_MESSAGEBOX 0x00202020 // dark gray messagebox
36+
#define HONEY_COLOR_DIALOGBOX 0x00202020 // dark gray messagebox
37+
38+
// Fonts
2639
#define HONEY_COLOR_SYSTEMFONT 0x00FFFFFF // white text
2740
#define HONEY_COLOR_TERMINALFONT 0x00FFFFFF // white text
28-
#define HONEY_COLOR_BUTTON 0x00303030 // dark gray button
29-
30-
// Window border
31-
#define HONEY_COLOR_WINDOW_BORDER COLOR_INACTIVEBORDER
32-
// Window with focus border
33-
#define HONEY_COLOR_WWF_BORDER COLOR_HIGHLIGHT // bright blue accent
34-
35-
// Titlebar text
36-
#define HONEY_COLOR_TITLEBAR_TEXT COLOR_WHITE
3741

38-
// When mouse hover.
39-
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY4
40-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL COLOR_HIGHLIGHT
41-
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL COLOR_HIGHLIGHT
42-
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL COLOR_RED
42+
// When mouse hover
43+
#define HONEY_COLOR_BG_ONMOUSEHOVER xCOLOR_GRAY3
44+
// Minimize & Maximize Controls (same blue tone)
45+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MIN_CONTROL 0x005A7D9A // slate blue-gray
46+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MAX_CONTROL 0x005A7D9A // slate blue-gray
47+
// Close Control (keep strong red)
48+
#define HONEY_COLOR_BG_ONMOUSEHOVER_CLO_CONTROL 0x00B22222 // firebrick red
49+
// Menu Item Hover (blue accent for consistency)
50+
#define HONEY_COLOR_BG_ONMOUSEHOVER_MENUITEM 0x005A7D9A // slate blue-gray
4351

4452
#endif

0 commit comments

Comments
 (0)