| | @@ -213,11 +213,11 @@ |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
| 217 | 217 | /* |
| 218 | | -** Default header text for diff with --webpage |
| 218 | +** Default header texts for diff with --webpage |
| 219 | 219 | */ |
| 220 | 220 | static const char zWebpageHdr[] = |
| 221 | 221 | @ <!DOCTYPE html> |
| 222 | 222 | @ <html> |
| 223 | 223 | @ <head> |
| | @@ -314,10 +314,116 @@ |
| 314 | 314 | @ } |
| 315 | 315 | @ |
| 316 | 316 | @ </style> |
| 317 | 317 | @ </head> |
| 318 | 318 | @ <body> |
| 319 | +; |
| 320 | +static const char zWebpageHdrDark[] = |
| 321 | +@ <!DOCTYPE html> |
| 322 | +@ <html> |
| 323 | +@ <head> |
| 324 | +@ <meta charset="UTF-8"> |
| 325 | +@ <style> |
| 326 | +@ body { |
| 327 | +@ background-color: #353535; |
| 328 | +@ color: #ffffff; |
| 329 | +@ } |
| 330 | +@ h1 { |
| 331 | +@ font-size: 150%; |
| 332 | +@ } |
| 333 | +@ |
| 334 | +@ table.diff { |
| 335 | +@ width: 100%; |
| 336 | +@ border-spacing: 0; |
| 337 | +@ border: 1px solid black; |
| 338 | +@ line-height: inherit; |
| 339 | +@ font-size: inherit; |
| 340 | +@ } |
| 341 | +@ table.diff td { |
| 342 | +@ vertical-align: top; |
| 343 | +@ line-height: inherit; |
| 344 | +@ font-size: inherit; |
| 345 | +@ } |
| 346 | +@ table.diff pre { |
| 347 | +@ margin: 0 0 0 0; |
| 348 | +@ line-height: inherit; |
| 349 | +@ font-size: inherit; |
| 350 | +@ } |
| 351 | +@ td.diffln { |
| 352 | +@ width: 1px; |
| 353 | +@ text-align: right; |
| 354 | +@ padding: 0 1em 0 0; |
| 355 | +@ } |
| 356 | +@ td.difflne { |
| 357 | +@ padding-bottom: 0.4em; |
| 358 | +@ } |
| 359 | +@ td.diffsep { |
| 360 | +@ width: 1px; |
| 361 | +@ padding: 0 0.3em 0 1em; |
| 362 | +@ line-height: inherit; |
| 363 | +@ font-size: inherit; |
| 364 | +@ } |
| 365 | +@ td.diffsep pre { |
| 366 | +@ line-height: inherit; |
| 367 | +@ font-size: inherit; |
| 368 | +@ } |
| 369 | +@ td.difftxt pre { |
| 370 | +@ overflow-x: auto; |
| 371 | +@ } |
| 372 | +@ td.diffln ins { |
| 373 | +@ background-color: #559855; |
| 374 | +@ color: #000000; |
| 375 | +@ text-decoration: none; |
| 376 | +@ line-height: inherit; |
| 377 | +@ font-size: inherit; |
| 378 | +@ } |
| 379 | +@ td.diffln del { |
| 380 | +@ background-color: #cc5555; |
| 381 | +@ color: #000000; |
| 382 | +@ text-decoration: none; |
| 383 | +@ line-height: inherit; |
| 384 | +@ font-size: inherit; |
| 385 | +@ } |
| 386 | +@ td.difftxt del { |
| 387 | +@ background-color: #f9cfcf; |
| 388 | +@ color: #000000; |
| 389 | +@ text-decoration: none; |
| 390 | +@ line-height: inherit; |
| 391 | +@ font-size: inherit; |
| 392 | +@ } |
| 393 | +@ td.difftxt del > del { |
| 394 | +@ background-color: #cc5555; |
| 395 | +@ color: #000000; |
| 396 | +@ text-decoration: none; |
| 397 | +@ font-weight: bold; |
| 398 | +@ } |
| 399 | +@ td.difftxt del > del.edit { |
| 400 | +@ background-color: #c0c0ff; |
| 401 | +@ text-decoration: none; |
| 402 | +@ font-weight: bold; |
| 403 | +@ } |
| 404 | +@ td.difftxt ins { |
| 405 | +@ background-color: #a2dbb2; |
| 406 | +@ color: #000000; |
| 407 | +@ text-decoration: none; |
| 408 | +@ line-height: inherit; |
| 409 | +@ font-size: inherit; |
| 410 | +@ } |
| 411 | +@ td.difftxt ins > ins { |
| 412 | +@ background-color: #559855; |
| 413 | +@ text-decoration: none; |
| 414 | +@ font-weight: bold; |
| 415 | +@ } |
| 416 | +@ td.difftxt ins > ins.edit { |
| 417 | +@ background-color: #c0c0ff; |
| 418 | +@ text-decoration: none; |
| 419 | +@ font-weight: bold; |
| 420 | +@ } |
| 421 | +@ |
| 422 | +@ </style> |
| 423 | +@ </head> |
| 424 | +@ <body> |
| 319 | 425 | ; |
| 320 | 426 | const char zWebpageEnd[] = |
| 321 | 427 | @ </body> |
| 322 | 428 | @ </html> |
| 323 | 429 | ; |
| | @@ -378,11 +484,12 @@ |
| 378 | 484 | #else |
| 379 | 485 | SetConsoleCtrlHandler(diff_console_ctrl_handler, TRUE); |
| 380 | 486 | #endif |
| 381 | 487 | } |
| 382 | 488 | if( (pCfg->diffFlags & DIFF_WEBPAGE)!=0 ){ |
| 383 | | - fossil_print("%s",zWebpageHdr); |
| 489 | + fossil_print("%s",(pCfg->diffFlags & DIFF_DARKMODE)!=0 ? zWebpageHdrDark : |
| 490 | + zWebpageHdr); |
| 384 | 491 | fflush(stdout); |
| 385 | 492 | } |
| 386 | 493 | } |
| 387 | 494 | |
| 388 | 495 | /* Do any final output required by a diff and complete the diff |
| | @@ -956,10 +1063,11 @@ |
| 956 | 1063 | int i; |
| 957 | 1064 | Blob script; |
| 958 | 1065 | const char *zTempFile = 0; |
| 959 | 1066 | char *zCmd; |
| 960 | 1067 | const char *zTclsh; |
| 1068 | + int bDarkMode = find_option("dark",0,0)!=0; |
| 961 | 1069 | blob_zero(&script); |
| 962 | 1070 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s -tcl -i -v", |
| 963 | 1071 | g.nameOfExe, zSubCmd); |
| 964 | 1072 | find_option("tcl",0,0); |
| 965 | 1073 | find_option("html",0,0); |
| | @@ -982,11 +1090,12 @@ |
| 982 | 1090 | int j; |
| 983 | 1091 | blob_append(&script, " ", 1); |
| 984 | 1092 | for(j=0; z[j]; j++) blob_appendf(&script, "\\%03o", (unsigned char)z[j]); |
| 985 | 1093 | } |
| 986 | 1094 | } |
| 987 | | - blob_appendf(&script, "}\n%s", builtin_file("diff.tcl", 0)); |
| 1095 | + blob_appendf(&script, "}\nset darkmode %d\n", bDarkMode); |
| 1096 | + blob_appendf(&script, "%s", builtin_file("diff.tcl", 0)); |
| 988 | 1097 | if( zTempFile ){ |
| 989 | 1098 | blob_write_to_file(&script, zTempFile); |
| 990 | 1099 | fossil_print("To see diff, run: %s \"%s\"\n", zTclsh, zTempFile); |
| 991 | 1100 | }else{ |
| 992 | 1101 | #if defined(FOSSIL_ENABLE_TCL) |
| | @@ -1078,10 +1187,11 @@ |
| 1078 | 1187 | ** --by Shorthand for "--browser -y" |
| 1079 | 1188 | ** -ci|--checkin VERSION Show diff of all changes in VERSION |
| 1080 | 1189 | ** --command PROG External diff program. Overrides "diff-command" |
| 1081 | 1190 | ** -c|--context N Show N lines of context around each change, with |
| 1082 | 1191 | ** negative N meaning show all content |
| 1192 | +** --dark Use dark mode for the TCL/TK-based GUI and HTML |
| 1083 | 1193 | ** --diff-binary BOOL Include binary files with external commands |
| 1084 | 1194 | ** --exec-abs-paths Force absolute path names on external commands |
| 1085 | 1195 | ** --exec-rel-paths Force relative path names on external commands |
| 1086 | 1196 | ** -r|--from VERSION Select VERSION as source for the diff |
| 1087 | 1197 | ** -w|--ignore-all-space Ignore white space when comparing lines |
| 1088 | 1198 | |