Fossil SCM

Add the "raw-bgcolor" setting, defaulting to "off" but if turned "on" disables the background color filter.

drh 2025-03-26 10:22 trunk
Commit f23d9ab878f2c4b66a003216f8291df97fbe2e238f471ae92a1725caa1e8efb8
1 file changed +19 -4
+19 -4
--- src/color.c
+++ src/color.c
@@ -213,10 +213,20 @@
213213
}
214214
return -1;
215215
}
216216
}
217217
218
+/*
219
+** SETTING: raw-bgcolor boolean default=off
220
+**
221
+** Fossil usually tries to adjust user-specified background colors
222
+** for checkins so that the text is readable and so that the color
223
+** is not too garish. This setting disables that filter. When
224
+** this setting is on, the user-selected background colors are shown
225
+** exactly as requested.
226
+*/
227
+
218228
/*
219229
** Shift a color provided by the user so that it is suitable
220230
** for use as a background color in the current skin.
221231
**
222232
** The return value is a #HHHHHH color name contained in
@@ -226,27 +236,32 @@
226236
** that is the input, then return NULL.
227237
**
228238
** The iFgClr parameter is normally 0. But for testing purposes, set
229239
** it to 1 for a black foregrounds and 2 for a white foreground.
230240
*/
231
-char *reasonable_bg_color(const char *zRequested, int iFgClr){
241
+const char *reasonable_bg_color(const char *zRequested, int iFgClr){
232242
int iRGB = color_name_to_rgb(zRequested);
233243
int cc[3];
234244
int lo, hi;
235245
int r, g, b;
236246
static int systemFg = 0; /* 1==black-foreground 2==white-foreground */
237
- int fg;
238
- static char zColor[10];
247
+ int fg; /* Foreground color to actually use */
248
+ static char zColor[10]; /* Return value */
239249
int K = 70; /* Tune for background color saturation */
240250
241251
if( iFgClr ){
242252
fg = iFgClr;
243253
}else if( systemFg==0 ){
244
- fg = systemFg = skin_detail_boolean("white-foreground") ? 2 : 1;
254
+ if( db_get_boolean("raw-bgcolor",0) ){
255
+ fg = systemFg = 3;
256
+ }else{
257
+ fg = systemFg = skin_detail_boolean("white-foreground") ? 2 : 1;
258
+ }
245259
}else{
246260
fg = systemFg;
247261
}
262
+ if( fg>=3 ) return zRequested;
248263
249264
if( iRGB<0 ) return 0;
250265
if( fg==0 ) fg = skin_detail_boolean("white-foreground") ? 2 : 1;
251266
cc[0] = (iRGB>>16) & 0xff;
252267
cc[1] = (iRGB>>8) & 0xff;
253268
--- src/color.c
+++ src/color.c
@@ -213,10 +213,20 @@
213 }
214 return -1;
215 }
216 }
217
 
 
 
 
 
 
 
 
 
 
218 /*
219 ** Shift a color provided by the user so that it is suitable
220 ** for use as a background color in the current skin.
221 **
222 ** The return value is a #HHHHHH color name contained in
@@ -226,27 +236,32 @@
226 ** that is the input, then return NULL.
227 **
228 ** The iFgClr parameter is normally 0. But for testing purposes, set
229 ** it to 1 for a black foregrounds and 2 for a white foreground.
230 */
231 char *reasonable_bg_color(const char *zRequested, int iFgClr){
232 int iRGB = color_name_to_rgb(zRequested);
233 int cc[3];
234 int lo, hi;
235 int r, g, b;
236 static int systemFg = 0; /* 1==black-foreground 2==white-foreground */
237 int fg;
238 static char zColor[10];
239 int K = 70; /* Tune for background color saturation */
240
241 if( iFgClr ){
242 fg = iFgClr;
243 }else if( systemFg==0 ){
244 fg = systemFg = skin_detail_boolean("white-foreground") ? 2 : 1;
 
 
 
 
245 }else{
246 fg = systemFg;
247 }
 
248
249 if( iRGB<0 ) return 0;
250 if( fg==0 ) fg = skin_detail_boolean("white-foreground") ? 2 : 1;
251 cc[0] = (iRGB>>16) & 0xff;
252 cc[1] = (iRGB>>8) & 0xff;
253
--- src/color.c
+++ src/color.c
@@ -213,10 +213,20 @@
213 }
214 return -1;
215 }
216 }
217
218 /*
219 ** SETTING: raw-bgcolor boolean default=off
220 **
221 ** Fossil usually tries to adjust user-specified background colors
222 ** for checkins so that the text is readable and so that the color
223 ** is not too garish. This setting disables that filter. When
224 ** this setting is on, the user-selected background colors are shown
225 ** exactly as requested.
226 */
227
228 /*
229 ** Shift a color provided by the user so that it is suitable
230 ** for use as a background color in the current skin.
231 **
232 ** The return value is a #HHHHHH color name contained in
@@ -226,27 +236,32 @@
236 ** that is the input, then return NULL.
237 **
238 ** The iFgClr parameter is normally 0. But for testing purposes, set
239 ** it to 1 for a black foregrounds and 2 for a white foreground.
240 */
241 const char *reasonable_bg_color(const char *zRequested, int iFgClr){
242 int iRGB = color_name_to_rgb(zRequested);
243 int cc[3];
244 int lo, hi;
245 int r, g, b;
246 static int systemFg = 0; /* 1==black-foreground 2==white-foreground */
247 int fg; /* Foreground color to actually use */
248 static char zColor[10]; /* Return value */
249 int K = 70; /* Tune for background color saturation */
250
251 if( iFgClr ){
252 fg = iFgClr;
253 }else if( systemFg==0 ){
254 if( db_get_boolean("raw-bgcolor",0) ){
255 fg = systemFg = 3;
256 }else{
257 fg = systemFg = skin_detail_boolean("white-foreground") ? 2 : 1;
258 }
259 }else{
260 fg = systemFg;
261 }
262 if( fg>=3 ) return zRequested;
263
264 if( iRGB<0 ) return 0;
265 if( fg==0 ) fg = skin_detail_boolean("white-foreground") ? 2 : 1;
266 cc[0] = (iRGB>>16) & 0xff;
267 cc[1] = (iRGB>>8) & 0xff;
268

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button