Skip to content

Commit b92b355

Browse files
JSKittyclaude
andcommitted
style(settings): rank storage donut colors by slice size
Slices now take a fixed purple-to-gray ramp in descending size order instead of per-category identity colors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 221f0a3 commit b92b355

1 file changed

Lines changed: 14 additions & 11 deletions

File tree

src/js/settings.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,18 +1646,20 @@ async function initStorageSection() {
16461646
}
16471647
}
16481648

1649-
// Storage donut: fixed spectral palette (not the theme accent) so categories stay
1650-
// distinguishable at a glance; tones are matched so no slice visually dominates.
16511649
const STORAGE_CATEGORIES = [
1652-
{ name: 'Images', color: '#eda15f', exts: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'avif', 'heic', 'heif', 'tif', 'tiff', 'ico'], title: 'Delete all Images?', noun: 'downloaded images' },
1653-
{ name: 'Video', color: '#5cc296', exts: ['mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', '3gp', 'webm', 'm4v', 'mpeg', 'mpg'], title: 'Delete all Videos?', noun: 'downloaded videos' },
1654-
{ name: 'Audio', color: '#e6c860', exts: ['mp3', 'wav', 'ogg', 'oga', 'opus', 'flac', 'm4a', 'aac', 'weba', 'wma', 'aiff'], title: 'Delete all Audio?', noun: 'downloaded audio and voice messages' },
1655-
{ name: 'Apps', color: '#e0616e', exts: ['xdc', 'jsdos'], title: 'Delete all Mini Apps?', noun: 'downloaded Mini Apps' },
1656-
{ name: 'AI', color: '#9070e8', key: '/ai_models', title: 'Delete AI Models?' },
1657-
{ name: 'Cache', color: '#5eb3ea', key: '/cache', title: 'Clear the Cache?' },
1658-
{ name: 'Files', color: '#9aa0a8', rest: true, title: 'Delete all Files?', noun: 'downloaded files' }
1650+
{ name: 'Images', exts: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'avif', 'heic', 'heif', 'tif', 'tiff', 'ico'], title: 'Delete all Images?', noun: 'downloaded images' },
1651+
{ name: 'Video', exts: ['mp4', 'mov', 'avi', 'mkv', 'flv', 'wmv', '3gp', 'webm', 'm4v', 'mpeg', 'mpg'], title: 'Delete all Videos?', noun: 'downloaded videos' },
1652+
{ name: 'Audio', exts: ['mp3', 'wav', 'ogg', 'oga', 'opus', 'flac', 'm4a', 'aac', 'weba', 'wma', 'aiff'], title: 'Delete all Audio?', noun: 'downloaded audio and voice messages' },
1653+
{ name: 'Apps', exts: ['xdc', 'jsdos'], title: 'Delete all Mini Apps?', noun: 'downloaded Mini Apps' },
1654+
{ name: 'AI', key: '/ai_models', title: 'Delete AI Models?' },
1655+
{ name: 'Cache', key: '/cache', title: 'Clear the Cache?' },
1656+
{ name: 'Files', rest: true, title: 'Delete all Files?', noun: 'downloaded files' }
16591657
];
16601658

1659+
// Slice colors rank by size rather than category identity: the largest slice
1660+
// is always purple, descending through the ramp to gray.
1661+
const STORAGE_SLICE_RAMP = ['#9D5DF9', '#5EC4F7', '#4AD99D', '#FBA35B', '#FBC85B', '#B2B2B2'];
1662+
16611663
/** Category-aware confirmation for a storage delete; returns the user's choice. */
16621664
async function confirmStorageDelete(cat, sizeText) {
16631665
let body;
@@ -1725,9 +1727,10 @@ function renderStorageDonut(typeDistribution) {
17251727
}
17261728

17271729
const segments = STORAGE_CATEGORIES
1728-
.map(c => ({ name: c.name, color: c.color, size: sizes.get(c.name) }))
1730+
.map(c => ({ name: c.name, size: sizes.get(c.name) }))
17291731
.filter(s => s.size > 0)
1730-
.sort((a, b) => b.size - a.size);
1732+
.sort((a, b) => b.size - a.size)
1733+
.map((s, i) => ({ ...s, color: STORAGE_SLICE_RAMP[Math.min(i, STORAGE_SLICE_RAMP.length - 1)] }));
17311734
const total = segments.reduce((sum, s) => sum + s.size, 0);
17321735

17331736
const setCenter = (value, label) => {

0 commit comments

Comments
 (0)