Skip to content

Commit ef9de79

Browse files
committed
Design: Add "Recolor to gold" feature
If the user doesn't want their theme, let us recolor the icons to Cmdr gold too. Looks very nice.
1 parent 791a29a commit ef9de79

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

apps/desktop/src/lib/file-explorer/selection/FileIcon.svelte

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { FileEntry } from '../types'
33
import { getCachedIcon, iconCacheVersion } from '$lib/icon-cache'
44
import { getFallbackEmoji } from '../views/file-list-utils'
5+
import { getIsCmdrGold } from '$lib/settings/reactive-settings.svelte'
56
67
interface Props {
78
file: FileEntry
@@ -17,11 +18,14 @@
1718
void _cacheVersion // Track cache version for reactivity
1819
return getCachedIcon(f.iconId)
1920
}
21+
22+
const isFolderIcon = $derived(file.iconId === 'dir' || file.iconId === 'symlink-dir')
23+
const recolorToGold = $derived(isFolderIcon && getIsCmdrGold())
2024
</script>
2125

2226
<span class="icon-wrapper">
2327
{#if getIconUrl(file)}
24-
<img class="icon" src={getIconUrl(file)} alt="" width="16" height="16" />
28+
<img class="icon" class:gold-folder={recolorToGold} src={getIconUrl(file)} alt="" width="16" height="16" />
2529
{:else}
2630
<span class="icon-emoji">{getFallbackEmoji(file)}</span>
2731
{/if}
@@ -47,6 +51,10 @@
4751
object-fit: contain;
4852
}
4953
54+
.gold-folder {
55+
filter: grayscale(1) sepia(1) hue-rotate(3deg) saturate(2.5) brightness(0.95);
56+
}
57+
5058
.icon-emoji {
5159
font-size: var(--font-size-sm);
5260
width: 16px;

apps/desktop/src/lib/settings/reactive-settings.svelte.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
type DateTimeFormat,
1212
type FileSizeFormat,
1313
type DirectorySortMode,
14+
type AppColor,
1415
densityMappings,
1516
} from '$lib/settings'
1617
import { formatDateTimeWithFormat, formatFileSizeWithFormat } from './format-utils'
@@ -26,6 +27,7 @@ let customDateTimeFormat = $state<string>('YYYY-MM-DD HH:mm')
2627
let fileSizeFormat = $state<FileSizeFormat>('binary')
2728
let useAppIconsForDocuments = $state<boolean>(true)
2829
let directorySortMode = $state<DirectorySortMode>('likeFiles')
30+
let appColor = $state<AppColor>('cmdr-gold')
2931

3032
let initialized = false
3133
let unsubscribe: (() => void) | undefined
@@ -48,6 +50,7 @@ export async function initReactiveSettings(): Promise<void> {
4850
fileSizeFormat = getSetting('appearance.fileSizeFormat')
4951
useAppIconsForDocuments = getSetting('appearance.useAppIconsForDocuments')
5052
directorySortMode = getSetting('listing.directorySortMode')
53+
appColor = getSetting('appearance.appColor')
5154

5255
// Subscribe to changes (including cross-window changes)
5356
unsubscribe = onSettingChange((id, value) => {
@@ -80,6 +83,9 @@ export async function initReactiveSettings(): Promise<void> {
8083
log.info('Applying directory sort mode change: {value}', { value })
8184
directorySortMode = value as DirectorySortMode
8285
break
86+
case 'appearance.appColor':
87+
appColor = value as AppColor
88+
break
8389
}
8490
})
8591

@@ -123,6 +129,11 @@ export function getDirectorySortMode(): DirectorySortMode {
123129
return directorySortMode
124130
}
125131

132+
/** Whether the user has selected Cmdr gold as their app color */
133+
export function getIsCmdrGold(): boolean {
134+
return appColor === 'cmdr-gold'
135+
}
136+
126137
// ============================================================================
127138
// Formatting utilities that use reactive settings
128139
// ============================================================================

0 commit comments

Comments
 (0)