@@ -21,7 +21,6 @@ import {
2121 hslToRgb ,
2222 apca ,
2323 contrastingColor ,
24- asRgb ,
2524} from '../../color' ;
2625import {
2726 gamma ,
@@ -630,9 +629,12 @@ function toRI(c: Complex): { re: number; im: number } {
630629 * Normalize a color input (string or [r, g, b, a?] array with 0-1 values)
631630 * to an RgbColor {r, g, b, alpha?} with 0-255 r/g/b values.
632631 */
633- function toRgb255 (
634- input : string | number [ ]
635- ) : { r : number ; g : number ; b : number ; alpha ?: number } {
632+ function toRgb255 ( input : string | number [ ] ) : {
633+ r : number ;
634+ g : number ;
635+ b : number ;
636+ alpha ?: number ;
637+ } {
636638 if ( typeof input === 'string' ) {
637639 const c = parseColor ( input ) ;
638640 return {
@@ -665,10 +667,7 @@ const colorHelpers = {
665667 color ( input : string ) : number [ ] {
666668 return packedToArray ( parseColor ( input ) ) ;
667669 } ,
668- colorToString (
669- input : string | number [ ] ,
670- format ?: string
671- ) : string {
670+ colorToString ( input : string | number [ ] , format ?: string ) : string {
672671 const rgb = toRgb255 ( input ) ;
673672 const fmt = ( format ?? 'hex' ) . toLowerCase ( ) ;
674673 switch ( fmt ) {
@@ -743,10 +742,7 @@ const colorHelpers = {
743742 const alpha = a1 + ( a2 - a1 ) * ratio ;
744743 return Math . abs ( alpha - 1 ) > 1e-4 ? [ r , g , b , alpha ] : [ r , g , b ] ;
745744 } ,
746- colorContrast (
747- bg : string | number [ ] ,
748- fg : string | number [ ]
749- ) : number {
745+ colorContrast ( bg : string | number [ ] , fg : string | number [ ] ) : number {
750746 return apca ( toRgb255 ( bg ) , toRgb255 ( fg ) ) ;
751747 } ,
752748 contrastingColor (
@@ -762,10 +758,7 @@ const colorHelpers = {
762758 }
763759 return packedToArray ( contrastingColor ( bgRgb ) ) ;
764760 } ,
765- colorToColorspace (
766- input : string | number [ ] ,
767- space : string
768- ) : number [ ] {
761+ colorToColorspace ( input : string | number [ ] , space : string ) : number [ ] {
769762 const rgb = toRgb255 ( input ) ;
770763 const alpha = rgb . alpha ;
771764 let result : number [ ] ;
@@ -795,10 +788,7 @@ const colorHelpers = {
795788 if ( alpha !== undefined && Math . abs ( alpha - 1 ) > 1e-4 ) result . push ( alpha ) ;
796789 return result ;
797790 } ,
798- colorFromColorspace (
799- components : number [ ] ,
800- space : string
801- ) : number [ ] {
791+ colorFromColorspace ( components : number [ ] , space : string ) : number [ ] {
802792 const c0 = components [ 0 ] ;
803793 const c1 = components [ 1 ] ;
804794 const c2 = components [ 2 ] ;
0 commit comments