@@ -159,7 +159,7 @@ const polyfillTheme = vsCodeTheme => {
159159 const addedColors = {
160160 mutedForeground,
161161 activityBar : {
162- selected : uiColors . sideBar . foreground ,
162+ selectedForeground : uiColors . sideBar . foreground ,
163163 inactiveForeground : mutedForeground ,
164164 hoverBackground : uiColors . sideBar . border ,
165165 } ,
@@ -199,6 +199,14 @@ const polyfillTheme = vsCodeTheme => {
199199 uiColors . switch . toggle = designLanguage . colors . grays [ 200 ] ;
200200 }
201201
202+ // ensure enough contrast from inactive state
203+ uiColors . activityBar . selectedForeground = withContrast (
204+ uiColors . activityBar . selectedForeground ,
205+ uiColors . activityBar . inactiveForeground ,
206+ type ,
207+ 'icon'
208+ ) ;
209+
202210 return uiColors ;
203211} ;
204212
@@ -219,8 +227,11 @@ const darken = (color, value) =>
219227 . darken ( value )
220228 . hex ( ) ;
221229
222- const withContrast = ( color , background , type ) => {
223- if ( Color ( color ) . contrast ( Color ( background ) ) > 4.5 ) return color ;
230+ const withContrast = ( color , background , type , contrastType = 'text' ) => {
231+ const contrastRatio = { text : 4.5 , icon : 3 } ;
232+ const contrast = contrastRatio [ contrastType ] ;
233+
234+ if ( Color ( color ) . contrast ( Color ( background ) ) > contrast ) return color ;
224235
225236 // can't fix that
226237 if ( color === '#FFFFFF' || color === '#000000' ) return color ;
0 commit comments