]> Dogcows Code - chaz/homebank/blob - src/gtk-chart-colors.c
import homebank-5.1.2
[chaz/homebank] / src / gtk-chart-colors.c
1 /* HomeBank -- Free, easy, personal accounting for everyone.
2 * Copyright (C) 1995-2016 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 NULL
34 };
35
36
37 struct rgbcol money_colors[] =
38 {
39 { 255, 193, 96 },
40 { 92, 131, 180 },
41 { 165, 88, 124 },
42 { 108, 124, 101 },
43 { 230, 121, 99 },
44 { 91, 160, 154 },
45 { 207, 93, 96 },
46 { 70, 136, 106 },
47
48 { 245, 163, 97 },
49 { 158, 153, 88 },
50 { 255, 140, 90 },
51 { 122, 151, 173 },
52 { 84, 142, 128 },
53 { 185, 201, 149 },
54 { 165, 99, 103 },
55 { 77, 140, 172 },
56
57 { 251, 228, 128 },
58 { 73, 99, 149 },
59 { 192, 80, 77 },
60 { 139, 180, 103 },
61 { 132, 165, 214 },
62 { 221, 216, 115 },
63 { 77, 103, 137 },
64 { 165, 181, 156 },
65
66 };
67 int money_nbcolors = G_N_ELEMENTS(money_colors);
68
69
70 struct rgbcol quicken_colors[] =
71 {
72 { 226, 73, 13 },
73 { 223, 180, 6 },
74 { 124, 179, 0 },
75 { 44, 108, 182 },
76 { 184, 81, 186 },
77 { 165, 165, 165 },
78 { 122, 122, 122 },
79 { 137, 42, 40 },
80
81 { 70, 161, 100 },
82 { 220, 106, 0 },
83 { 113, 113, 113 }, // others
84 };
85 int quicken_nbcolors = G_N_ELEMENTS(quicken_colors);
86
87
88 struct rgbcol analytics_colors[] =
89 {
90 { 5, 141, 199 }, //line color
91 { 80, 180, 50 },
92 { 237, 86, 27 },
93 { 237, 239, 0 },
94 { 36, 203, 229 },
95 { 100, 229, 114 },
96 { 255, 150, 85 },
97 { 255, 242, 99 },
98
99 { 106, 249, 196 },
100 { 178, 222, 255 },
101 { 204, 204, 204 }, // others
102 };
103 int analytics_nbcolors = G_N_ELEMENTS(analytics_colors);
104
105
106 struct rgbcol office2010_colors[] =
107 {
108 { 60, 100, 149 },
109 { 150, 60, 59 },
110 { 120, 147, 68 },
111 { 99, 75, 123 },
112 { 61, 133, 157 },
113 { 196, 115, 49 },
114
115 { 73, 120, 176 },
116 { 179, 74, 71 },
117 { 144, 178, 84 },
118 { 117, 93, 153 },
119 { 73, 161, 185 },
120 { 232, 140, 65 },
121
122 { 126, 155, 199 },
123 { 202, 126, 126 },
124 { 174, 197, 129 },
125 { 156, 137, 182 },
126 { 123, 185, 206 },
127 { 248, 170, 121 },
128 };
129 int office2010_nbcolors = G_N_ELEMENTS(office2010_colors);
130
131
132 struct rgbcol office2013_colors[] =
133 {
134 { 91, 155, 213 },
135 { 237, 125, 49 },
136 { 165, 165, 165 },
137 { 255, 192, 0 },
138 { 68, 114, 196 },
139 { 112, 173, 71 },
140
141 { 37, 94, 145 },
142 { 158, 72, 14 },
143 { 99, 99, 99 },
144 { 153, 115, 0 },
145 { 38, 68, 120 },
146 { 67, 104, 43 },
147
148 { 124, 175, 221 },
149 { 241, 151, 90 },
150 { 183, 183, 183 },
151 { 255, 205, 51 },
152 { 105, 142, 208 },
153 { 140, 193, 104 },
154 };
155 int office2013_nbcolors = G_N_ELEMENTS(office2013_colors);
156
157 struct rgbcol sap_colors[] =
158 {
159 { 107, 148, 181 },
160 { 239, 205, 120 },
161 { 160, 117, 146 },
162 { 107, 181, 144 },
163 { 237, 164, 112 },
164 { 107, 106, 161 },
165 { 183, 213, 104 },
166 { 214, 128, 118 },
167
168 { 135, 115, 161 },
169 { 218, 217, 86 },
170 { 207, 111, 122 },
171 { 85, 168, 161 },
172 { 253, 213, 65 },
173 { 146, 98, 148 },
174 { 115, 192, 59 },
175 { 205, 81, 96 },
176
177 { 53, 180, 201 },
178 { 248, 175, 103 },
179 { 186, 97, 125 },
180 { 117, 202, 249 },
181 { 244, 131, 35 },
182 { 178, 45, 110 },
183 { 87, 229, 151 },
184 { 204, 171, 68 },
185
186 { 172, 110, 145 },
187 { 61, 132, 137 },
188 { 224, 117, 79 },
189 { 117, 84, 148 },
190 { 155, 206, 158 },
191 { 255, 133, 100 },
192 { 60, 98, 153 },
193 { 128, 197, 122 },
194 };
195 int sap_nbcolors = G_N_ELEMENTS(sap_colors);
196
197 struct rgbcol homebank_colors[] =
198 {
199 { 72, 118, 176 },
200 { 180, 198, 230 },
201 { 227, 126, 35 },
202 { 238, 186, 123 },
203 { 97, 158, 58 },
204 { 175, 222, 142 },
205 { 184, 43, 44 },
206 { 231, 151, 149 },
207 { 136, 103, 185 },
208 { 190, 174, 210 },
209 { 127, 87, 77 },
210 { 184, 155, 147 },
211 { 202, 118, 190 },
212 { 230, 181, 208 },
213 { 126, 126, 126 },
214 { 198, 198, 198 },
215 { 187, 188, 56 },
216 { 218, 218, 144 },
217 { 109, 189, 205 },
218 { 176, 217, 228 },
219
220 { 237, 212, 0 },
221 { 255, 239, 101 },
222 { 207, 93, 96 },
223 { 234, 186, 187 },
224 { 193, 124, 17 },
225 { 240, 181, 90 },
226 { 186, 189, 182 },
227 { 225, 227, 223 },
228 { 115, 210, 22 },
229 { 175, 240, 112 },
230 { 255, 140, 90 },
231 { 255, 191, 165 },
232
233 };
234 int homebank_nbcolors = G_N_ELEMENTS(homebank_colors);
235
236
237
238 struct rgbcol global_colors[] =
239 {
240 { 0, 0, 0}, // black
241 {255, 255, 255}, // white
242 {239, 239, 239}, // grey1 THTEXT 0.05
243 { 68, 68, 68}, // text THTEXT 0.78
244 { 51, 51, 51}, // xyline THTEXT 0.8
245
246
247 /* { 255, 0, 0}, // fake
248 { 255, 255, 0}, // fake
249 { 255, 0, 255}, // fake
250 { 0, 255, 0}, // fake
251 { 0, 0, 255}, // fake
252 */
253
254
255 {255, 255, 255}, // theme base (bg)
256 { 46, 52, 54}, // theme fg
257 };
258
259
260
261 /*
262 struct rgbcol global_colors[] =
263 {
264 { 0, 0, 0}, // black
265 {255, 255, 255}, // white
266 {238, 238, 238}, // #top/bottom lines
267 {204, 204, 204}, // #dotted lines
268 {102, 102, 102}, // #x-axis, scale text
269 {153, 153, 153}, // # ??
270 { 0, 119, 204}, // #line color
271
272 //new
273 {239, 239, 239}, // intermediate lines
274 { 68, 68, 68}, // text
275 { 51, 51, 51}, // x/y axis
276
277
278 };*/
279
280
281 void chart_color_global_default(void)
282 {
283 struct rgbcol *tcol;
284
285 // set base color (adwaita)
286 tcol = &global_colors[THBASE];
287 tcol->r = 255;
288 tcol->g = 255;
289 tcol->b = 255;
290
291 // set text(bg) color (adwaita)
292 tcol = &global_colors[THTEXT];
293 tcol->r = 46;
294 tcol->g = 52;
295 tcol->b = 54;
296 }
297
298
299 void cairo_user_set_rgbcol(cairo_t *cr, struct rgbcol *col)
300 {
301 cairo_set_source_rgb(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b));
302 }
303
304
305 void cairo_user_set_rgbacol(cairo_t *cr, struct rgbcol *col, double alpha)
306 {
307 cairo_set_source_rgba(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b), alpha);
308 }
309
310
311 void cairo_user_set_rgbcol_over(cairo_t *cr, struct rgbcol *col, gboolean over)
312 {
313 if( over )
314 cairo_set_source_rgb(cr, COLTOCAIROOVER(col->r), COLTOCAIROOVER(col->g), COLTOCAIROOVER(col->b));
315 else
316 cairo_set_source_rgb(cr, COLTOCAIRO(col->r), COLTOCAIRO(col->g), COLTOCAIRO(col->b));
317 }
318
319
320 void colorscheme_init(GtkColorScheme *scheme, gint index)
321 {
322
323 scheme->cs_blue = 0;
324
325 switch(index)
326 {
327 default:
328 case CHART_COLMAP_HOMEBANK:
329 scheme->colors = homebank_colors;
330 scheme->nb_cols = homebank_nbcolors;
331 scheme->cs_green = 4;
332 scheme->cs_red = 6;
333 scheme->cs_yellow = 2;
334 scheme->cs_orange = 2;
335 break;
336 case CHART_COLMAP_MSMONEY:
337 scheme->colors = money_colors;
338 scheme->nb_cols = money_nbcolors;
339 scheme->cs_blue = 17;
340 scheme->cs_green = 19;
341 scheme->cs_red = 18;
342 scheme->cs_yellow = 16;
343 scheme->cs_orange = 8;
344 break;
345 case CHART_COLMAP_QUICKEN:
346 scheme->colors = quicken_colors;
347 scheme->nb_cols = quicken_nbcolors;
348 scheme->cs_blue = 3;
349 scheme->cs_green = 2;
350 scheme->cs_red = 0;
351 scheme->cs_yellow = 1;
352 scheme->cs_orange = 9;
353 break;
354 case CHART_COLMAP_ANALYTICS:
355 scheme->colors = analytics_colors;
356 scheme->nb_cols = analytics_nbcolors;
357 scheme->cs_green = 1;
358 scheme->cs_red = 2;
359 scheme->cs_yellow = 3;
360 scheme->cs_orange = 6;
361 break;
362 case CHART_COLMAP_OFFICE2010:
363 scheme->colors = office2010_colors;
364 scheme->nb_cols = office2010_nbcolors;
365 scheme->cs_green = 2;
366 scheme->cs_red = 1;
367 scheme->cs_yellow = 5;
368 scheme->cs_orange = 5;
369 break;
370 case CHART_COLMAP_OFFICE2013:
371 scheme->colors = office2013_colors;
372 scheme->nb_cols = office2013_nbcolors;
373 scheme->cs_green = 5;
374 scheme->cs_red = 1;
375 scheme->cs_yellow = 3;
376 scheme->cs_orange = 1;
377 break;
378 case CHART_COLMAP_SAP:
379 scheme->colors = sap_colors;
380 scheme->nb_cols = sap_nbcolors;
381 scheme->cs_green = 14;
382 scheme->cs_red = 15;
383 scheme->cs_yellow = 12;
384 scheme->cs_orange = 20;
385 break;
386 }
387
388
389 }
390
This page took 0.049029 seconds and 4 git commands to generate.