Skip to content

Commit 9a0f488

Browse files
committed
fix: icon foreground color
1 parent 7f42064 commit 9a0f488

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/renderer/components/TabItem.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts" setup>
22
import { nextTick, useId, watchEffect } from 'vue'
33
import type { TerminalTab, TerminalTabCharacter } from '@commas/types/terminal'
4+
import { isDarkColor, toRGBA } from '../../shared/color'
45
import { useSettings } from '../compositions/settings'
56
import { closeTerminalTab, getTerminalTabTitle, useCurrentTerminal } from '../compositions/terminal'
67
import { getIconEntry, isShellProcess } from '../utils/terminal'
@@ -92,6 +93,9 @@ const iconStyle = $computed(() => {
9293
if (!iconEntry) return undefined
9394
return {
9495
'--icon-color': iconEntry.color,
96+
'--icon-alt-color': iconEntry.color ? (
97+
isDarkColor(toRGBA(iconEntry.color)) ? 'white' : 'black'
98+
) : undefined,
9599
}
96100
})
97101
@@ -256,14 +260,15 @@ function close() {
256260
}
257261
.tab-icon {
258262
--icon-color: rgb(var(--system-accent));
263+
--icon-alt-color: white;
259264
display: flex;
260265
flex: none;
261266
justify-content: center;
262267
align-items: center;
263268
height: 1em;
264269
margin-right: 6px;
265270
padding: 3px;
266-
color: white;
271+
color: var(--icon-alt-color);
267272
font-size: 12px;
268273
background: var(--icon-color);
269274
border-radius: 4px;
@@ -275,7 +280,7 @@ function close() {
275280
color: var(--icon-color);
276281
font-size: #{12px + 3px * 2};
277282
overflow: hidden;
278-
background: white;
283+
background: var(--icon-alt-color);
279284
:deep(.visual-icon) {
280285
filter: none;
281286
}
@@ -287,7 +292,7 @@ function close() {
287292
filter: none;
288293
}
289294
&.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)));
291296
background: var(--icon-color);
292297
}
293298
}

0 commit comments

Comments
 (0)