Fossil SCM
Add the color-hash-seed setting.
Commit
8996fe0d6fef22ae876cfc08bf382e269f94d7f7f8df237b2dc9cdda13f7f2b8
Parent
36a17f36b563c63…
1 file changed
+8
-1
+8
-1
| --- src/timeline.c | ||
| +++ src/timeline.c | ||
| @@ -125,29 +125,36 @@ | ||
| 125 | 125 | /* |
| 126 | 126 | ** Hash a string and use the hash to determine a background color. |
| 127 | 127 | ** |
| 128 | 128 | ** This value returned is in static space and is overwritten with |
| 129 | 129 | ** each subsequent call. |
| 130 | +** | |
| 131 | +** SETTING: color-hash-seed width=16 default=0 | |
| 132 | +** | |
| 133 | +** This is a seed value used for the hash that determines automatically | |
| 134 | +** selected colors for branches and users. | |
| 130 | 135 | */ |
| 131 | 136 | char *hash_color(const char *z){ |
| 132 | 137 | int i; /* Loop counter */ |
| 133 | 138 | unsigned int h = 0; /* Hash on the branch name */ |
| 134 | 139 | int r, g, b; /* Values for red, green, and blue */ |
| 135 | 140 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 136 | 141 | int mx, mn; /* Components of HSV */ |
| 137 | 142 | static char zColor[10]; /* The resulting color */ |
| 138 | - static int ix[2] = {0,0}; /* Color chooser parameters */ | |
| 143 | + static int ix[3] = {0,0,0}; /* Color chooser parameters */ | |
| 139 | 144 | |
| 140 | 145 | if( ix[0]==0 ){ |
| 141 | 146 | if( skin_detail_boolean("white-foreground") ){ |
| 142 | 147 | ix[0] = 0x50; |
| 143 | 148 | ix[1] = 0x20; |
| 144 | 149 | }else{ |
| 145 | 150 | ix[0] = 0xf8; |
| 146 | 151 | ix[1] = 0x20; |
| 147 | 152 | } |
| 153 | + ix[2] = db_get_int("color-hash-seed",0); | |
| 148 | 154 | } |
| 155 | + h = ix[2]; | |
| 149 | 156 | for(i=0; z[i]; i++ ){ |
| 150 | 157 | h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; |
| 151 | 158 | } |
| 152 | 159 | h1 = h % 6; h /= 6; |
| 153 | 160 | h3 = h % 10; h /= 10; |
| 154 | 161 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -125,29 +125,36 @@ | |
| 125 | /* |
| 126 | ** Hash a string and use the hash to determine a background color. |
| 127 | ** |
| 128 | ** This value returned is in static space and is overwritten with |
| 129 | ** each subsequent call. |
| 130 | */ |
| 131 | char *hash_color(const char *z){ |
| 132 | int i; /* Loop counter */ |
| 133 | unsigned int h = 0; /* Hash on the branch name */ |
| 134 | int r, g, b; /* Values for red, green, and blue */ |
| 135 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 136 | int mx, mn; /* Components of HSV */ |
| 137 | static char zColor[10]; /* The resulting color */ |
| 138 | static int ix[2] = {0,0}; /* Color chooser parameters */ |
| 139 | |
| 140 | if( ix[0]==0 ){ |
| 141 | if( skin_detail_boolean("white-foreground") ){ |
| 142 | ix[0] = 0x50; |
| 143 | ix[1] = 0x20; |
| 144 | }else{ |
| 145 | ix[0] = 0xf8; |
| 146 | ix[1] = 0x20; |
| 147 | } |
| 148 | } |
| 149 | for(i=0; z[i]; i++ ){ |
| 150 | h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; |
| 151 | } |
| 152 | h1 = h % 6; h /= 6; |
| 153 | h3 = h % 10; h /= 10; |
| 154 |
| --- src/timeline.c | |
| +++ src/timeline.c | |
| @@ -125,29 +125,36 @@ | |
| 125 | /* |
| 126 | ** Hash a string and use the hash to determine a background color. |
| 127 | ** |
| 128 | ** This value returned is in static space and is overwritten with |
| 129 | ** each subsequent call. |
| 130 | ** |
| 131 | ** SETTING: color-hash-seed width=16 default=0 |
| 132 | ** |
| 133 | ** This is a seed value used for the hash that determines automatically |
| 134 | ** selected colors for branches and users. |
| 135 | */ |
| 136 | char *hash_color(const char *z){ |
| 137 | int i; /* Loop counter */ |
| 138 | unsigned int h = 0; /* Hash on the branch name */ |
| 139 | int r, g, b; /* Values for red, green, and blue */ |
| 140 | int h1, h2, h3, h4; /* Elements of the hash value */ |
| 141 | int mx, mn; /* Components of HSV */ |
| 142 | static char zColor[10]; /* The resulting color */ |
| 143 | static int ix[3] = {0,0,0}; /* Color chooser parameters */ |
| 144 | |
| 145 | if( ix[0]==0 ){ |
| 146 | if( skin_detail_boolean("white-foreground") ){ |
| 147 | ix[0] = 0x50; |
| 148 | ix[1] = 0x20; |
| 149 | }else{ |
| 150 | ix[0] = 0xf8; |
| 151 | ix[1] = 0x20; |
| 152 | } |
| 153 | ix[2] = db_get_int("color-hash-seed",0); |
| 154 | } |
| 155 | h = ix[2]; |
| 156 | for(i=0; z[i]; i++ ){ |
| 157 | h = (h<<11) ^ (h<<1) ^ (h>>3) ^ z[i]; |
| 158 | } |
| 159 | h1 = h % 6; h /= 6; |
| 160 | h3 = h % 10; h /= 10; |
| 161 |