11import yargs from 'yargs' ;
2+ import { ColorSchemeType } from 'diff2html/lib/types.js' ;
23
34import {
45 StyleType ,
@@ -35,6 +36,7 @@ export type Argv = {
3536 title ?: string ;
3637 ignore ?: string [ ] ;
3738 extraArguments : string [ ] ;
39+ colorScheme : ColorSchemeType ;
3840} ;
3941
4042const defaults : Argv = {
@@ -59,6 +61,7 @@ const defaults: Argv = {
5961 htmlWrapperTemplate : undefined ,
6062 title : undefined ,
6163 extraArguments : [ ] ,
64+ colorScheme : ColorSchemeType . AUTO ,
6265} ;
6366
6467type ArgvChoices = {
@@ -70,6 +73,7 @@ type ArgvChoices = {
7073 input : ReadonlyArray < InputType > ;
7174 output : ReadonlyArray < OutputType > ;
7275 diffy : ReadonlyArray < DiffyType > ;
76+ colorScheme : ReadonlyArray < ColorSchemeType > ;
7377} ;
7478
7579const choices : ArgvChoices = {
@@ -81,6 +85,7 @@ const choices: ArgvChoices = {
8185 input : [ 'file' , 'command' , 'stdin' ] ,
8286 output : [ 'preview' , 'stdout' ] ,
8387 diffy : [ 'browser' , 'pbcopy' , 'print' ] ,
88+ colorScheme : [ ColorSchemeType . AUTO , ColorSchemeType . DARK , ColorSchemeType . LIGHT ] ,
8489} ;
8590
8691export async function setup ( ) : Promise < Argv > {
@@ -229,6 +234,12 @@ export async function setup(): Promise<Argv> {
229234 type : 'array' ,
230235 default : defaults . ignore ,
231236 } )
237+ . option ( 'colorScheme' , {
238+ alias : 'cs' ,
239+ describe : 'Color scheme of HTML output' ,
240+ choices : choices . colorScheme ,
241+ default : defaults . colorScheme ,
242+ } )
232243 . example (
233244 'diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1' ,
234245 'diff last commit, line by line, word comparison between lines,' +
0 commit comments