import homebank-5.1.7
[chaz/homebank] / src / gtk-chart-colors.c
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2018 Maxime DOYEN
3 *
4 * This file is part of HomeBank.
5 *
6 * HomeBank is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * HomeBank is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <gtk/gtk.h>
21
22 #include "gtk-chart-colors.h"
23
24 char *chart_colors[] =
25 {
26 "HomeBank",
27 "Money",
28 "SAP",
29 "Quicken",
30 "Office 2010",
31 "Office 2013",
32 "Analytics",
33 "YNAB",
34 NULL
35 };
36
37
38 struct rgbcol ynab_colors[] =
39 {
40 { 238, 118, 96 },
41 { 245, 189, 115 },
42 { 239, 234, 172 },
43 { 143, 186, 209 },
44 { 211, 229, 134 },
45 { 163, 180, 120 },
46 { 167, 209, 195 },
47 { 51, 177, 191 },
48 { 214, 227, 99 },
49 //{ 246, 166, 209 }, // added color
50 { 131, 131, 131 }, // others
51 };
52 int ynab_nbcolors = G_N_ELEMENTS(ynab_colors);
53
54
55 struct rgbcol money_colors[] =
56 {
57 { 255, 193, 96 },
58 { 92, 131, 180 },
59 { 165, 88, 124 },
60 { 108, 124, 101 },
61 { 230, 121, 99 },
62 { 91, 160, 154 },
63 { 207, 93, 96 },
64 { 70, 136, 106 },
65
66 { 245, 163, 97 },
67 { 158, 153, 88 },
68 { 255, 140, 90 },
69 { 122, 151, 173 },
70 { 84, 142, 128 },
71 { 185, 201, 149 },
72 { 165, 99, 103 },
73 { 77, 140, 172 },
74
75 { 251, 228, 128 },
76 { 73, 99, 149 },
77 { 192, 80, 77 },
78 { 139, 180, 103 },
79 { 132, 165, 214 },
80 { 221, 216, 115 },
81 { 77, 103, 137 },
82 { 165, 181, 156 },
83
84 };
85 int money_nbcolors = G_N_ELEMENTS(money_colors);
86
87
88 struct rgbcol quicken_colors[] =
89 {
90 { 226, 73, 13 },
91 { 223, 180, 6 },
92 { 124, 179, 0 },
93 { 44, 108, 182 },
94 { 184, 81, 186 },
95 { 165, 165, 165 },
96 { 122, 122, 122 },
97 { 137, 42, 40 },
98
99 { 70, 161, 100 },
100 { 220, 106, 0 },
101 { 113, 113, 113 }, // others
102 };
103 int quicken_nbcolors = G_N_ELEMENTS(quicken_colors);
104
105
106 struct rgbcol analytics_colors[] =
107 {
108 { 5, 141, 199 }, //line color
109 { 80, 180, 50 },
110 { 237, 86, 27 },
111 { 237, 239, 0 },
112 { 36, 203, 229 },
113 { 100, 229, 114 },
114 { 255, 150, 85 },
115 { 255, 242, 99 },
116
117 { 106, 249, 196 },
118 { 178, 222, 255 },
119 { 204, 204, 204 }, // others
120 };
121 int analytics_nbcolors = G_N_ELEMENTS(analytics_colors);
122
123
124 struct rgbcol office2010_colors[] =
125 {
126 { 60, 100, 149 },
127 { 150, 60, 59 },
128 { 120, 147, 68 },
129 { 99, 75, 123 },
130 { 61, 133, 157 },
131 { 196, 115, 49 },
132
133 { 73, 120, 176 },
134 { 179, 74, 71 },
135 { 144, 178, 84 },
136 { 117, 93, 153 },
137 { 73, 161, 185 },
138 { 232, 140, 65 },
139
140 { 126, 155, 199 },
141 { 202, 126, 126 },
142 { 174, 197, 129 },
143 { 156, 137, 182 },
144 { 123, 185, 206 },
145 { 248, 170, 121 },
146 };
147 int office2010_nbcolors = G_N_ELEMENTS(office2010_colors);
148
149
150 struct rgbcol office2013_colors[] =
151 {
152 { 91, 155, 213 },
153 { 237, 125, 49 },
154 { 165, 165, 165 },
155 { 255, 192, 0 },
156 { 68, 114, 196 },
157 { 112, 173, 71 },
158
159 { 37, 94, 145 },
160 { 158, 72, 14 },
161 { 99, 99, 99 },
162 { 153, 115, 0 },
163 { 38, 68, 120 },
164 { 67, 104, 43 },
165
166 { 124, 175, 221 },
167 { 241, 151, 90 },
168 { 183, 183, 183 },
169 { 255, 205, 51 },
170 { 105, 142, 208 },
171 { 140, 193, 104 },
172 };
173 int office2013_nbcolors = G_N_ELEMENTS(office2013_colors);
174
175 struct rgbcol sap_colors[] =
176 {
177 { 107, 148, 181 },
178 { 239, 205, 120 },
179 { 160, 117, 146 },
180 { 107, 181, 144 },
181 { 237, 164, 112 },
182 { 107, 106, 161 },
183 { 183, 213, 104 },
184 { 214, 128, 118 },
185
186 { 135, 115, 161 },
187 { 218, 217, 86 },
188 { 207, 111, 122 },
189 { 85, 168, 161 },
190 { 253, 213, 65 },
191 { 146, 98, 148 },
192 { 115, 192, 59 },
193 { 205, 81, 96 },
194
195 { 53, 180, 201 },
196 { 248, 175, 103 },
197 { 186, 97, 125 },
198 { 117, 202, 249 },
199 { 244, 131, 35 },
200 { 178, 45, 110 },
201 { 87, 229, 151 },
202 { 204, 171, 68 },
203
204 { 172, 110, 145 },
205 { 61, 132, 137 },
206 { 224, 117, 79 },
207 { 117, 84, 148 },
208 { 155, 206, 158 },
209 { 255, 133, 100 },
210 { 60, 98, 153 },
211 { 128, 197, 122 },
212 };
213 int sap_nbcolors = G_N_ELEMENTS(sap_colors);
214
215 struct rgbcol homebank_colors[] =
216 {
217 { 72, 118, 176 },
218 { 180, 198, 230 },
219 { 227, 126, 35 },
220 { 238, 186, 123 },
221 { 97, 158, 58 },
222 { 175, 222, 142 },
223 { 184, 43, 44 },
224 { 231, 151, 149 },
225 { 136, 103, 185 },
226 { 190, 174, 210 },
227 { 127, 87, 77 },
228 { 184, 155, 147 },
229 { 202, 118, 190 },
230 { 230, 181, 208 },
231 { 126, 126, 126 },
232 { 198, 198, 198 },
233 { 187, 188, 56 },
234 { 218, 218, 144 },
235 { 109, 189, 205 },
236 { 176, 217, 228 },
237
238 { 237, 212, 0 },
239 { 255, 239, 101 },
240 { 207, 93, 96 },
241 { 234, 186, 187 },
242 { 193, 124, 17 },
243 { 240, 181, 90 },
244 { 186, 189, 182 },
245 { 225, 227, 223 },
246 { 115, 210, 22 },
247 { 175, 240, 112 },
248 { 255, 140, 90 },
249 { 255, 191, 165 },
250
251 };
252 int homebank_nbcolors = G_N_ELEMENTS(homebank_colors);
253
254
255
256 struct rgbcol global_colors[] =
257 {
258 { 0, 0, 0}, // black
259 {255, 255, 255}, // white
260 {239, 239, 239}, // grey1 THTEXT 0.05
261 { 68, 68, 68}, // text THTEXT 0.78
262 { 51, 51, 51}, // xyline THTEXT 0.8
263
264
265 /* { 255, 0, 0}, // fake
266 { 255, 255, 0}, // fake
267 { 255, 0, 255}, // fake
268 { 0, 255, 0}, // fake
269 { 0, 0, 255}, // fake
270 */
271
272
273 {255, 255, 255}, // theme base (bg)
274 { 46, 52, 54}, // theme fg
275 };
276
277
278
279 /*
280 struct rgbcol global_colors[] =
281 {
282 { 0, 0, 0}, // black
283 {255, 255, 255}, // white
284 {238, 238, 238}, // #top/bottom lines
285 {204, 204, 204}, // #dotted lines
286 {102, 102, 102}, // #x-axis, scale text
287 {153, 153, 153}, // # ??
288 { 0, 119, 204}, // #line color
289
290 //new
291 {239, 239, 239}, // intermediate lines
292 { 68, 68, 68}, // text
293 { 51, 51, 51}, // x/y axis
294
295
296 };*/
297
298
299 void chart_color_global_default(void)
300 {
301 struct rgbcol *tcol;
302
303 // set base color (adwaita)
304 tcol = &global_colors[THBASE];
305 tcol->r = 255;
306 tcol->g = 255;
307 tcol->b = 255;
308
309 // set text(bg) color (adwaita)
310 tcol = &global_colors[THTEXT];
311 tcol->r = 46;
312 tcol->g = 52;
313 tcol->b = 54;
314 }
315
316
317 void cairo_user_set_rgbcol(cairo_t *cr, struct rgbcol *col)
318 {
319 cairo_set_source_rgb(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b));
320 }
321
322
323 void cairo_user_set_rgbacol(cairo_t *cr, struct rgbcol *col, double alpha)
324 {
325 cairo_set_source_rgba(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b), alpha);
326 }
327
328
329 void cairo_user_set_rgbcol_over(cairo_t *cr, struct rgbcol *col, gboolean over)
330 {
331 if( over )
332 cairo_set_source_rgb(cr, COLTOCAIROOVER(col->r), COLTOCAIROOVER(col->g), COLTOCAIROOVER(col->b));
333 else
334 cairo_set_source_rgb(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b));
335 }
336
337
338 void colorscheme_init(GtkColorScheme *scheme, gint index)
339 {
340
341 scheme->cs_blue = 0;
342
343 switch(index)
344 {
345 default:
346 case CHART_COLMAP_HOMEBANK:
347 scheme->colors = homebank_colors;
348 scheme->nb_cols = homebank_nbcolors;
349 scheme->cs_green = 4;
350 scheme->cs_red = 6;
351 scheme->cs_yellow = 2;
352 scheme->cs_orange = 2;
353 break;
354 case CHART_COLMAP_MSMONEY:
355 scheme->colors = money_colors;
356 scheme->nb_cols = money_nbcolors;
357 scheme->cs_blue = 17;
358 scheme->cs_green = 19;
359 scheme->cs_red = 18;
360 scheme->cs_yellow = 16;
361 scheme->cs_orange = 8;
362 break;
363 case CHART_COLMAP_QUICKEN:
364 scheme->colors = quicken_colors;
365 scheme->nb_cols = quicken_nbcolors;
366 scheme->cs_blue = 3;
367 scheme->cs_green = 2;
368 scheme->cs_red = 0;
369 scheme->cs_yellow = 1;
370 scheme->cs_orange = 9;
371 break;
372 case CHART_COLMAP_ANALYTICS:
373 scheme->colors = analytics_colors;
374 scheme->nb_cols = analytics_nbcolors;
375 scheme->cs_green = 1;
376 scheme->cs_red = 2;
377 scheme->cs_yellow = 3;
378 scheme->cs_orange = 6;
379 break;
380 case CHART_COLMAP_OFFICE2010:
381 scheme->colors = office2010_colors;
382 scheme->nb_cols = office2010_nbcolors;
383 scheme->cs_green = 2;
384 scheme->cs_red = 1;
385 scheme->cs_yellow = 5;
386 scheme->cs_orange = 5;
387 break;
388 case CHART_COLMAP_OFFICE2013:
389 scheme->colors = office2013_colors;
390 scheme->nb_cols = office2013_nbcolors;
391 scheme->cs_green = 5;
392 scheme->cs_red = 1;
393 scheme->cs_yellow = 3;
394 scheme->cs_orange = 1;
395 break;
396 case CHART_COLMAP_SAP:
397 scheme->colors = sap_colors;
398 scheme->nb_cols = sap_nbcolors;
399 scheme->cs_green = 14;
400 scheme->cs_red = 15;
401 scheme->cs_yellow = 12;
402 scheme->cs_orange = 20;
403 break;
404 case CHART_COLMAP_YNAB:
405 scheme->colors = ynab_colors;
406 scheme->nb_cols = ynab_nbcolors;
407 scheme->cs_blue = 3;
408 scheme->cs_green = 5;
409 scheme->cs_red = 0;
410 scheme->cs_orange = 1;
411 break;
412 }
413
414
415 }
416
This page took 0.064263 seconds and 4 git commands to generate.