@@ -41,35 +41,35 @@ function hslToHex(h, s, l) {
4141}
4242
4343export class Converter {
44- IsString ( txt ) {
44+ static IsString ( txt ) {
4545 return typeof txt == "string" ;
4646 }
4747
48- IsNumber ( txt ) {
48+ static IsNumber ( txt ) {
4949 return typeof txt == "number" ;
5050 }
5151
52- IsBoolean ( txt ) {
52+ static IsBoolean ( txt ) {
5353 return typeof txt == "boolean" ;
5454 }
5555
56- CountItems ( arr : [ ] ) {
56+ static CountItems ( arr : [ ] ) {
5757 return arr . length ;
5858 }
5959
60- RBG ( col : string ) {
61- return col . substring ( 4 ) ;
60+ static RGB ( col : string ) {
61+ return '#' + col . substring ( 4 ) ;
6262 }
6363
64- RBGA ( col : string ) {
65- return col . substring ( 4 ) + col . substring ( 2 , 2 ) ;
64+ static RGBA ( col : string ) {
65+ return '#' + col . substring ( 4 ) + col . substring ( 2 , 4 ) ;
6666 }
6767
68- Alpha ( col : string ) {
69- return col . substring ( 2 ) ;
68+ static Alpha ( col : string ) {
69+ return col . substring ( 2 , 2 ) ;
7070 }
7171
72- Iluminate ( input : string , deviation : number , low = '#FFFFFF' , high = '#000000' ) {
72+ static Iluminate ( input : string , deviation : number , low = '#FFFFFF' , high = '#000000' ) {
7373 deviation = Math . max ( - 1 , Math . min ( 1 , deviation ) ) ; // Clamp deviation to [-1, 1]
7474
7575 let inputHSL = hexToHSL ( input ) ;
@@ -90,23 +90,28 @@ export class Converter {
9090 return hslToHex ( inputHSL . h , inputHSL . s , adjustedL ) ;
9191 }
9292
93- Darker ( input , deviation : number ) {
93+ static Darker ( input , deviation : number ) {
9494 return this . Iluminate ( input , deviation ) ;
9595 }
9696
97- Lighter ( input , deviation : number ) {
97+ static Lighter ( input , deviation : number ) {
9898 return this . Iluminate ( input , - 1 * deviation ) ;
9999 }
100100
101- Bounds ( input : number , min : number , max : number ) {
101+ static Bounds ( input : number , min : number , max : number ) {
102102 return Math . min ( Math . max ( input , min ) , max ) ;
103103 }
104104
105- Min ( input : number , min : number ) {
105+ static Min ( input : number , min : number ) {
106106 return Math . min ( input , min ) ;
107107 }
108108
109- Max ( input : number , max : number ) {
109+ static Max ( input : number , max : number ) {
110110 return Math . min ( input , max ) ;
111111 }
112+
113+ static FormatPattern ( value : string , patter : string ) {
114+ //TODO...
115+ return value ;
116+ }
112117}
0 commit comments