@@ -3,6 +3,7 @@ import type Owner from '@ember/owner';
33import Component from '@glimmer/component' ;
44import { tracked } from '@glimmer/tracking' ;
55
6+ import { type IroColorValue } from '@irojs/iro-core' ;
67import iro from '@jaames/iro' ;
78import type { IpcRenderer } from 'electron' ;
89import { hex , score } from 'wcag-contrast' ;
@@ -37,13 +38,19 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
3738
3839 this . ipcRenderer = ipcRenderer ;
3940
40- this . ipcRenderer . on ( 'pickContrastBgColor' , async ( _event , color ) => {
41- this . setBgColor ( color ) ;
42- } ) ;
41+ this . ipcRenderer . on (
42+ 'pickContrastBgColor' ,
43+ ( _event , color : IroColorValue ) => {
44+ this . setBgColor ( color ) ;
45+ } ,
46+ ) ;
4347
44- this . ipcRenderer . on ( 'pickContrastFgColor' , async ( _event , color ) => {
45- this . setFgColor ( color ) ;
46- } ) ;
48+ this . ipcRenderer . on (
49+ 'pickContrastFgColor' ,
50+ ( _event , color : IroColorValue ) => {
51+ this . setFgColor ( color ) ;
52+ } ,
53+ ) ;
4754 }
4855 }
4956
@@ -139,16 +146,14 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
139146
140147 @action
141148 onBlurBg ( ev : Event ) {
142- this . setBgColor ( ( ev . target as HTMLInputElement ) . value ) ;
149+ this . setBgColor ( ( ev . target as HTMLInputElement ) . value as IroColorValue ) ;
143150 }
144151
145- // TODO: correctly type this instead of using `any`
146- // eslint-disable-next-line @typescript-eslint/no-explicit-any
147- setBgColor ( color : any ) {
152+ setBgColor ( color : IroColorValue ) {
148153 try {
149154 this . bgPickr . setColors ( [ color ] ) ;
150155 this . backgroundColor = this . bgPickr . color . hexString ;
151- } catch ( err ) {
156+ } catch {
152157 // TODO: maybe mention the color is invalid here?
153158 }
154159 }
@@ -158,13 +163,11 @@ export default class ContrastChecker extends Component<ContrastCheckerSignature>
158163 this . setFgColor ( ( ev . target as HTMLInputElement ) . value ) ;
159164 }
160165
161- // TODO: correctly type this instead of using `any`
162- // eslint-disable-next-line @typescript-eslint/no-explicit-any
163- setFgColor ( color : any ) {
166+ setFgColor ( color : IroColorValue ) {
164167 try {
165168 this . fgPickr . setColors ( [ color ] ) ;
166169 this . foregroundColor = this . fgPickr . color . hexString ;
167- } catch ( err ) {
170+ } catch {
168171 // TODO: maybe mention the color is invalid here?
169172 }
170173 }
0 commit comments