Skip to content

Commit 73b36a4

Browse files
committed
fix: filled icons
1 parent 7b6713b commit 73b36a4

File tree

3 files changed

+43
-10
lines changed

3 files changed

+43
-10
lines changed

src/renderer/assets/icons.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,16 @@ export default [
7474
},
7575
// Files
7676
{
77-
name: 'simple-icons-css3',
77+
name: 'simple-icons-css',
7878
patterns: [/\.css$/],
79-
color: '#1572b6',
79+
color: '#663399',
80+
filled: true,
8081
},
8182
{
8283
name: 'simple-icons-javascript',
8384
patterns: [/\.(c|m)?jsx?$/],
8485
color: '#f7df1e',
86+
filled: true,
8587
},
8688
{
8789
name: 'simple-icons-json',

src/renderer/components/TabItem.vue

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { nextTick, useId, watchEffect } from 'vue'
3-
import type { IconEntry, TerminalTab, TerminalTabCharacter } from '@commas/types/terminal'
3+
import type { TerminalTab, TerminalTabCharacter } from '@commas/types/terminal'
44
import { useSettings } from '../compositions/settings'
55
import { closeTerminalTab, getTerminalTabTitle, useCurrentTerminal } from '../compositions/terminal'
66
import { getIconEntry, isShellProcess } from '../utils/terminal'
@@ -47,13 +47,24 @@ const pane = $computed(() => {
4747
return tab.pane
4848
})
4949
50+
const defaultIconEntry = $computed(() => {
51+
if (character) {
52+
if (character.defaultIcon) {
53+
return character.defaultIcon
54+
}
55+
}
56+
if (pane) {
57+
if (pane.icon) {
58+
return pane.icon
59+
}
60+
}
61+
return undefined
62+
})
63+
5064
const iconEntry = $computed(() => {
51-
let defaultIcon: IconEntry | undefined
5265
if (character) {
5366
if (character.icon) {
5467
return character.icon
55-
} else {
56-
defaultIcon = character.defaultIcon
5768
}
5869
}
5970
if (tab) {
@@ -64,12 +75,17 @@ const iconEntry = $computed(() => {
6475
} else {
6576
if (tab.shell) {
6677
return getIconEntry(tab)
67-
} else if (pane.icon) {
68-
return pane.icon
6978
}
7079
}
7180
}
72-
return defaultIcon
81+
return defaultIconEntry
82+
})
83+
84+
const iconClass = $computed(() => {
85+
if (!iconEntry) return undefined
86+
return {
87+
'is-filled': iconEntry.filled,
88+
}
7389
})
7490
7591
const iconStyle = $computed(() => {
@@ -168,7 +184,7 @@ function close() {
168184
>
169185
<div class="tab-overview">
170186
<div class="tab-title">
171-
<span class="tab-icon" :style="iconStyle">
187+
<span :class="['tab-icon', iconClass]" :style="iconStyle">
172188
<VisualIcon v-if="iconEntry" :name="iconEntry.name" />
173189
<template v-else-if="pane && tab!.shell">
174190
<VisualIcon v-if="tab!.process === tab!.cwd" name="lucide-folder-open" />
@@ -254,12 +270,26 @@ function close() {
254270
:deep(.visual-icon) {
255271
filter: drop-shadow(2px 2px 2px rgb(0 0 0 / 25%));
256272
}
273+
&.is-filled {
274+
padding: 0;
275+
color: var(--icon-color);
276+
font-size: #{12px + 3px * 2};
277+
overflow: hidden;
278+
background: white;
279+
:deep(.visual-icon) {
280+
filter: none;
281+
}
282+
}
257283
.tab-item.virtual & {
258284
color: var(--icon-color);
259285
background: color-mix(in oklab, var(--icon-color) 16.6667%, transparent);
260286
:deep(.visual-icon) {
261287
filter: none;
262288
}
289+
&.is-filled {
290+
color: color-mix(in oklab, var(--icon-color) 16.6667%, white);
291+
background: var(--icon-color);
292+
}
263293
}
264294
}
265295
.tab-name {

src/types/terminal.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface IconEntry {
1616
name: string,
1717
patterns?: (string | RegExp)[],
1818
color?: string,
19+
filled?: boolean,
1920
}
2021

2122
export interface TerminalTabPane {

0 commit comments

Comments
 (0)