package Ġorg . http 4 k . routing . inspect Ċ Ċ fun ĠString . styled ( style : ĠTextStyle , Ġescape Mode : ĠE scape Mode Ġ= ĠE scape Mode . Ansi ) Ġ= Ġescape Mode ( this , Ġstyle ) Ċ Ċ data Ġclass ĠTextStyle ( ĊĠĠĠ Ġval Ġforeground Colour : ĠFore ground Colour Ġ= ĠFore ground Colour . Default , ĊĠĠĠ Ġval Ġbackground Colour : ĠBackground Colour Ġ= ĠBackground Colour . Default , ĊĠĠĠ Ġval Ġvariation : ĠVari ation Ġ= ĠVari ation . Default , Ċ ) Ċ Ċ enum Ġclass ĠFore ground Colour ( val Ġansi : ĠString ) Ġ{ ĊĠĠĠ ĠBlack ("\ u 0 0 1 B [ 3 0 m "), ĠRed ("\ u 0 0 1 B [ 3 1 m "), ĠGreen ("\ u 0 0 1 B [ 3 2 m "), ĠY ellow ("\ u 0 0 1 B [ 3 3 m "), ĠBlue ("\ u 0 0 1 B [ 3 4 m "), ĠPur ple ("\ u 0 0 1 B [ 3 5 m "), ĠC yan ("\ u 0 0 1 B [ 3 6 m "), ĠWhite ("\ u 0 0 1 B [ 3 7 m "), ĠDefault ("") Ċ } Ċ Ċ enum Ġclass ĠBackground Colour ( val Ġansi : ĠString ) Ġ{ ĊĠĠĠ ĠRed ("\ u 0 0 1 B [ 4 1 m "), ĠGreen ("\ u 0 0 1 B [ 4 2 m "), ĠY ellow ("\ u 0 0 1 B [ 4 3 m "), ĠBlue ("\ u 0 0 1 B [ 4 4 m "), ĠPur ple ("\ u 0 0 1 B [ 4 5 m "), ĠC yan ("\ u 0 0 1 B [ 4 6 m "), ĠWhite ("\ u 0 0 1 B [ 4 7 m "), ĠBlack ("\ u 0 0 1 B [ 4 0 m "), ĠDefault ("") Ċ } Ċ Ċ enum Ġclass ĠVari ation ( val Ġansi : ĠString ) Ġ{ ĊĠĠĠ ĠB old ("\ u 0 0 1 B [ 1 m "), ĠIt alic ("\ u 0 0 1 B [ 3 m "), ĠB old Italic ("\ u 0 0 1 B [ 3 m "), ĠUnder line ("\ u 0 0 1 B [ 4 m "), ĠStri ke through ("\ u 0 0 1 B [ 9 m "), ĠDefault ("") Ċ } Ċ Ċ enum Ġclass ĠE scape Mode ( private Ġval Ġconverter : Ġ( String , ĠTextStyle ) Ġ-> ĠString ) Ġ{ ĊĠĠĠ ĠAn si ({ Ġtext , Ġstyle Ġ-> Ġ"${ style . foreground Colour . ansi }${ style . background Colour . ansi }${ style . variation . ansi }$ text $ reset " Ġ}), ĊĠĠĠ ĠP seudo ({ Ġtext , Ġstyle Ġ-> ĊĠĠĠĠĠĠĠ Ġstyle . variation . pseudo () Ġ+ Ġstyle . foreground Colour . pseudo () Ġ+ Ġtext Ġ+ Ġstyle . foreground Colour . pseudo () Ġ+ Ġstyle . variation . pseudo () ĊĠĠĠ Ġ}), ĊĠĠĠ ĠNone ({ Ġtext , Ġ_ Ġ-> Ġtext Ġ}); ĊĊĠĠĠ Ġoperator Ġfun Ġinvoke ( text : ĠString , Ġstyle : ĠTextStyle ) Ġ= Ġconverter ( text , Ġstyle ) Ċ } Ċ Ċ internal Ġconst Ġval Ġreset Ġ= Ġ"\ u 0 0 1 B [ 0 m " Ċ Ċ private Ġfun ĠFore ground Colour . pseudo () Ġ= Ġif Ġ( this Ġ== ĠFore ground Colour . Default ) Ġ"" Ġelse Ġ"[ ${ name . toLowerCase ()} ]" Ċ Ċ private Ġfun ĠVari ation . pseudo (): ĠString Ġ= Ġwhen Ġ( this ) Ġ{ ĊĠĠĠ ĠVari ation . Bold Ġ-> Ġ"*" ĊĠĠĠ ĠVari ation . Italic Ġ-> Ġ"_" ĊĠĠĠ ĠVari ation . Bold Italic Ġ-> Ġ"** " ĊĠĠĠ ĠVari ation . Underline Ġ-> Ġ"_" ĊĠĠĠ ĠVari ation . Stri ke through Ġ-> Ġ"~ " ĊĠĠĠ ĠVari ation . Default Ġ-> Ġ"" Ċ } Ċ