Fossil SCM
Provide a dark mode for the TCL/TK-based diff GUI.
Commit
b59a42f1f6489389874253739c49e3af2e3b25519e294c9585aff013b5a4573d
Parent
a8b6fdc83e8b539…
2 files changed
+32
-1
+6
-1
+32
-1
| --- src/diff.tcl | ||
| +++ src/diff.tcl | ||
| @@ -8,11 +8,11 @@ | ||
| 8 | 8 | # This header comment is stripped off by the "mkbuiltin.c" program. |
| 9 | 9 | # |
| 10 | 10 | set prog { |
| 11 | 11 | package require Tk |
| 12 | 12 | |
| 13 | -array set CFG { | |
| 13 | +array set CFG_light { | |
| 14 | 14 | TITLE {Fossil Diff} |
| 15 | 15 | LN_COL_BG #dddddd |
| 16 | 16 | LN_COL_FG #444444 |
| 17 | 17 | TXT_COL_BG #ffffff |
| 18 | 18 | TXT_COL_FG #000000 |
| @@ -32,10 +32,41 @@ | ||
| 32 | 32 | WIDTH 80 |
| 33 | 33 | HEIGHT 45 |
| 34 | 34 | LB_HEIGHT 25 |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | +array set CFG_dark { | |
| 38 | + TITLE {Fossil Diff} | |
| 39 | + LN_COL_BG #dddddd | |
| 40 | + LN_COL_FG #444444 | |
| 41 | + TXT_COL_BG #3f3f3f | |
| 42 | + TXT_COL_FG #dcdccc | |
| 43 | + MKR_COL_BG #444444 | |
| 44 | + MKR_COL_FG #dddddd | |
| 45 | + CHNG_BG #6a6afc | |
| 46 | + ADD_BG #57934c | |
| 47 | + RM_BG #ef6767 | |
| 48 | + HR_FG #444444 | |
| 49 | + HR_PAD_TOP 4 | |
| 50 | + HR_PAD_BTM 8 | |
| 51 | + FN_BG #5e5e5e | |
| 52 | + FN_FG #ffffff | |
| 53 | + FN_PAD 5 | |
| 54 | + ERR_FG #ee0000 | |
| 55 | + PADX 5 | |
| 56 | + WIDTH 80 | |
| 57 | + HEIGHT 45 | |
| 58 | + LB_HEIGHT 25 | |
| 59 | +} | |
| 60 | + | |
| 61 | +array set CFG_arr { | |
| 62 | + 0 CFG_light | |
| 63 | + 1 CFG_dark | |
| 64 | +} | |
| 65 | + | |
| 66 | +array set CFG [array get $CFG_arr($darkmode)] | |
| 67 | + | |
| 37 | 68 | if {![namespace exists ttk]} { |
| 38 | 69 | interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 39 | 70 | interp alias {} ::ttk::menubutton {} ::menubutton |
| 40 | 71 | } |
| 41 | 72 | |
| 42 | 73 |
| --- src/diff.tcl | |
| +++ src/diff.tcl | |
| @@ -8,11 +8,11 @@ | |
| 8 | # This header comment is stripped off by the "mkbuiltin.c" program. |
| 9 | # |
| 10 | set prog { |
| 11 | package require Tk |
| 12 | |
| 13 | array set CFG { |
| 14 | TITLE {Fossil Diff} |
| 15 | LN_COL_BG #dddddd |
| 16 | LN_COL_FG #444444 |
| 17 | TXT_COL_BG #ffffff |
| 18 | TXT_COL_FG #000000 |
| @@ -32,10 +32,41 @@ | |
| 32 | WIDTH 80 |
| 33 | HEIGHT 45 |
| 34 | LB_HEIGHT 25 |
| 35 | } |
| 36 | |
| 37 | if {![namespace exists ttk]} { |
| 38 | interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 39 | interp alias {} ::ttk::menubutton {} ::menubutton |
| 40 | } |
| 41 | |
| 42 |
| --- src/diff.tcl | |
| +++ src/diff.tcl | |
| @@ -8,11 +8,11 @@ | |
| 8 | # This header comment is stripped off by the "mkbuiltin.c" program. |
| 9 | # |
| 10 | set prog { |
| 11 | package require Tk |
| 12 | |
| 13 | array set CFG_light { |
| 14 | TITLE {Fossil Diff} |
| 15 | LN_COL_BG #dddddd |
| 16 | LN_COL_FG #444444 |
| 17 | TXT_COL_BG #ffffff |
| 18 | TXT_COL_FG #000000 |
| @@ -32,10 +32,41 @@ | |
| 32 | WIDTH 80 |
| 33 | HEIGHT 45 |
| 34 | LB_HEIGHT 25 |
| 35 | } |
| 36 | |
| 37 | array set CFG_dark { |
| 38 | TITLE {Fossil Diff} |
| 39 | LN_COL_BG #dddddd |
| 40 | LN_COL_FG #444444 |
| 41 | TXT_COL_BG #3f3f3f |
| 42 | TXT_COL_FG #dcdccc |
| 43 | MKR_COL_BG #444444 |
| 44 | MKR_COL_FG #dddddd |
| 45 | CHNG_BG #6a6afc |
| 46 | ADD_BG #57934c |
| 47 | RM_BG #ef6767 |
| 48 | HR_FG #444444 |
| 49 | HR_PAD_TOP 4 |
| 50 | HR_PAD_BTM 8 |
| 51 | FN_BG #5e5e5e |
| 52 | FN_FG #ffffff |
| 53 | FN_PAD 5 |
| 54 | ERR_FG #ee0000 |
| 55 | PADX 5 |
| 56 | WIDTH 80 |
| 57 | HEIGHT 45 |
| 58 | LB_HEIGHT 25 |
| 59 | } |
| 60 | |
| 61 | array set CFG_arr { |
| 62 | 0 CFG_light |
| 63 | 1 CFG_dark |
| 64 | } |
| 65 | |
| 66 | array set CFG [array get $CFG_arr($darkmode)] |
| 67 | |
| 68 | if {![namespace exists ttk]} { |
| 69 | interp alias {} ::ttk::scrollbar {} ::scrollbar |
| 70 | interp alias {} ::ttk::menubutton {} ::menubutton |
| 71 | } |
| 72 | |
| 73 |
+6
-1
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -956,10 +956,11 @@ | ||
| 956 | 956 | int i; |
| 957 | 957 | Blob script; |
| 958 | 958 | const char *zTempFile = 0; |
| 959 | 959 | char *zCmd; |
| 960 | 960 | const char *zTclsh; |
| 961 | + int bDarkMode = find_option("dark",0,0)!=0; | |
| 961 | 962 | blob_zero(&script); |
| 962 | 963 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", |
| 963 | 964 | g.nameOfExe, zSubCmd); |
| 964 | 965 | find_option("tcl",0,0); |
| 965 | 966 | find_option("html",0,0); |
| @@ -982,11 +983,12 @@ | ||
| 982 | 983 | int j; |
| 983 | 984 | blob_append(&script, " ", 1); |
| 984 | 985 | for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); |
| 985 | 986 | } |
| 986 | 987 | } |
| 987 | - blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); | |
| 988 | + blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode); | |
| 989 | + blob_appendf(&script, "%s", builtin_file("diff.tcl", 0)); | |
| 988 | 990 | if( zTempFile ){ |
| 989 | 991 | blob_write_to_file(&script, zTempFile); |
| 990 | 992 | fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); |
| 991 | 993 | }else{ |
| 992 | 994 | #if defined(FOSSIL_ENABLE_TCL) |
| @@ -1078,10 +1080,11 @@ | ||
| 1078 | 1080 | ** --by Shorthand for "--browser -y" |
| 1079 | 1081 | ** -ci|--checkin VERSION Show diff of all changes in VERSION |
| 1080 | 1082 | ** --command PROG External diff program. Overrides "diff-command" |
| 1081 | 1083 | ** -c|--context N Show N lines of context around each change, with |
| 1082 | 1084 | ** negative N meaning show all content |
| 1085 | +** --dark Use dark mode for the TCL/TK-based GUI | |
| 1083 | 1086 | ** --diff-binary BOOL Include binary files with external commands |
| 1084 | 1087 | ** --exec-abs-paths Force absolute path names on external commands |
| 1085 | 1088 | ** --exec-rel-paths Force relative path names on external commands |
| 1086 | 1089 | ** -r|--from VERSION Select VERSION as source for the diff |
| 1087 | 1090 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| @@ -1114,10 +1117,12 @@ | ||
| 1114 | 1117 | DiffConfig DCfg; /* Diff configuration object */ |
| 1115 | 1118 | |
| 1116 | 1119 | if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ |
| 1117 | 1120 | diff_tk("diff", 2); |
| 1118 | 1121 | return; |
| 1122 | + }else{ | |
| 1123 | + find_option("dark", 0, 0); | |
| 1119 | 1124 | } |
| 1120 | 1125 | isGDiff = g.argv[1][0]=='g'; |
| 1121 | 1126 | zFrom = find_option("from", "r", 1); |
| 1122 | 1127 | zTo = find_option("to", 0, 1); |
| 1123 | 1128 | zCheckin = find_option("checkin", "ci", 1); |
| 1124 | 1129 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -956,10 +956,11 @@ | |
| 956 | int i; |
| 957 | Blob script; |
| 958 | const char *zTempFile = 0; |
| 959 | char *zCmd; |
| 960 | const char *zTclsh; |
| 961 | blob_zero(&script); |
| 962 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", |
| 963 | g.nameOfExe, zSubCmd); |
| 964 | find_option("tcl",0,0); |
| 965 | find_option("html",0,0); |
| @@ -982,11 +983,12 @@ | |
| 982 | int j; |
| 983 | blob_append(&script, " ", 1); |
| 984 | for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); |
| 985 | } |
| 986 | } |
| 987 | blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); |
| 988 | if( zTempFile ){ |
| 989 | blob_write_to_file(&script, zTempFile); |
| 990 | fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); |
| 991 | }else{ |
| 992 | #if defined(FOSSIL_ENABLE_TCL) |
| @@ -1078,10 +1080,11 @@ | |
| 1078 | ** --by Shorthand for "--browser -y" |
| 1079 | ** -ci|--checkin VERSION Show diff of all changes in VERSION |
| 1080 | ** --command PROG External diff program. Overrides "diff-command" |
| 1081 | ** -c|--context N Show N lines of context around each change, with |
| 1082 | ** negative N meaning show all content |
| 1083 | ** --diff-binary BOOL Include binary files with external commands |
| 1084 | ** --exec-abs-paths Force absolute path names on external commands |
| 1085 | ** --exec-rel-paths Force relative path names on external commands |
| 1086 | ** -r|--from VERSION Select VERSION as source for the diff |
| 1087 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| @@ -1114,10 +1117,12 @@ | |
| 1114 | DiffConfig DCfg; /* Diff configuration object */ |
| 1115 | |
| 1116 | if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ |
| 1117 | diff_tk("diff", 2); |
| 1118 | return; |
| 1119 | } |
| 1120 | isGDiff = g.argv[1][0]=='g'; |
| 1121 | zFrom = find_option("from", "r", 1); |
| 1122 | zTo = find_option("to", 0, 1); |
| 1123 | zCheckin = find_option("checkin", "ci", 1); |
| 1124 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -956,10 +956,11 @@ | |
| 956 | int i; |
| 957 | Blob script; |
| 958 | const char *zTempFile = 0; |
| 959 | char *zCmd; |
| 960 | const char *zTclsh; |
| 961 | int bDarkMode = find_option("dark",0,0)!=0; |
| 962 | blob_zero(&script); |
| 963 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", |
| 964 | g.nameOfExe, zSubCmd); |
| 965 | find_option("tcl",0,0); |
| 966 | find_option("html",0,0); |
| @@ -982,11 +983,12 @@ | |
| 983 | int j; |
| 984 | blob_append(&script, " ", 1); |
| 985 | for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); |
| 986 | } |
| 987 | } |
| 988 | blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode); |
| 989 | blob_appendf(&script, "%s", builtin_file("diff.tcl", 0)); |
| 990 | if( zTempFile ){ |
| 991 | blob_write_to_file(&script, zTempFile); |
| 992 | fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); |
| 993 | }else{ |
| 994 | #if defined(FOSSIL_ENABLE_TCL) |
| @@ -1078,10 +1080,11 @@ | |
| 1080 | ** --by Shorthand for "--browser -y" |
| 1081 | ** -ci|--checkin VERSION Show diff of all changes in VERSION |
| 1082 | ** --command PROG External diff program. Overrides "diff-command" |
| 1083 | ** -c|--context N Show N lines of context around each change, with |
| 1084 | ** negative N meaning show all content |
| 1085 | ** --dark Use dark mode for the TCL/TK-based GUI |
| 1086 | ** --diff-binary BOOL Include binary files with external commands |
| 1087 | ** --exec-abs-paths Force absolute path names on external commands |
| 1088 | ** --exec-rel-paths Force relative path names on external commands |
| 1089 | ** -r|--from VERSION Select VERSION as source for the diff |
| 1090 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| @@ -1114,10 +1117,12 @@ | |
| 1117 | DiffConfig DCfg; /* Diff configuration object */ |
| 1118 | |
| 1119 | if( find_option("tk",0,0)!=0 || has_option("tclsh") ){ |
| 1120 | diff_tk("diff", 2); |
| 1121 | return; |
| 1122 | }else{ |
| 1123 | find_option("dark", 0, 0); |
| 1124 | } |
| 1125 | isGDiff = g.argv[1][0]=='g'; |
| 1126 | zFrom = find_option("from", "r", 1); |
| 1127 | zTo = find_option("to", 0, 1); |
| 1128 | zCheckin = find_option("checkin", "ci", 1); |
| 1129 |