Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | I change the branch colour algorithm, for another one I can understand better.
No HSV magic; simply few combinations of RGB values based on hash. This
algorithm should give either different or equal colours, and not similar colours.
This way I think the hash differences are more likely to give different colours. I had the feeling that we were getting too often too similar colours for our branches, but I can't prove that mathematically. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | annotate_links |
Files: | files | file ages | folders |
SHA1: |
243d99d128f35ce35bd26177830fbe91 |
User & Date: | viriketo 2012-04-22 09:50:15.324 |
Context
2012-04-22
| ||
09:56 | Fix a comment in my previous commit. ... (check-in: 515e7fa0 user: viriketo tags: annotate_links) | |
09:50 |
I change the branch colour algorithm, for another one I can understand better.
No HSV magic; simply few combinations of RGB values based on hash. This
algorithm should give either different or equal colours, and not similar colours.
This way I think the hash differences are more likely to give different colours. I had the feeling that we were getting too often too similar colours for our branches, but I can't prove that mathematically. ... (check-in: 243d99d1 user: viriketo tags: annotate_links) | |
2012-04-05
| ||
14:31 |
Made 'fossil commit' detect if the editor changed the file. If the editor did
not change the file, ask confirmation, as if it was an empty comment.
I think svn behaves this way. ... (check-in: d2a733be user: viriketo tags: annotate_links) | |
Changes
Changes to src/timeline.c.
︙ | ︙ | |||
116 117 118 119 120 121 122 | /* ** Hash a string and use the hash to determine a background color. */ char *hash_color(const char *z){ int i; /* Loop counter */ unsigned int h = 0; /* Hash on the branch name */ int r, g, b; /* Values for red, green, and blue */ | < < | > > > > | | < < < < < | < > | | > | | | | < > | > | | | < < < | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /* ** Hash a string and use the hash to determine a background color. */ char *hash_color(const char *z){ int i; /* Loop counter */ unsigned int h = 0; /* Hash on the branch name */ int r, g, b; /* Values for red, green, and blue */ static char zColor[10]; /* The resulting color */ static int whitefg = -1; int cpc = 4; /* colours per component */ int cfactor = 128/cpc; /* Factor so n*cpc < 128 */ int cmin = cfactor - 1; /* Factor so the max component is 127 and the min is different than the bg */ if( whitefg = -1 ) whitefg = db_get_boolean("white-foreground", 0); /* Calculate the hash based on the branch name */ for( i=0; z[i]; i++ ){ h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; } /* 4 different random values per component, between 31 and 127 */ r = cmin + (h % cpc) * cfactor; h /= cpc; g = cmin + (h % cpc) * cfactor; h /= cpc; b = cmin + (h % cpc) * cfactor; h /= cpc; /* In case of blackfg, get the inverse effect */ if( !whitefg ) { r = 255 - r; g = 255 - g; b = 255 - b; } sqlite3_snprintf(8, zColor, "#%02x%02x%02x", r,g,b); return zColor; } /* ** COMMAND: test-hash-color |
︙ | ︙ |