1 /* HomeBank -- Free, easy, personal accounting for everyone. 2 * Copyright (C) 1995-2021 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 #ifndef __GTK_COLORS_H__ 21 #define __GTK_COLORS_H__ 22 23 #include <cairo.h> 24 25 #define MASKCOL 255 26 //#define MASKCOL 000 27 28 #define COLTO16(col8) ( (col8 | col8<<8 ) ) 29 #define COLTOOVER(col8) ( (col8 + MASKCOL) / 2 ) 30 31 #define AREA_ALPHA .33 32 #define OVER_ALPHA .15 33 #define OVER_COLOR (MASKCOL * OVER_ALPHA) 34 #define COLTOCAIRO(col8) ( (col8 / 255.0) ) 35 #define COLTOCAIROOVER(col8) ( ((col8 * (1 - OVER_ALPHA)) + OVER_COLOR ) / 255.0 ) 36 37 //typedef struct _rgbcol RgbCol; 38 typedef struct _ColorScheme GtkColorScheme; 39 40 struct rgbcol 41 { 42 guint8 r, g, b; 43 }; 44 45 46 struct _ColorScheme 47 { 48 struct rgbcol *colors; 49 gint nb_cols; 50 gint cs_red; 51 gint cs_green; 52 gint cs_blue; 53 gint cs_orange; 54 }; 55 56 57 enum { 58 BLACK, 59 WHITE, 60 GREY1, 61 TEXT, 62 XYLINES, 63 THBASE, 64 THTEXT 65 }; 66 67 enum colmap 68 { 69 CHART_COLMAP_HOMEBANK, 70 CHART_COLMAP_MSMONEY, 71 CHART_COLMAP_SAP, 72 CHART_COLMAP_QUICKEN, 73 CHART_COLMAP_OFFICE2010, 74 CHART_COLMAP_OFFICE2013, 75 CHART_COLMAP_ANALYTICS, 76 CHART_COLMAP_YNAB, 77 }; 78 79 enum { 80 CHART_FONT_SIZE_TITLE, 81 CHART_FONT_SIZE_SUBTITLE, 82 CHART_FONT_SIZE_NORMAL, 83 CHART_FONT_SIZE_SMALL 84 }; 85 86 87 extern char *chart_colors[]; 88 89 extern struct rgbcol global_colors[]; 90 extern struct rgbcol money_colors[]; 91 extern struct rgbcol quicken_colors[]; 92 extern struct rgbcol analytics_colors[]; 93 extern struct rgbcol office2010_colors[]; 94 extern struct rgbcol office2013_colors[]; 95 extern struct rgbcol sap_colors[]; 96 extern struct rgbcol homebank_colors[]; 97 extern struct rgbcol ynab_colors[]; 98 99 extern int money_nbcolors; 100 extern int quicken_nbcolors; 101 extern int analytics_nbcolors; 102 extern int office2010_nbcolors; 103 extern int office2013_nbcolors; 104 extern int sap_nbcolors; 105 extern int homebank_nbcolors; 106 extern int ynab_nbcolors; 107 108 void chart_color_global_default(void); 109 110 void cairo_user_set_rgbcol(cairo_t *cr, struct rgbcol *col); 111 void cairo_user_set_rgbacol(cairo_t *cr, struct rgbcol *col, double alpha); 112 void cairo_user_set_rgbcol_over(cairo_t *cr, struct rgbcol *col, gboolean over); 113 114 void colorscheme_init(GtkColorScheme *scheme, gint index); 115 116 #endif /* __GTK_COLORS_H__ */ 117