Fossil SCM

Add -dark flag to the pikchr command to tell pikchr to render in dark mode. This is the first part of a request from [forum:8f18c016fe|forum post 8f18c016fe].

stephan 2024-03-05 08:16 trunk
Commit 91a73ec348d7609fa8dcde9080e6f64d0bfc473a6a4bf8278bcfd7fd97eea387
1 file changed +9
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -22,10 +22,14 @@
2222
#include <ctype.h>
2323
#include "pikchrshow.h"
2424
2525
#if INTERFACE
2626
/* These are described in pikchr_process()'s docs. */
27
+/* The first two must match the values from pikchr.c */
28
+#define PIKCHR_PROCESS_PLAINTEXT_ERRORS 0x0001
29
+#define PIKCHR_PROCESS_DARK_MODE 0x0002
30
+/* end of flags supported directly by pikchr() */
2731
#define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */
2832
#define PIKCHR_PROCESS_TH1 0x0004
2933
#define PIKCHR_PROCESS_TH1_NOSVG 0x0008
3034
#define PIKCHR_PROCESS_NONCE 0x0010
3135
#define PIKCHR_PROCESS_ERR_PRE 0x0020
@@ -560,10 +564,12 @@
560564
** -th-nosvg When using -th, output the post-TH1'd script
561565
** instead of the pikchr-rendered output
562566
**
563567
** -th-trace Trace TH1 execution (for debugging purposes)
564568
**
569
+** -dark Change pikchr colors to assume a dark-mode theme.
570
+**
565571
**
566572
** The -div-indent/center/left/right flags may not be combined.
567573
**
568574
** TH1-related Notes and Caveats:
569575
**
@@ -613,10 +619,13 @@
613619
pikFlags |= PIKCHR_PROCESS_DIV_TOGGLE;
614620
}
615621
if(find_option("div-source",0,0)!=0){
616622
pikFlags |= PIKCHR_PROCESS_DIV_SOURCE | PIKCHR_PROCESS_SRC;
617623
}
624
+ if(find_option("dark",0,0)!=0){
625
+ pikFlags |= PIKCHR_PROCESS_DARK_MODE;
626
+ }
618627
619628
verify_all_options();
620629
if(g.argc>4){
621630
usage("?INFILE? ?OUTFILE?");
622631
}
623632
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -22,10 +22,14 @@
22 #include <ctype.h>
23 #include "pikchrshow.h"
24
25 #if INTERFACE
26 /* These are described in pikchr_process()'s docs. */
 
 
 
 
27 #define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */
28 #define PIKCHR_PROCESS_TH1 0x0004
29 #define PIKCHR_PROCESS_TH1_NOSVG 0x0008
30 #define PIKCHR_PROCESS_NONCE 0x0010
31 #define PIKCHR_PROCESS_ERR_PRE 0x0020
@@ -560,10 +564,12 @@
560 ** -th-nosvg When using -th, output the post-TH1'd script
561 ** instead of the pikchr-rendered output
562 **
563 ** -th-trace Trace TH1 execution (for debugging purposes)
564 **
 
 
565 **
566 ** The -div-indent/center/left/right flags may not be combined.
567 **
568 ** TH1-related Notes and Caveats:
569 **
@@ -613,10 +619,13 @@
613 pikFlags |= PIKCHR_PROCESS_DIV_TOGGLE;
614 }
615 if(find_option("div-source",0,0)!=0){
616 pikFlags |= PIKCHR_PROCESS_DIV_SOURCE | PIKCHR_PROCESS_SRC;
617 }
 
 
 
618
619 verify_all_options();
620 if(g.argc>4){
621 usage("?INFILE? ?OUTFILE?");
622 }
623
--- src/pikchrshow.c
+++ src/pikchrshow.c
@@ -22,10 +22,14 @@
22 #include <ctype.h>
23 #include "pikchrshow.h"
24
25 #if INTERFACE
26 /* These are described in pikchr_process()'s docs. */
27 /* The first two must match the values from pikchr.c */
28 #define PIKCHR_PROCESS_PLAINTEXT_ERRORS 0x0001
29 #define PIKCHR_PROCESS_DARK_MODE 0x0002
30 /* end of flags supported directly by pikchr() */
31 #define PIKCHR_PROCESS_PASSTHROUGH 0x0003 /* Pass through these flags */
32 #define PIKCHR_PROCESS_TH1 0x0004
33 #define PIKCHR_PROCESS_TH1_NOSVG 0x0008
34 #define PIKCHR_PROCESS_NONCE 0x0010
35 #define PIKCHR_PROCESS_ERR_PRE 0x0020
@@ -560,10 +564,12 @@
564 ** -th-nosvg When using -th, output the post-TH1'd script
565 ** instead of the pikchr-rendered output
566 **
567 ** -th-trace Trace TH1 execution (for debugging purposes)
568 **
569 ** -dark Change pikchr colors to assume a dark-mode theme.
570 **
571 **
572 ** The -div-indent/center/left/right flags may not be combined.
573 **
574 ** TH1-related Notes and Caveats:
575 **
@@ -613,10 +619,13 @@
619 pikFlags |= PIKCHR_PROCESS_DIV_TOGGLE;
620 }
621 if(find_option("div-source",0,0)!=0){
622 pikFlags |= PIKCHR_PROCESS_DIV_SOURCE | PIKCHR_PROCESS_SRC;
623 }
624 if(find_option("dark",0,0)!=0){
625 pikFlags |= PIKCHR_PROCESS_DARK_MODE;
626 }
627
628 verify_all_options();
629 if(g.argc>4){
630 usage("?INFILE? ?OUTFILE?");
631 }
632

Keyboard Shortcuts

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