1
1
<script lang="ts" setup>
2
2
import { nextTick , useId , watchEffect } from ' vue'
3
3
import type { TerminalTab , TerminalTabCharacter } from ' @commas/types/terminal'
4
+ import { isDarkColor , toRGBA } from ' ../../shared/color'
4
5
import { useSettings } from ' ../compositions/settings'
5
6
import { closeTerminalTab , getTerminalTabTitle , useCurrentTerminal } from ' ../compositions/terminal'
6
7
import { getIconEntry , isShellProcess } from ' ../utils/terminal'
@@ -92,6 +93,9 @@ const iconStyle = $computed(() => {
92
93
if (! iconEntry ) return undefined
93
94
return {
94
95
' --icon-color' : iconEntry .color ,
96
+ ' --icon-alt-color' : iconEntry .color ? (
97
+ isDarkColor (toRGBA (iconEntry .color )) ? ' white' : ' black'
98
+ ) : undefined ,
95
99
}
96
100
})
97
101
@@ -256,14 +260,15 @@ function close() {
256
260
}
257
261
.tab-icon {
258
262
--icon-color : rgb (var (--system-accent ));
263
+ --icon-alt-color : white ;
259
264
display : flex ;
260
265
flex : none ;
261
266
justify-content : center ;
262
267
align-items : center ;
263
268
height : 1em ;
264
269
margin-right : 6px ;
265
270
padding : 3px ;
266
- color : white ;
271
+ color : var ( --icon-alt-color ) ;
267
272
font-size : 12px ;
268
273
background : var (--icon-color );
269
274
border-radius : 4px ;
@@ -275,7 +280,7 @@ function close() {
275
280
color : var (--icon-color );
276
281
font-size : #{12px + 3px * 2 } ;
277
282
overflow : hidden ;
278
- background : white ;
283
+ background : var ( --icon-alt-color ) ;
279
284
:deep (.visual-icon ) {
280
285
filter : none ;
281
286
}
@@ -287,7 +292,7 @@ function close() {
287
292
filter : none ;
288
293
}
289
294
& .is-filled {
290
- color : color-mix (in oklab , var (--icon-color ) 16.6667% , white );
295
+ color : color-mix (in oklab , var (--icon-color ) 16.6667% , rgb ( var ( --theme-background )) );
291
296
background : var (--icon-color );
292
297
}
293
298
}
0 commit comments