diff -u webalizer-2.01-10/graphs.c webalizerUserColor/graphs.c --- webalizer-2.01-10/graphs.c Fri Jun 15 10:34:24 2001 +++ webalizerUserColor/graphs.c Wed Nov 13 10:55:43 2002 @@ -44,12 +44,12 @@ #define PI 3.14159265358979323846 #endif -#define COLOR1 green /* graph color - hits */ -#define COLOR2 blue /* files */ -#define COLOR3 orange /* sites */ -#define COLOR4 red /* KBytes */ -#define COLOR5 cyan /* Files */ -#define COLOR6 yellow /* Visits */ +#define HITCOLOR hit_or_green /* graph color - hits */ +#define FILECOLOR file_or_blue /* files */ +#define SITECOLOR site_or_orange /* sites */ +#define KBYTECOLOR kbyte_or_red /* KBytes */ +#define PAGECOLOR page_or_cyan /* Files */ +#define VISITCOLOR visit_or_yellow /* Visits */ #define CX 156 /* center x (for pie) */ #define CY 150 /* center y (chart) */ @@ -76,8 +76,64 @@ struct pie_data { int x; int y; /* line x,y */ int mx; int my; }; /* midpoint x,y */ /* colors */ -int black, white, grey, dkgrey, red, - blue, orange, green, cyan, yellow; +int black, white, grey, dkgrey, kbyte_or_red, + file_or_blue, site_or_orange, hit_or_green, + page_or_cyan, visit_or_yellow, blue; + +/****************************************************************/ +/* */ +/* ASHEX2INT - ASCII HEXA TO INT CONVERTER [ not strtoul() ] */ +/* */ +/****************************************************************/ + +int ashex2int(char* twocharstr){ +/* returns the base-10 integer value from a 2 ascii hex number */ + int val; + switch (twocharstr[1]) + { + case 'a': + case 'A': val=10; break; + case 'b': + case 'B': val=11; break; + case 'c': + case 'C': val=12; break; + case 'd': + case 'D': val=13; break; + case 'e': + case 'E': val=14; break; + case 'f': + case 'F': val=15; break; + default: val=(int)twocharstr[1]-48; + } + switch (twocharstr[0]) + { + case 'a': + case 'A': val+=160; break; + case 'b': + case 'B': val+=176; break; + case 'c': + case 'C': val+=192; break; + case 'd': + case 'D': val+=208; break; + case 'e': + case 'E': val+=224; break; + case 'f': + case 'F': val+=240; break; + default: val+=(int)(twocharstr[0]-48)*16; + } + return val; +} + +/* shortcuts to convert ascii hex color for gdImageColorAllocate() */ + +#define getred(s) (ashex2int((s[0] == '#')?s+1:s)) +/* returns the red base-10 integer value from a html color */ + +#define getgreen(s) (ashex2int((s[0] == '#')?s+3:s+2)) +/* returns the green base-10 integer value from a html color */ + +#define getblue(s) (ashex2int((s[0] == '#')?s+5:s+4)) +/* returns the blue base-10 integer value from a html color */ /*****************************************************************/ /* */ @@ -145,31 +201,31 @@ /* Kbytes Legend */ i = (strlen(msg_h_xfer)*6); gdImageString(im,gdFontSmall,491-i,239,msg_h_xfer,dkgrey); - gdImageString(im,gdFontSmall,490-i,238,msg_h_xfer,COLOR4); + gdImageString(im,gdFontSmall,490-i,238,msg_h_xfer,KBYTECOLOR); /* Sites/Visits Legend */ i = (strlen(msg_h_visits)*6); j = (strlen(msg_h_sites)*6); gdImageString(im,gdFontSmall,491-i-j-12,11,msg_h_visits,dkgrey); - gdImageString(im,gdFontSmall,490-i-j-12,10,msg_h_visits,COLOR6); + gdImageString(im,gdFontSmall,490-i-j-12,10,msg_h_visits,VISITCOLOR); gdImageString(im,gdFontSmall,491-j-9,11,"/",dkgrey); gdImageString(im,gdFontSmall,490-j-9,10,"/",black); gdImageString(im,gdFontSmall,491-j,11,msg_h_sites,dkgrey); - gdImageString(im,gdFontSmall,490-j,10,msg_h_sites,COLOR3); + gdImageString(im,gdFontSmall,490-j,10,msg_h_sites,SITECOLOR); /* Hits/Files/Pages Legend */ i = (strlen(msg_h_pages)*6); j = (strlen(msg_h_files)*6); gdImageStringUp(im,gdFontSmall,8,231,msg_h_pages,dkgrey); - gdImageStringUp(im,gdFontSmall,7,230,msg_h_pages,COLOR5); + gdImageStringUp(im,gdFontSmall,7,230,msg_h_pages,PAGECOLOR); gdImageStringUp(im,gdFontSmall,8,231-i-3,"/",dkgrey); gdImageStringUp(im,gdFontSmall,7,230-i-3,"/",black); gdImageStringUp(im,gdFontSmall,8,231-i-12,msg_h_files,dkgrey); - gdImageStringUp(im,gdFontSmall,7,230-i-12,msg_h_files,COLOR2); + gdImageStringUp(im,gdFontSmall,7,230-i-12,msg_h_files,FILECOLOR); gdImageStringUp(im,gdFontSmall,8,231-i-j-15,"/",dkgrey); gdImageStringUp(im,gdFontSmall,7,230-i-j-15,"/",black); gdImageStringUp(im,gdFontSmall,8,231-i-j-24,msg_h_hits,dkgrey); - gdImageStringUp(im,gdFontSmall,7,230-i-j-24,msg_h_hits,COLOR1); + gdImageStringUp(im,gdFontSmall,7,230-i-j-24,msg_h_hits,HITCOLOR); } /* data1 */ @@ -182,7 +238,7 @@ x1 = 26 + (i*23); x2 = x1 + 13; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR1); + gdImageFilledRectangle(im, x1, y1, x2, 232, HITCOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -196,7 +252,7 @@ x1 = 29 + (i*23); x2 = x1 + 13; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR2); + gdImageFilledRectangle(im, x1, y1, x2, 232, FILECOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -210,7 +266,7 @@ x1 = 32 + (i*23); x2 = x1 + 13; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR5); + gdImageFilledRectangle(im, x1, y1, x2, 232, PAGECOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -235,7 +291,7 @@ x1 = 310 + (i*15); x2 = x1 + 8; y1 = 127 - (percent * 98); - gdImageFilledRectangle(im, x1, y1, x2, 127, COLOR6); + gdImageFilledRectangle(im, x1, y1, x2, 127, VISITCOLOR); gdImageRectangle(im, x1, y1, x2, 127, black); } @@ -249,7 +305,7 @@ x1 = 314 + (i*15); x2 = x1 + 7; y1 = 127 - (percent * 98); - gdImageFilledRectangle(im, x1, y1, x2, 127, COLOR3); + gdImageFilledRectangle(im, x1, y1, x2, 127, SITECOLOR); gdImageRectangle(im, x1, y1, x2, 127, black); } @@ -271,7 +327,7 @@ x1 = 311 + (i*15); x2 = x1 + 9; y1 = 232 - (percent * 98); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR4); + gdImageFilledRectangle(im, x1, y1, x2, 232, KBYTECOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -340,7 +396,7 @@ for (i=0;i<31;i++) { if ((julday % 7 == 6) || (julday % 7 == 0)) - gdImageString(im,gdFontSmall,25+(i*15),382,numchar[i+1],COLOR1); + gdImageString(im,gdFontSmall,25+(i*15),382,numchar[i+1],HITCOLOR); else gdImageString(im,gdFontSmall,25+(i*15),382,numchar[i+1],black); julday++; @@ -362,31 +418,31 @@ { /* Kbytes Legend */ gdImageStringUp(im,gdFontSmall,494,376,msg_h_xfer,dkgrey); - gdImageStringUp(im,gdFontSmall,493,375,msg_h_xfer,COLOR4); + gdImageStringUp(im,gdFontSmall,493,375,msg_h_xfer,KBYTECOLOR); /* Sites/Visits Legend */ i = (strlen(msg_h_sites)*6); gdImageStringUp(im,gdFontSmall,494,276,msg_h_sites,dkgrey); - gdImageStringUp(im,gdFontSmall,493,275,msg_h_sites,COLOR3); + gdImageStringUp(im,gdFontSmall,493,275,msg_h_sites,SITECOLOR); gdImageStringUp(im,gdFontSmall,494,276-i-3,"/",dkgrey); gdImageStringUp(im,gdFontSmall,493,275-i-3,"/",black); gdImageStringUp(im,gdFontSmall,494,276-i-12,msg_h_visits,dkgrey); - gdImageStringUp(im,gdFontSmall,493,275-i-12,msg_h_visits,COLOR6); + gdImageStringUp(im,gdFontSmall,493,275-i-12,msg_h_visits,VISITCOLOR); /* Pages/Files/Hits Legend */ s = ( i=(strlen(msg_h_pages)*6) )+ ( j=(strlen(msg_h_files)*6) )+ ( strlen(msg_h_hits)*6 )+ 52; gdImageStringUp(im,gdFontSmall,494,s,msg_h_pages,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-1,msg_h_pages,COLOR5); + gdImageStringUp(im,gdFontSmall,493,s-1,msg_h_pages,PAGECOLOR); gdImageStringUp(im,gdFontSmall,494,s-i-3,"/",dkgrey); gdImageStringUp(im,gdFontSmall,493,s-i-4,"/",black); gdImageStringUp(im,gdFontSmall,494,s-i-12,msg_h_files,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-i-13,msg_h_files,COLOR2); + gdImageStringUp(im,gdFontSmall,493,s-i-13,msg_h_files,FILECOLOR); gdImageStringUp(im,gdFontSmall,494,s-i-j-15,"/",dkgrey); gdImageStringUp(im,gdFontSmall,493,s-i-j-16,"/",black); gdImageStringUp(im,gdFontSmall,494,s-i-j-24,msg_h_hits,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-i-j-25,msg_h_hits,COLOR1); + gdImageStringUp(im,gdFontSmall,493,s-i-j-25,msg_h_hits,HITCOLOR); } /* data1 */ @@ -397,7 +453,7 @@ x1 = 25 + (i*15); x2 = x1 + 7; y1 = 176 - (percent * 147); - gdImageFilledRectangle(im, x1, y1, x2, 176, COLOR1); + gdImageFilledRectangle(im, x1, y1, x2, 176, HITCOLOR); gdImageRectangle(im, x1, y1, x2, 176, black); } @@ -409,7 +465,7 @@ x1 = 27 + (i*15); x2 = x1 + 7; y1 = 176 - (percent * 147); - gdImageFilledRectangle(im, x1, y1, x2, 176, COLOR2); + gdImageFilledRectangle(im, x1, y1, x2, 176, FILECOLOR); gdImageRectangle(im, x1, y1, x2, 176, black); } @@ -422,7 +478,7 @@ x1 = 29 + (i*15); x2 = x1 + 7; y1 = 176 - (percent * 147); - gdImageFilledRectangle(im, x1, y1, x2, 176, COLOR5); + gdImageFilledRectangle(im, x1, y1, x2, 176, PAGECOLOR); gdImageRectangle(im, x1, y1, x2, 176, black); } @@ -446,7 +502,7 @@ x1 = 25 + (i*15); x2 = x1 + 8; y1 = 276 - (percent * 92); - gdImageFilledRectangle(im, x1, y1, x2, 276, COLOR6); + gdImageFilledRectangle(im, x1, y1, x2, 276, VISITCOLOR); gdImageRectangle(im, x1, y1, x2, 276, black); } @@ -458,7 +514,7 @@ x1 = 29 + (i*15); x2 = x1 + 7; y1 = 276 - (percent * 92); - gdImageFilledRectangle(im, x1, y1, x2, 276, COLOR3); + gdImageFilledRectangle(im, x1, y1, x2, 276, SITECOLOR); gdImageRectangle(im, x1, y1, x2, 276, black); } @@ -478,7 +534,7 @@ x1 = 26 + (i*15); x2 = x1 + 10; y1 = 375 - ( percent * 91 ); - gdImageFilledRectangle(im, x1, y1, x2, 375, COLOR4); + gdImageFilledRectangle(im, x1, y1, x2, 375, KBYTECOLOR); gdImageRectangle(im, x1, y1, x2, 375, black); } @@ -542,15 +598,15 @@ ( j=(strlen(msg_h_files)*6) )+ ( strlen(msg_h_hits)*6 )+ 52; gdImageStringUp(im,gdFontSmall,494,s,msg_h_pages,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-1,msg_h_pages,COLOR5); + gdImageStringUp(im,gdFontSmall,493,s-1,msg_h_pages,PAGECOLOR); gdImageStringUp(im,gdFontSmall,494,s-i-3,"/",dkgrey); gdImageStringUp(im,gdFontSmall,493,s-i-4,"/",black); gdImageStringUp(im,gdFontSmall,494,s-i-12,msg_h_files,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-i-13,msg_h_files,COLOR2); + gdImageStringUp(im,gdFontSmall,493,s-i-13,msg_h_files,FILECOLOR); gdImageStringUp(im,gdFontSmall,494,s-i-j-15,"/",dkgrey); gdImageStringUp(im,gdFontSmall,493,s-i-j-16,"/",black); gdImageStringUp(im,gdFontSmall,494,s-i-j-24,msg_h_hits,dkgrey); - gdImageStringUp(im,gdFontSmall,493,s-i-j-25,msg_h_hits,COLOR1); + gdImageStringUp(im,gdFontSmall,493,s-i-j-25,msg_h_hits,HITCOLOR); } /* data1 */ @@ -561,7 +617,7 @@ x1 = 29 + (i*19); x2 = x1 + 10; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR1); + gdImageFilledRectangle(im, x1, y1, x2, 232, HITCOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -573,7 +629,7 @@ x1 = 32 + (i*19); x2 = x1 + 10; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR2); + gdImageFilledRectangle(im, x1, y1, x2, 232, FILECOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -585,7 +641,7 @@ x1 = 35 + (i*19); x2 = x1 + 10; y1 = 232 - (percent * 203); - gdImageFilledRectangle(im, x1, y1, x2, 232, COLOR5); + gdImageFilledRectangle(im, x1, y1, x2, 232, PAGECOLOR); gdImageRectangle(im, x1, y1, x2, 232, black); } @@ -612,17 +668,22 @@ { int i,x,percent,y=47; double s_arc=0.0; - int purple, ltpurple, ltgreen, brown; + int purple_or_pie1, ltpurple_or_pie2, ltgreen_or_pie3, brown_or_pie4; + int r, g, b; char buffer[128]; struct pie_data gdata; /* init graph and colors */ init_graph(title,512,300); - purple = gdImageColorAllocate(im, 128, 0, 128); - ltgreen = gdImageColorAllocate(im, 128, 255, 192); - ltpurple= gdImageColorAllocate(im, 255, 0, 255); - brown = gdImageColorAllocate(im, 255, 196, 128); + r=getred(pie_color1); g=getgreen(pie_color1); b=getblue(pie_color1); + purple_or_pie1 = gdImageColorAllocate(im, r, g, b); + r=getred(pie_color2); g=getgreen(pie_color2); b=getblue(pie_color2); + ltpurple_or_pie2= gdImageColorAllocate(im, r, g, b); + r=getred(pie_color3); g=getgreen(pie_color3); b=getblue(pie_color3); + ltgreen_or_pie3 = gdImageColorAllocate(im, r, g, b); + r=getred(pie_color4); g=getgreen(pie_color4); b=getblue(pie_color4); + brown_or_pie4 = gdImageColorAllocate(im, r, g, b); /* do the circle... */ gdImageArc(im, CX, CY, XRAD, YRAD, 0, 360, black); @@ -715,7 +776,7 @@ void init_graph(char *title, int xsize, int ysize) { - int i; + int i, r, g, b; im = gdImageCreate(xsize,ysize); @@ -724,12 +785,18 @@ dkgrey = gdImageColorAllocate(im, 128, 128, 128); black = gdImageColorAllocate(im, 0, 0, 0); white = gdImageColorAllocate(im, 255, 255, 255); - green = gdImageColorAllocate(im, 0, 128, 92); - orange = gdImageColorAllocate(im, 255, 128, 0); - blue = gdImageColorAllocate(im, 0, 0, 255); - red = gdImageColorAllocate(im, 255, 0, 0); - cyan = gdImageColorAllocate(im, 0, 192, 255); - yellow = gdImageColorAllocate(im, 255, 255, 0); + r=getred(hit_color); g=getgreen(hit_color); b=getblue(hit_color); + hit_or_green = gdImageColorAllocate(im, r, g, b); + r=getred(site_color); g=getgreen(site_color); b=getblue(site_color); + site_or_orange = gdImageColorAllocate(im, r, g, b); + r=getred(file_color); g=getgreen(file_color); b=getblue(file_color); + file_or_blue = gdImageColorAllocate(im, r, g, b); + r=getred(kbyte_color); g=getgreen(kbyte_color); b=getblue(kbyte_color); + kbyte_or_red = gdImageColorAllocate(im, r, g, b); + r=getred(page_color); g=getgreen(page_color); b=getblue(page_color); + page_or_cyan = gdImageColorAllocate(im, r, g, b); + r=getred(visit_color); g=getgreen(visit_color); b=getblue(visit_color); + visit_or_yellow = gdImageColorAllocate(im, r, g, b); /* make borders */ @@ -746,6 +813,7 @@ gdImageRectangle(im, 0, 0, xsize-1, ysize-1, black); /* display the graph title */ + blue=file_or_blue; /* currently bound to blue or file color */ gdImageString(im, gdFontMediumBold, 20, 8, title, blue); return; Common subdirectories: webalizer-2.01-10/lang and webalizerUserColor/lang diff -u webalizer-2.01-10/output.c webalizerUserColor/output.c --- webalizer-2.01-10/output.c Fri Jun 15 10:34:24 2001 +++ webalizerUserColor/output.c Tue Nov 12 17:05:21 2002 @@ -129,6 +129,14 @@ #define CYAN "#00E0FF" #define GRPCOLOR "#D0D0E0" +/* configurable html colors */ +#define HITCOLOR hit_color +#define FILECOLOR file_color +#define SITECOLOR site_color +#define KBYTECOLOR kbyte_color +#define PAGECOLOR page_color +#define VISITCOLOR visit_color + /* sort arrays */ UNODEPTR *u_array = NULL; /* Sort array for URL's */ HNODEPTR *h_array = NULL; /* hostnames (sites) */ @@ -196,7 +204,7 @@ if (lptr==NULL) fprintf(out_fp,"\n", - LTGREY, BLACK, BLUE, RED); + LTGREY, BLACK, BLUE, KBYTECOLOR); else { while (lptr!=NULL) @@ -675,13 +683,13 @@ "%s\n" \ "" \ "%s\n", - GREY, msg_h_day, - DKGREEN, msg_h_hits, - LTBLUE, msg_h_files, - CYAN, msg_h_pages, - YELLOW, msg_h_visits, - ORANGE, msg_h_sites, - RED, msg_h_xfer); + GREY, msg_h_day, + HITCOLOR, msg_h_hits, + FILECOLOR, msg_h_files, + PAGECOLOR, msg_h_pages, + VISITCOLOR, msg_h_visits, + SITECOLOR, msg_h_sites, + KBYTECOLOR, msg_h_xfer); fprintf(out_fp,"\n"); /* skip beginning blank days in a month */ @@ -751,31 +759,31 @@ "%s\n" \ "" \ "%s\n", - GREY, msg_h_hour, - DKGREEN, msg_h_hits, - LTBLUE, msg_h_files, - CYAN, msg_h_pages, - RED, msg_h_xfer); + GREY, msg_h_hour, + HITCOLOR, msg_h_hits, + FILECOLOR, msg_h_files, + PAGECOLOR, msg_h_pages, + KBYTECOLOR, msg_h_xfer); fprintf(out_fp,"" \ "%s\n" \ "" \ "%s\n", - DKGREEN, msg_h_avg, DKGREEN, msg_h_total); + HITCOLOR, msg_h_avg, HITCOLOR, msg_h_total); fprintf(out_fp,"" \ "%s\n" \ "" \ "%s\n", - LTBLUE, msg_h_avg, LTBLUE, msg_h_total); + FILECOLOR, msg_h_avg, FILECOLOR, msg_h_total); fprintf(out_fp,"" \ "%s\n" \ "" \ "%s\n", - CYAN, msg_h_avg, CYAN, msg_h_total); + PAGECOLOR, msg_h_avg, PAGECOLOR, msg_h_total); fprintf(out_fp,"" \ "%s\n" \ "" \ "%s\n", - RED, msg_h_avg, RED, msg_h_total); + KBYTECOLOR, msg_h_avg, KBYTECOLOR, msg_h_total); fprintf(out_fp,"\n"); for (i=0;i<24;i++) @@ -856,15 +864,15 @@ fprintf(out_fp,"" \ "#\n",GREY); fprintf(out_fp,"" \ - "%s\n",DKGREEN,msg_h_hits); + "%s\n",HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ - "%s\n",LTBLUE,msg_h_files); + "%s\n",FILECOLOR,msg_h_files); fprintf(out_fp,"" \ - "%s\n",RED,msg_h_xfer); + "%s\n",KBYTECOLOR,msg_h_xfer); fprintf(out_fp,"" \ - "%s\n",YELLOW,msg_h_visits); + "%s\n",VISITCOLOR,msg_h_visits); fprintf(out_fp,"" \ - "%s\n",CYAN,msg_h_hname); + "%s\n",PAGECOLOR,msg_h_hname); fprintf(out_fp,"\n"); pointer=h_array; i=0; @@ -1042,13 +1050,13 @@ "#\n",GREY); fprintf(out_fp,"" \ "%s\n", - DKGREEN,msg_h_hits); + HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ "%s\n", - RED,msg_h_xfer); + KBYTECOLOR,msg_h_xfer); fprintf(out_fp,"" \ "%s\n", - CYAN,msg_h_url); + PAGECOLOR,msg_h_url); fprintf(out_fp,"\n"); pointer=u_array; i=0; @@ -1247,13 +1255,13 @@ GREY); fprintf(out_fp,"" \ "%s\n", - DKGREEN,msg_h_hits); + HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ "%s\n", - YELLOW,msg_h_visits); + VISITCOLOR,msg_h_visits); fprintf(out_fp,"" \ "%s\n", - CYAN,msg_h_url); + PAGECOLOR,msg_h_url); fprintf(out_fp,"\n"); pointer=u_array; i=0; @@ -1342,10 +1350,10 @@ GREY); fprintf(out_fp,"" \ "%s\n", - DKGREEN,msg_h_hits); + HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ "%s\n", - CYAN,msg_h_ref); + PAGECOLOR,msg_h_ref); fprintf(out_fp,"\n"); pointer=r_array; i=0; @@ -1504,10 +1512,10 @@ GREY); fprintf(out_fp,"" \ "%s\n", - DKGREEN,msg_h_hits); + HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ "%s\n", - CYAN,msg_h_agent); + PAGECOLOR,msg_h_agent); fprintf(out_fp,"\n"); pointer=a_array; i=0; @@ -1649,10 +1657,10 @@ GREY); fprintf(out_fp,"" \ "%s\n", - DKGREEN,msg_h_hits); + HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ "%s\n", - CYAN,msg_h_search); + PAGECOLOR,msg_h_search); fprintf(out_fp,"\n"); pointer=s_array; i=0; @@ -1766,15 +1774,15 @@ fprintf(out_fp,"" \ "#\n",GREY); fprintf(out_fp,"" \ - "%s\n",DKGREEN,msg_h_hits); + "%s\n",HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ - "%s\n",LTBLUE,msg_h_files); + "%s\n",FILECOLOR,msg_h_files); fprintf(out_fp,"" \ - "%s\n",RED,msg_h_xfer); + "%s\n",KBYTECOLOR,msg_h_xfer); fprintf(out_fp,"" \ - "%s\n",YELLOW,msg_h_visits); + "%s\n",VISITCOLOR,msg_h_visits); fprintf(out_fp,"" \ - "%s\n",CYAN,msg_h_uname); + "%s\n",PAGECOLOR,msg_h_uname); fprintf(out_fp,"\n"); pointer=i_array; i=0; @@ -2019,13 +2027,13 @@ fprintf(out_fp,"" \ "#\n",GREY); fprintf(out_fp,"" \ - "%s\n",DKGREEN,msg_h_hits); + "%s\n",HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ - "%s\n",LTBLUE,msg_h_files); + "%s\n",FILECOLOR,msg_h_files); fprintf(out_fp,"" \ - "%s\n",RED,msg_h_xfer); + "%s\n",KBYTECOLOR,msg_h_xfer); fprintf(out_fp,"" \ - "%s\n",CYAN,msg_h_ctry); + "%s\n",PAGECOLOR,msg_h_ctry); fprintf(out_fp,"\n"); for (i=0;i" \ "%s\n",GREY,msg_main_mt); fprintf(out_fp,"" \ - "%s\n",DKGREEN,msg_h_hits); + "%s\n",HITCOLOR,msg_h_hits); fprintf(out_fp,"" \ - "%s\n",LTBLUE,msg_h_files); + "%s\n",FILECOLOR,msg_h_files); fprintf(out_fp,"" \ - "%s\n",CYAN,msg_h_pages); + "%s\n",PAGECOLOR,msg_h_pages); fprintf(out_fp,"" \ - "%s\n",YELLOW,msg_h_visits); + "%s\n",VISITCOLOR,msg_h_visits); fprintf(out_fp,"" \ - "%s\n",ORANGE,msg_h_sites); + "%s\n",SITECOLOR,msg_h_sites); fprintf(out_fp,"" \ - "%s\n",RED,msg_h_xfer); + "%s\n",KBYTECOLOR,msg_h_xfer); fprintf(out_fp,"" \ - "%s\n",YELLOW,msg_h_visits); + "%s\n",VISITCOLOR,msg_h_visits); fprintf(out_fp,"" \ - "%s\n",CYAN,msg_h_pages); + "%s\n",PAGECOLOR,msg_h_pages); fprintf(out_fp,"" \ - "%s\n",LTBLUE,msg_h_files); + "%s\n",FILECOLOR,msg_h_files); fprintf(out_fp,"" \ - "%s\n",DKGREEN,msg_h_hits); + "%s\n",HITCOLOR,msg_h_hits); fprintf(out_fp,"\n"); for (i=0;i<12;i++) { diff -u webalizer-2.01-10/sample.conf webalizerUserColor/sample.conf --- webalizer-2.01-10/sample.conf Fri Sep 29 05:51:42 2000 +++ webalizerUserColor/sample.conf Tue Nov 12 16:39:32 2002 @@ -568,4 +568,20 @@ #DumpUsers no #DumpSearchStr no +# The custom bar graph Colors are defined here. Declare them +# in the standard hexadecimal way (as HTML, without the '#') +# If none are given, you will get the standard webalizer colors. + +#ColorHit 00805c +#ColorFile 0000ff +#ColorSite ff8000 +#ColorKbyte ff0000 +#ColorPage 00c0ff +#ColorVisit ffff00 + +#PieColor1 800080 +#PieColor2 80ffc0 +#PieColor3 ff00ff +#PieColor4 ffc480 + # End of configuration file... Have a nice day! diff -u webalizer-2.01-10/webalizer.1 webalizerUserColor/webalizer.1 --- webalizer-2.01-10/webalizer.1 Tue Oct 23 08:05:50 2001 +++ webalizerUserColor/webalizer.1 Tue Nov 12 19:14:24 2002 @@ -669,6 +669,36 @@ Dump the search string data to a tab delimited file. This data is only available if processing a web log that contains referrer information and had search string information present. +.TP 8 +.B ColorHit \fP( rrggbb | \fB00805c\fP ) +Sets the graph's hit-color to the specified html color (no '#'). +.TP 8 +.B ColorFile \fP( rrggbb | \fB0000ff\fP ) +Sets the graph's file-color to the specified html color (no '#'). +.TP 8 +.B ColorSite \fP( rrggbb | \fBff8000\fP ) +Sets the graph's site-color to the specified html color (no '#'). +.TP 8 +.B ColorKbyte \fP( rrggbb | \fBff0000\fP ) +Sets the graph's kilobyte-color to the specified html color (no '#'). +.TP 8 +.B ColorPage \fP( rrggbb | \fB00c0ff\fP ) +Sets the graph's page-color to the specified html color (no '#'). +.TP 8 +.B ColorVisit \fP( rrggbb | \fBffff00\fP ) +Sets the graph's visit-color to the specified html color (no '#'). +.TP 8 +.B PieColor1 \fP( rrggbb | \fB800080\fP ) +Sets the pie's first optional color to the specified html color (no '#'). +.TP 8 +.B PieColor2 \fP( rrggbb | \fB80ffc0\fP ) +Sets the pie's second optional color to the specified html color (no '#'). +.TP 8 +.B PieColor3 \fP( rrggbb | \fBff00ff\fP ) +Sets the pie's third optinal color to the specified html color (no '#'). +.TP 8 +.B PieColor4 \fP( rrggbb | \fBffc480\fP ) +Sets the pie's fourth optional color to the specified html color (no '#'). .SH FILES .TP 20 .I webalizer.conf diff -u webalizer-2.01-10/webalizer.c webalizerUserColor/webalizer.c --- webalizer-2.01-10/webalizer.c Wed Apr 17 00:11:31 2002 +++ webalizerUserColor/webalizer.c Tue Nov 12 19:25:40 2002 @@ -224,6 +224,17 @@ char *f_cp=f_buf+GZ_BUFSIZE; /* pointer into the buffer */ int f_end; /* count to end of buffer */ +char hit_color[] = "#00805c"; /* graph hit color */ +char file_color[] = "#0000ff"; /* graph file color */ +char site_color[] = "#ff8000"; /* graph site color */ +char kbyte_color[] = "#ff0000"; /* graph kbyte color */ +char page_color[] = "#00c0ff"; /* graph page color */ +char visit_color[] = "#ffff00"; /* graph visit color */ +char pie_color1[] = "#800080"; /* pie additionnal color 1 */ +char pie_color2[] = "#80ffc0"; /* pie additionnal color 2 */ +char pie_color3[] = "#ff00ff"; /* pie additionnal color 3 */ +char pie_color4[] = "#ffc480"; /* pie additionnal color 4 */ + /*********************************************/ /* MAIN - start here */ /*********************************************/ @@ -1449,7 +1460,17 @@ "DNSCache", /* DNS Cache file name 84 */ "DNSChildren", /* DNS Children (0=no DNS) 85 */ "DailyGraph", /* Daily Graph (0=no) 86 */ - "DailyStats" /* Daily Stats (0=no) 87 */ + "DailyStats", /* Daily Stats (0=no) 87 */ + "ColorHit", /* Hit Color (def=00805c) 88 */ + "ColorFile", /* File Color (def=0000ff) 89 */ + "ColorSite", /* Site Color (def=ff8000) 90 */ + "ColorKbyte", /* Kbyte Color (def=ff0000) 91 */ + "ColorPage", /* Page Color (def=00c0ff) 92 */ + "ColorVisit", /* Visit Color (def=ffff00) 93 */ + "PieColor1", /* Pie Color 1 (def=800080) 94 */ + "PieColor2", /* Pie Color 2 (def=80ffc0) 95 */ + "PieColor3", /* Pie Color 3 (def=ff00ff) 96 */ + "PieColor4" /* Pie Color 4 (def=ffc480) 97 */ }; FILE *fp; @@ -1593,10 +1614,21 @@ #endif /* USE_DNS */ case 86: daily_graph=(value[0]=='n')?0:1; break; /* HourlyGraph */ case 87: daily_stats=(value[0]=='n')?0:1; break; /* HourlyStats */ + case 88: strncpy(hit_color+1,value,6);break; + case 89: strncpy(file_color+1,value,6);break; + case 90: strncpy(site_color+1,value,6);break; + case 91: strncpy(kbyte_color+1,value,6);break; + case 92: strncpy(page_color+1,value,6);break; + case 93: strncpy(visit_color+1,value,6);break; + case 94: strncpy(pie_color1 +1,value,6);break; + case 95: strncpy(pie_color2 +1,value,6);break; + case 96: strncpy(pie_color3 +1,value,6);break; + case 97: strncpy(pie_color4 +1,value,6);break; } } fclose(fp); } + /*********************************************/ /* SAVE_OPT - save option from config file */ diff -u webalizer-2.01-10/webalizer.h webalizerUserColor/webalizer.h --- webalizer-2.01-10/webalizer.h Sat Feb 10 01:58:18 2001 +++ webalizerUserColor/webalizer.h Tue Nov 12 19:24:22 2002 @@ -252,6 +252,17 @@ extern CLISTPTR *top_ctrys; /* Top countries table */ +extern char hit_color[]; /* graph hit color */ +extern char file_color[]; /* graph file color */ +extern char site_color[]; /* graph site color */ +extern char kbyte_color[]; /* graph kbyte color */ +extern char page_color[]; /* graph page color */ +extern char visit_color[]; /* graph visit color */ +extern char pie_color1[]; /* pie additionnal color 1 */ +extern char pie_color2[]; /* pie additionnal color 2 */ +extern char pie_color3[]; /* pie additionnal color 3 */ +extern char pie_color4[]; /* pie additionnal color 4 */ + /* define our externally visable functions */ extern char *cur_time();