SublimeText/AFileIcon

[Question] Black icons in Sublime's "Adaptive" theme?

we3geeks opened this issue · 15 comments

In the release notes for v3.2.1, it notes a fix for black icons in the "Adaptive" theme, but I'm seeing that now. Did that fix get lost somehow in the repo transition a couple years ago?

Package Control shows that I have v3.4.7; I'm using Sublime Text Dev Channel, Build 3210 and definitely seeing black icons when using the "Adaptive" theme:

image

When using Sublime's "Default" theme, the icons are colored.

The "color": ... in A File Icon.sublime-settings is used to render monochome icons tinted with the specified color. If the setting is empty colored ones are rendered.

If the "color" value is malformed the icon's are rendered black.

A File Icon does not automatically apply icon colors for adaptive themes, but you should be able to use --...ish colors.

Example: "color": "var(--redish)",

Available colors

--background
--foreground
--accent
--bluish
--cyanish
--greenish
--orangish
--pinkish
--purplish
--redish
--yellowish

@deathaxe Thanks for the follow-up on this.

I have confirmed that the "color" attribute in the settings file is empty. With Sublime's "Adaptive" theme, am I reading your response correctly that the icons won't be colored unless I use one of the ...ish values?

A File Icons ships pre-tinted and monochrome icons.

If the "color" setting doesn't exist or is empty, the pre-tinted icons are used. Any icon type may have a different color then, which is not related to the selected theme or color scheme.

If e.g. "color": "green" is set in A File Icons.sublime-settings the monochrome icons are used, which are white by default. Patch files are created for each installed theme with rules how to tint the icons. All icons in the sidebar use the same fixed color (e.g.: "green") then. If you want the color to adapt to your color theme instead, you would need to use one of the predefined --...ish colors. Their color value is either computed by ST or predefined by the color scheme author.

Did you install A File Icon from Package Control or did you clone it?

I guess you revealed a quite old and major issue with creating the icon overlay directory from a packed A File Icon.sublime-package, which may cause you to see outdated icons.

Installed via Package Control yesterday, and "color" exists and is empty.

Interesting. Did the same to reproduce your issue and didn't see any icons at all.

Pushed a new version with a fix for icon unpacking from sublime-packages. Once Package Control's crawler picked up the file you should be able to update. Let's see whether it already fixes your issue.

Thanks! I will keep an eye out and follow up.

Looks like the Package Control crawler found the new v3.4.8 release, but I still have monochrome black icons under the "Adaptive" theme and colored icons under the "Default" theme... :/

You should find an Adaptive.sublime-theme file in the Packages/zzz A File Icon zzz/patches/general/multi/ but not in Packages/zzz A File Icon zzz/patches/general/single/ if "color" is empty.

The icon tinting is a global setting. If there are differences depending on the active theme, I'd guess there is another Adaptive.sublime-theme file in the User package, which contains rules to tint the sidebar icons.

Confirmed: In ~/Library/Application Support/Sublime Text 3/Packages/zzz A File Icon zzz/patches/general/multi/, I see Adaptive.sublime-theme and Default.sublime-theme. Those files do not exist under patches/general/single/. Both folders contains lots of .png files for the icons at different resolutions. The icons under multi/ are colored, while those under single/ appear to be monochrome. The two .sublime-theme files are identical, according to diff and contain the following:

[{"content_margin": [8, 8], "class": "icon_file_type", "layer0.opacity": 0.75}, {"parents": [{"attributes": ["hover"], "class": "tree_row"}], "class": "icon_file_type", "layer0.opacity": 0.5}, {"parents": [{"attributes": ["selected"], "class": "tree_row"}], "class": "icon_file_type", "layer0.opacity": 1.0}]

I can't find any other .sublime-theme files anywhere on my system, but that's probably more a matter of me not knowing where to look, as it is clear that something in the Adaptive theme is over-riding the icon colors and not doing so in the Default theme.

Looks as expected. This is how A File Icon assigns the icons.

Basically you could search for an Adaptive.sublime-theme file in your ~/Library/Application Support/Sublime Text 3/Packages directory. All such files, ST can find are merged to one single theme. It may even be located within a *.sublime-package file.

The easiest way to do so might be by running sublime.find_resources("Adaptive.sublime-theme") via console.

That's what it looks like on my PC.

>>> sublime.find_resources("Adaptive.sublime-theme")
['Packages/Theme - Default/adaptive/Adaptive.sublime-theme', 'Packages/zzz A File Icon zzz/patches/general/multi/Adaptive.sublime-theme', 'Packages/User/Adaptive.sublime-theme']

From my system, which looks a little different from yours:

>>> sublime.find_resources("Adaptive.sublime-theme")
['Packages/Theme - Default/adaptive/Adaptive.sublime-theme', 'Packages/zzz A File Icon zzz/patches/general/multi/Adaptive.sublime-theme']

I found the base theme, and I don't know anything about Sublime theming, so I can't tell what in there is shifting the icons to monochrome. From what you've provided, It seems like it is working as expected, but perhaps just not as I would like it to. I'll either go with the Adaptive theme and the monochrome icons or switch back to the Default theme (which isn't hugely different from Adaptive) in order to get colored icons.

Thanks again for your help.

Very strange. From what I can see, it should work fine.

I've got two Macs, and both are showing this same behavior. If there's anything else I can look at or try on my end that might help figure out what's behind this, ping me.

Found the issue.

The Adaptive theme tints icons black if the color scheme is light, which applies to my colored icons as well. Need to delete the tint via patch.

Just saw v3.4.9... and it works!

Thanks much for tracking this down and fixing it so quickly!