Skip to content

Commit b59805e

Browse files
committed
feat: colorful tab icon
1 parent e83673d commit b59805e

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

src/renderer/components/TabItem.vue

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ const iconEntry = $computed(() => {
7272
return defaultIcon
7373
})
7474
75+
const iconStyle = $computed(() => {
76+
if (!iconEntry) return undefined
77+
return {
78+
'--icon-color': iconEntry.color,
79+
}
80+
})
81+
7582
const title = $computed(() => {
7683
if (character?.title) return character.title
7784
return tab ? getTerminalTabTitle(tab) : ''
@@ -161,17 +168,14 @@ function close() {
161168
>
162169
<div class="tab-overview">
163170
<div class="tab-title">
164-
<VisualIcon
165-
v-if="iconEntry"
166-
:name="iconEntry.name"
167-
class="tab-icon"
168-
:style="{ color: iconEntry.color }"
169-
/>
170-
<template v-else-if="pane && tab!.shell">
171-
<VisualIcon v-if="tab!.process === tab!.cwd" name="lucide-folder-open" class="tab-icon" />
172-
<VisualIcon v-else name="lucide-file" class="tab-icon" />
173-
</template>
174-
<VisualIcon v-else name="lucide-terminal" class="tab-icon" />
171+
<span class="tab-icon" :style="iconStyle">
172+
<VisualIcon v-if="iconEntry" :name="iconEntry.name" />
173+
<template v-else-if="pane && tab!.shell">
174+
<VisualIcon v-if="tab!.process === tab!.cwd" name="lucide-folder-open" />
175+
<VisualIcon v-else name="lucide-file" />
176+
</template>
177+
<VisualIcon v-else name="lucide-terminal" />
178+
</span>
175179
<form v-if="isCustomizing" class="tab-name-form" @submit.prevent="customize">
176180
<input
177181
ref="customTitleElement"
@@ -232,12 +236,22 @@ function close() {
232236
min-width: 0;
233237
}
234238
.tab-icon {
235-
display: inline-block;
239+
--icon-color: rgb(var(--system-accent));
240+
--icon-color-alt: white;
241+
display: flex;
236242
flex: none;
243+
justify-content: center;
244+
align-items: center;
245+
height: 1em;
237246
margin-right: 6px;
238-
color: rgb(var(--system-accent));
247+
padding: 3px;
248+
color: var(--icon-color-alt);
249+
font-size: 12px;
250+
background: var(--icon-color);
251+
border-radius: 4px;
239252
.tab-item.virtual & {
240-
color: rgb(var(--theme-foreground) / 50%);
253+
color: var(--icon-color);
254+
background: color-mix(in oklab, var(--icon-color) 16.6667%, transparent);
241255
}
242256
}
243257
.tab-name {

0 commit comments

Comments
 (0)