@@ -274,14 +274,10 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
274274 this . contrastPassFailAPCA . createChild ( 'span' ) . textContent = `: ${ apcaThreshold . toFixed ( 2 ) } %` ;
275275 }
276276 if ( passesAPCA ) {
277- const iconCheckmark = new IconButton . Icon . Icon ( ) ;
278- iconCheckmark
279- . data = { iconName : 'checkmark' , color : 'var(--icon-checkmark-green)' , width : '20px' , height : '14px' } ;
277+ const iconCheckmark = createIconCheckmark ( ) ;
280278 this . contrastPassFailAPCA . appendChild ( iconCheckmark ) ;
281279 } else {
282- const iconNo = new IconButton . Icon . Icon ( ) ;
283- iconNo . data = { iconName : 'clear' , color : 'var(--icon-error)' } ;
284- iconNo . classList . add ( 'small' ) ;
280+ const iconNo = createIconNo ( ) ;
285281 this . contrastPassFailAPCA . appendChild ( iconNo ) ;
286282 const suggestedColor = this . computeSuggestedColor ( 'APCA' ) ;
287283 if ( suggestedColor ) {
@@ -325,13 +321,10 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
325321 this . contrastPassFailAA . createChild ( 'span' ) . textContent =
326322 i18nString ( UIStrings . placeholderWithColon , { PH1 : aa . toFixed ( 1 ) } ) ;
327323 if ( this . passesAA ) {
328- const iconCheckmark = new IconButton . Icon . Icon ( ) ;
329- iconCheckmark . data = { iconName : 'checkmark' , color : 'var(--icon-checkmark-green)' , width : '20px' , height : '14px' } ;
324+ const iconCheckmark = createIconCheckmark ( ) ;
330325 this . contrastPassFailAA . appendChild ( iconCheckmark ) ;
331326 } else {
332- const iconNo = new IconButton . Icon . Icon ( ) ;
333- iconNo . data = { iconName : 'clear' , color : 'var(--icon-error)' } ;
334- iconNo . classList . add ( 'small' ) ;
327+ const iconNo = createIconNo ( ) ;
335328 this . contrastPassFailAA . appendChild ( iconNo ) ;
336329 const suggestedColor = this . computeSuggestedColor ( 'aa' ) ;
337330 if ( suggestedColor ) {
@@ -349,13 +342,10 @@ export class ContrastDetails extends Common.ObjectWrapper.ObjectWrapper<EventTyp
349342 this . contrastPassFailAAA . createChild ( 'span' ) . textContent =
350343 i18nString ( UIStrings . placeholderWithColon , { PH1 : aaa . toFixed ( 1 ) } ) ;
351344 if ( passesAAA ) {
352- const iconCheckmark = new IconButton . Icon . Icon ( ) ;
353- iconCheckmark . data = { iconName : 'checkmark' , color : 'var(--icon-checkmark-green)' , width : '20px' , height : '14px' } ;
345+ const iconCheckmark = createIconCheckmark ( ) ;
354346 this . contrastPassFailAAA . appendChild ( iconCheckmark ) ;
355347 } else {
356- const iconNo = new IconButton . Icon . Icon ( ) ;
357- iconNo . data = { iconName : 'clear' , color : 'var(--icon-error)' } ;
358- iconNo . classList . add ( 'small' ) ;
348+ const iconNo = createIconNo ( ) ;
359349 this . contrastPassFailAAA . appendChild ( iconNo ) ;
360350 const suggestedColor = this . computeSuggestedColor ( 'aaa' ) ;
361351 if ( suggestedColor ) {
@@ -500,3 +490,20 @@ export class Swatch {
500490 this . swatchElement . classList . toggle ( 'swatch-inner-white' , bgColor . as ( Common . Color . Format . HSL ) . l > 0.9 ) ;
501491 }
502492}
493+
494+ function createIconCheckmark ( ) : IconButton . Icon . Icon {
495+ const icon = new IconButton . Icon . Icon ( ) ;
496+ icon . name = 'checkmark' ;
497+ icon . style . color = 'var(--icon-checkmark-green)' ;
498+ icon . style . width = 'var(--sys-size-9)' ;
499+ icon . style . height = 'var(--sys-size-7)' ;
500+ return icon ;
501+ }
502+
503+ function createIconNo ( ) : IconButton . Icon . Icon {
504+ const icon = new IconButton . Icon . Icon ( ) ;
505+ icon . name = 'clear' ;
506+ icon . style . color = 'var(--icon-error)' ;
507+ icon . classList . add ( 'small' ) ;
508+ return icon ;
509+ }
0 commit comments