Andy Goth: > In my test case, the outbound arrows are white, which doesn't look > so great against the default white background.
The timeline arrow color generated from background color #00aa00 was not white, but #ffffffd6, which is an invalid HTML/CSS color value, and happened to be displayed as white by your web browser. Richard Hipp: > Fixed on trunk With the fix committed as [7ac88481a6] [0], timeline arrow colors have been turned off completely, and all timeline arrows are now displayed with black color, also for skins with dark background colors, see for example "xekri" [1]. [0] http://fossil-scm.org/index.html/info/7ac88481a6 [1] http://fossil-scm.org/skins/xekri/timeline The problem is that the function to generate the timeline arrow colors from background colors can have an "unsigned integer underflow", resulting in invalid HTML/CSS color values. I have suggested a modification for this, a while ago. With the modification, the generated timeline arrow color for background color #00aa00 would be #008000, and not #ffffffd6. I really liked the timeline arrow colors, they were very helpful to more easily distinguish the course of different timeline rails. Please allow me to encourage you to have a look at my modifications, and implement something similar, to bring back the beloved timeline arrow colors. Thank you very much --Florian ===================== Patch for Fossil [4bbd5c3e] ====================== Prevent unsigned integer underflow in the code to calculate slightly darker timeline rail colors derived from branch background colors, resulting in invalid output for the HTML/Javascript timeline drawing code. Example: branch color #ff00ff results in invalid timeline rail color #80ffffff without the fix, and in #800080 with the patch applied. Index: src/timeline.c ================================================================== --- src/timeline.c +++ src/timeline.c @@ -651,11 +651,14 @@ static const unsigned int t = 215; if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx; }else{ /* Make the color darker */ static const unsigned int t = 128; - if( mx>t ) for(i=0; i<3; i++) x[i] -= mx - t; + if( mx>t ) for(i=0; i<3; i++){ + if( x[i]>=mx - t ) x[i] -= mx - t; + else x[i] = 0; + } } sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]); return zRes; } ===================== Patch for Fossil [4bbd5c3e] ====================== ===================== Patch for Fossil [4bbd5c3e] ====================== Check if branch background colors are in correct HTML/CSS hexadecimal RGB representation before calculating the derived timeline rail colors, and also allow color values in shorthand hex triplet notation #HHH. Index: src/timeline.c ================================================================== --- src/timeline.c +++ src/timeline.c @@ -631,21 +631,33 @@ /* ** Change the RGB background color given in the argument in a foreground ** color with the same hue. */ static const char *bg_to_fg(const char *zIn){ + int nIn; /* length of zIn */ int i; unsigned int x[3]; unsigned int mx = 0; static int whiteFg = -1; static char zRes[10]; - if( strlen(zIn)!=7 || zIn[0]!='#' ) return zIn; + nIn = strlen( zIn ); + if(( nIn!=7 && nIn!=4 ) || zIn[0]!='#' ) return zIn; + for(i=1; i<nIn; i++) + if( strchr("0123456789abcdefABCDEF",zIn[i])==0 ) return zIn; zIn++; - for(i=0; i<3; i++){ - x[i] = hex_digit_value(zIn[0])*16 + hex_digit_value(zIn[1]); - zIn += 2; - if( x[i]>mx ) mx = x[i]; + if( nIn==4 ){ + for(i=0; i<3; i++){ + x[i] = hex_digit_value(zIn[0])*17; + zIn++; + if( x[i]>mx ) mx = x[i]; + } + }else{ + for(i=0; i<3; i++){ + x[i] = hex_digit_value(zIn[0])*16 + hex_digit_value(zIn[1]); + zIn += 2; + if( x[i]>mx ) mx = x[i]; + } } if( whiteFg<0 ) whiteFg = skin_detail_boolean("white-foreground"); if( whiteFg ){ /* Make the color lighter */ static const unsigned int t = 215; ===================== Patch for Fossil [4bbd5c3e] ====================== ===================== Patch for Fossil [4bbd5c3e] ====================== Return default timeline rail color values #000000 (for white background) or #ffffff (for black background) for all non-hex triplet branch color values. Note that named color values (such as 'red') and color values in functional notation (such as 'rgba(255,128,64,0.8)') are not affected, as only branch colors starting with '#' are passed to bg_to_fg() to calculate derived rail colors, in the first place. So this patch only filters color values with bad hexadecimal RGB representation, such as '#12345' (invalid length) or '#z12345' (invalid hexadecimal character). Index: src/timeline.c ================================================================== --- src/timeline.c +++ src/timeline.c @@ -637,14 +637,15 @@ int i; unsigned int x[3]; unsigned int mx = 0; static int whiteFg = -1; static char zRes[10]; + if( whiteFg<0 ) whiteFg = skin_detail_boolean("white-foreground"); nIn = strlen( zIn ); - if(( nIn!=7 && nIn!=4 ) || zIn[0]!='#' ) return zIn; + if(( nIn!=7 && nIn!=4 ) || zIn[0]!='#' ) goto default_fg; for(i=1; i<nIn; i++) - if( strchr("0123456789abcdefABCDEF",zIn[i])==0 ) return zIn; + if( strchr("0123456789abcdefABCDEF",zIn[i])==0 ) goto default_fg; zIn++; if( nIn==4 ){ for(i=0; i<3; i++){ x[i] = hex_digit_value(zIn[0])*17; zIn++; @@ -655,11 +656,10 @@ x[i] = hex_digit_value(zIn[0])*16 + hex_digit_value(zIn[1]); zIn += 2; if( x[i]>mx ) mx = x[i]; } } - if( whiteFg<0 ) whiteFg = skin_detail_boolean("white-foreground"); if( whiteFg ){ /* Make the color lighter */ static const unsigned int t = 215; if( mx<t ) for(i=0; i<3; i++) x[i] += t - mx; }else{ @@ -670,10 +670,17 @@ else x[i] = 0; } } sqlite3_snprintf(sizeof(zRes),zRes,"#%02x%02x%02x",x[0],x[1],x[2]); return zRes; +default_fg: + /* By default, set to black for white background, and vice versa */ + if( whiteFg ) + memcpy(zRes,"#ffffff",8); + else + memcpy(zRes,"#000000",8); + return zRes; } /* ** Generate all of the necessary javascript to generate a timeline ** graph. ===================== Patch for Fossil [4bbd5c3e] ====================== _______________________________________________ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users