OpenInTerminal icon indicating copy to clipboard operation
OpenInTerminal copied to clipboard

Adaptive light and dark mode icons?

Open AlexanderOMara opened this issue 1 year ago • 6 comments

Summarize this feature

According to Wikipedia it's possible to create an icns file with a dark mode embedded inside of a light mode icns file.

Why should this feature be included?

Convenience and presumably auto-adaptive?

Additional information

Assuming this works how I think it would, this would be especially good for the Lite versions of this app.

If anyone knows of any samples of such an icon, that might be helpful to play around with. I'm not sure what the official procedure to make one is and the iconutil man pages don't cover it.

AlexanderOMara avatar Jan 19 '24 00:01 AlexanderOMara

Found some samples:

/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/TrashIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/FullTrashIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/EjectMediaIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UsersFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DocumentsFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ApplicationsFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/PicturesFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/PublicFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SystemFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Everyone.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ServerApplicationsFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/LibraryFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SmartFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/BurnableFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GuestUserIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UtilitiesFolder.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericSharepoint.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MovieFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DownloadsFolder.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UserUnknownIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GroupFolder.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GroupIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DeveloperFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MusicFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/DesktopFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/SitesFolderIcon.icns
/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UserIcon.icns

Unfortunately iconutil does not appear to support unpacking (or packing?) the dark icons. It is technically possible to create them though, and the file format is fairly simple.

I played around with TrashIcon.icns and it does automatically adapt to the Light/Dark mode setting. The only deficiency I found was app icons in the Finder toolbar do not automatically switch like they do elsewhere in Finder, it does not change until a relaunch of Finder. Could be better, maybe a bug on Apple's part, but only an issue if you actually change your theme or set it to change automatically.

AlexanderOMara avatar Jan 20 '24 01:01 AlexanderOMara

I played around with TrashIcon.icns and it does automatically adapt to the Light/Dark mode setting.

Hi, Alexander. Could you explain how exactly I can get access or extract dark icons from TrashIcon.icns?

jsx97 avatar Apr 13 '24 20:04 jsx97

@jsx97 I don't know of any existing tools, but it's pretty simple. Find the chunk inside TrashIcon.icns named FD D9 2F A8, copy it, and overwrite FD D9 2F A8 with icns. That will make it a valid icns file. From there you can extract the individual icons from the dark icns file using a tool like iconutil.

AlexanderOMara avatar Apr 13 '24 20:04 AlexanderOMara

Many thanks. But I'm not sure I understand the first part. I have opened the file using the Hex Fiend editor and I was able to find the FD D9 2F A8 chunk. But how to overwrite it? When I type ic in the "Replace" field, it results in 0C, but then nothing happens. Typing ns after ic doesn't make any effect.

image

jsx97 avatar Apr 13 '24 20:04 jsx97

I'd recommend making a copy of the icns file, finding FD D9 2F A8, selecting all the hex on the left that comes before it, deleting it, then on the right side overwrite the first 4 bytes with icns, and save.

AlexanderOMara avatar Apr 13 '24 20:04 AlexanderOMara

Chiming in to say that this is how the icons appear in dark mode on macOS Sonoma. They look disabled, even though the app works as expected if I click on them.

Screenshot 2024-08-13 at 01 50 34

mjsarfatti avatar Aug 12 '24 23:08 mjsarfatti