Re: [fossil-users] Web interface timeline rail colors
Noticing the recent Fossil commit to show real branch colors in the branch list, I have been reminded of my suggestion [0] from September 2015 to change the `bg_to_fg()' function from src/timeline.c that derives the timeline rail colors from the branch colors. The modified version supports color values in shorthand hex triplet notation (#HHH), ensures no invalid colors with any of the RGB components beyond 0 and 255 are generated, and a reasonable default color (black or white depending on the "white-foreground" skin setting) is returned for all color values not in standard or shorthand hex triplet notation. [0] http://www.mail-archive.com/fossil-users%40lists.fossil-scm.org/msg21416.html The discussion ended with Rich Neswold submitting a patch to support shorthand hex triplet color values, and me cross-posting basically the same patch with the additional features mentioned above. I hope I have not been offending, and have not violated the Fossil contributor or coding style guidelines. Is there any chance that my suggestion will be considered for incorporation? Merging the `bg_to_fg()' function body from [1] into src/timeline.c should do, but I could also submit a patch in a different format if required, or a Fossil bundle (as a new "pending-review" branch) with an additional step to remove my philosophical comments and clear the implementation choices left in the code. Of course I'm willing to submit a Contributor Agreement, if necessary. [1] http://pastebin.com/Z8SwJNHZ --Florian ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Web interface timeline rail colors
On Mon, Sep 7, 2015 at 6:00 AM, Richard Hippwrote: >> On Sat, Sep 5, 2015 at 2:49 PM, Florian Balmer >> wrote: >>> I'd be happy if these small adaptations could be made. > See https://www.fossil-scm.org/fossil/artifact/005c758d3?ln=596-625 > for details. Please do feel free to enhance it. Can you try out this patch, Mr. Balmer: Index: src/timeline.c == --- src/timeline.c +++ src/timeline.c @@ -599,17 +599,23 @@ */ static const char *bg_to_fg(const char *zIn){ int i; unsigned int x[3]; unsigned int mx = 0; + unsigned int zInLen = strlen(zIn); static int whiteFg = -1; static char zRes[10]; - if( strlen(zIn)!=7 || zIn[0]!='#' ) return zIn; + if( (zInLen!=7 && zInLen!=4) || zIn[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 (zInLen==7) { + x[i] = hex_digit_value(zIn[0])*16 + hex_digit_value(zIn[1]); + zIn += 2; +} else { + x[i] = hex_digit_value(zIn[0])*17; + zIn++; +} if( x[i]>mx ) mx = x[i]; } if( whiteFg<0 ) whiteFg = skin_detail_boolean("white-foreground"); if( whiteFg ){ /* Make the color lighter */ -- Rich ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Web interface timeline rail colors
> Can you try out this patch, Mr. Balmer: Thanks, your patch works fine for hex triplet color values in shorthand notation. I have been working on a patch, too, in the meantime, which also handles shorthand forms, and in addition returns default colors for all invalid / non-hex triplet forms (white for white foreground, and black otherwise), and ensures each color component is between 0 and 255 to avoid 8-digit output (such as #8041 for #ffc000). Here's an initial version I'd like to submit for review / discussion: http://pastebin.com/Z8SwJNHZ --Florian ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Web interface timeline rail colors
On Sat, Sep 5, 2015 at 2:49 PM, Florian Balmerwrote: > I'd be happy if these small adaptations could be made. However I'm not > sure if there's a policy to require branch colors to fit the #xx > format, so that values like #feb (and also 'gold') are invalid in the > first place, and whether hash_color() may always return colors that > bg_to_fg() is able to handle without over/underflows, so that using > custom branch colors outside the "moderate hash_color() range" is > generally not advised. > If i'm not mistaken, Fossil accepts any color string which a user agent can deal with. It does handle '#xx' in placed, but i don't _think_ it strictly requires that format. e.g. 'red' should be acceptable, with the caveat that functions which derive other colors from hex codes won't work with such strings. -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Web interface timeline rail colors
On Mon, Sep 7, 2015 at 1:00 PM, Richard Hippwrote: > the subroutine that does that currently only understands #HH > colors. See > https://www.fossil-scm.org/fossil/artifact/005c758d3?ln=596-625 > for details. Please do feel free to enhance it. > Anything more than about 5 lines of code is still physically out of my reach :(. On rare days my hand allows me a half-hour of uninterrupted typing, but most days don't allow more than a few minutes of typing (or pinball) at a time. While i have returned to work, i'm not all that useful there, and intelliJ (Java IDE) does most of the typing for me. (Going on 9 months now...) :( -- - stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Web interface timeline rail colors
On 9/7/15, Stephan Bealwrote: > On Sat, Sep 5, 2015 at 2:49 PM, Florian Balmer > wrote: > >> I'd be happy if these small adaptations could be made. However I'm not >> sure if there's a policy to require branch colors to fit the #xx >> format, so that values like #feb (and also 'gold') are invalid in the >> first place, and whether hash_color() may always return colors that >> bg_to_fg() is able to handle without over/underflows, so that using >> custom branch colors outside the "moderate hash_color() range" is >> generally not advised. >> > > If i'm not mistaken, Fossil accepts any color string which a user agent can > deal with. That used to be true. And it still is true with regard to the background colors on the check-in comment text. But since we added color to rails, that has changed. Fossil has to convert the background text color into an appropriate foreground text color, and the subroutine that does that currently only understands #HH colors. See https://www.fossil-scm.org/fossil/artifact/005c758d3?ln=596-625 for details. Please do feel free to enhance it. -- D. Richard Hipp d...@sqlite.org ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users