Fossil SCM

The window.fossil bootstrapping code now adds the CSS class 'fossil-dark-style' to the body element if the skin has a true white-foreground setting. The initial use case for this is CSS-based color changing for pikchr SVGs, so that the same pikchrs work in light and dark themes.

stephan 2020-09-14 23:42 trunk
Commit e8f603f03a210aed5625e928316b99cdee27454d46763e2a41e894b173ee238d
1 file changed +2
--- src/builtin.c
+++ src/builtin.c
@@ -635,10 +635,12 @@
635635
CX("isDark: %s"
636636
"/*true if the current skin has the 'white-foreground' detail*/",
637637
skin_detail_boolean("white-foreground") ? "true" : "false");
638638
CX("}\n"/*fossil.config.skin*/);
639639
CX("};\n"/* fossil.config */);
640
+ CX("if(fossil.config.skin.isDark) "
641
+ "document.body.classList.add('fossil-dark-style');\n");
640642
#if 0
641643
/* Is it safe to emit the CSRF token here? Some pages add it
642644
** as a hidden form field. */
643645
if(g.zCsrfToken[0]!=0){
644646
CX("window.fossil.csrfToken = %!j;\n",
645647
--- src/builtin.c
+++ src/builtin.c
@@ -635,10 +635,12 @@
635 CX("isDark: %s"
636 "/*true if the current skin has the 'white-foreground' detail*/",
637 skin_detail_boolean("white-foreground") ? "true" : "false");
638 CX("}\n"/*fossil.config.skin*/);
639 CX("};\n"/* fossil.config */);
 
 
640 #if 0
641 /* Is it safe to emit the CSRF token here? Some pages add it
642 ** as a hidden form field. */
643 if(g.zCsrfToken[0]!=0){
644 CX("window.fossil.csrfToken = %!j;\n",
645
--- src/builtin.c
+++ src/builtin.c
@@ -635,10 +635,12 @@
635 CX("isDark: %s"
636 "/*true if the current skin has the 'white-foreground' detail*/",
637 skin_detail_boolean("white-foreground") ? "true" : "false");
638 CX("}\n"/*fossil.config.skin*/);
639 CX("};\n"/* fossil.config */);
640 CX("if(fossil.config.skin.isDark) "
641 "document.body.classList.add('fossil-dark-style');\n");
642 #if 0
643 /* Is it safe to emit the CSRF token here? Some pages add it
644 ** as a hidden form field. */
645 if(g.zCsrfToken[0]!=0){
646 CX("window.fossil.csrfToken = %!j;\n",
647

Keyboard Shortcuts

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