Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive light and dark mode icons? #211

Open
AlexanderOMara opened this issue Jan 19, 2024 · 5 comments
Open

Adaptive light and dark mode icons? #211

AlexanderOMara opened this issue Jan 19, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@AlexanderOMara
Copy link

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 AlexanderOMara added the enhancement New feature or request label Jan 19, 2024
@AlexanderOMara AlexanderOMara changed the title Adaptive dark and light mode icns icons? Adaptive light and dark mode icons? Jan 19, 2024
@AlexanderOMara
Copy link
Author

AlexanderOMara commented Jan 20, 2024

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.

@jsx97
Copy link

jsx97 commented Apr 13, 2024

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?

@AlexanderOMara
Copy link
Author

AlexanderOMara commented Apr 13, 2024

@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.

@jsx97
Copy link

jsx97 commented Apr 13, 2024

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

@AlexanderOMara
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants