Делаем чёрный не слишком чёрным#22
Merged
tonsky merged 1 commit intotonsky:masterfrom Apr 5, 2019
rodionovd:make-icon-template/#21
Merged
Делаем чёрный не слишком чёрным#22tonsky merged 1 commit intotonsky:masterfrom rodionovd:make-icon-template/#21
tonsky merged 1 commit intotonsky:masterfrom
rodionovd:make-icon-template/#21
Conversation
macOS will use this icon as a template when rendering, ignoring its actual pixel colors. Fixes #21
Owner
|
спаситель! господи! я часа четыре сегодня уже вожусь с разными вариантами приготовления png. СПАСИБО!!!!!!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Вы верно заметили, что в обычных приложениях, которые добавляют свои иконки в менюбар, у разработчиков есть возможность подсунуть macOS’у простую png’шку с выставленным в коде флагом isTemplate = true — и тот будет использовать её как «шаблон»: от картинки возьмёт только прозрачность пикселей, а цвет выберет на своё усмотрение.
Но у вас тут не приложение, поэтому непонятно, где выставлять этот флаг. Отвечаю: прямо в Info.plist. Этот флаг (TISIconIsTemplate) нигде не задокументирован, поэтому никаких гарантий, что он будет работать в будущем, нет 🤞
Результат:

P.S. Наверное, теперь можно убрать отдельные версии раскладки для Light и Dark тем — иконка нормально адаптируется под обе темы самостоятельно.