Sublime Forum

Sidebar icons in themes

#10

Maybe. There might be some dynamics at work here that I don’t understand yet.

I tired to just copy the files to the theme, and then alter the scope, but no dice.

I plan on trying to create my own file types as well, maybe Icons (something).tmPreferences and use a different icon name in it. I may try this later today.

0 Likes

#11

Okay, this actually worked:

create a file Icon (Python).tmPreferences

[code]<?xml version="1.0" encoding="UTF-8"?>

scope source.python settings icon file_type_python [/code]

So a theme doesn’t have to override the defaults. You can probably just create a bunch of your own and use those instead.

0 Likes

Sublime text icons
How change of icons for images in sidebar?
#12

I wonder if a plugin dynamically change these based on if the file is dirty or not?

0 Likes

#13

Maybe if you physically control the tmPreference file and overwrite the original. I have found that I can create new file types, but I can’t override text, source, or markup. I can change the theme icon, but not alter the tmPreference files for the defaults.

0 Likes

#14

Does anyone have dark-theme compatible filetype icons they can share by chance? Also, if someone has the respective settings file they use to use the new light-color file-type icons they could also share that would be great.

0 Likes

#15

I use this for now: github.com/facelessuser/Unnamed … ster/icons. I just colored the insides. I plan on redoing them for my personal use, but this is good enough for now. Didn’t style the spinners lighter, but I don’t actually ever see them now that I have the proper icons in my theme.

0 Likes

#16

It looks amazing after replacing the default icons:

0 Likes

#17

Customising the icons:

  1. If you’re making a custom theme, place files with the appropriate names (file_type_default.png, file_type_source.png, file_type_text.png, file_type_markup.png, file_type_image.png, file_type_binary.png) either next to the .sublime-theme file, or within an icons/ subdirectory.

  2. If you want a custom icon for a particular programming language, then as facelessuser mentioned, you need to create a tmPreferences file that first associates the scope with an icon name (the above example is spot on for Python). You then need to create an actual icon for that name, such as file_type_python.png. The search location for icons is:

/file_type_python.png
/icons/file_type_python.png
file_type_python.png

This means that if you’re making a package for a specific programming language, then you can provide a sidebar icon for those files, while still allowing custom themes to override it.

0 Likes

Sublime Text 3 file icons in sidebar
Theming ST is too hard. Theming documentation collective effort
#18

jps, this looks great, thanks for the update! Is there any way to change the icons from the Python API? That would be really nice for example to color files and folders based on git status (e.g. Green icon for a new file).

0 Likes

#19

Unfortunately there’s no API to control sidebar icons etc as of 3062

0 Likes

#20

Still great… :smile:
Maybe someday. This coloring would work best with svg icons that can be dynamically styled but that might be a whole different thing.

0 Likes

#21

[quote=“weslly”]It looks amazing after replacing the default icons:

http://i.imgur.com/rMLxhE7.png[/quote]

Would you mind sharing your icons and the relevant tmPreferences? :smile:

0 Likes

#22

[quote=“jbrooksuk”]

Would you mind sharing your icons and the relevant tmPreferences? :smile:[/quote]

I didn’t even use a .tmPreferences file :smiley:

Create a “Theme - Default” folder in your Packages folder (if you don’t have one) and put a folder called “icons” inside it with the new icons:

cl.ly/311m1R3o120n

I used the Fugue icons set. I didn’t add the retina size icons, but you can find 32x32 versions for some icons on the set.

0 Likes

#23

I figured it was Fugue and went ahead and made my own version, non-retina too.

Thanks for clarifying!

0 Likes

#24

[quote=“jps”]Customising the icons:

  1. If you’re making a custom theme, place files with the appropriate names (file_type_default.png, file_type_source.png, file_type_text.png, file_type_markup.png, file_type_image.png, file_type_binary.png) either next to the .sublime-theme file, or within an icons/ subdirectory.

  2. If you want a custom icon for a particular programming language, then as facelessuser mentioned, you need to create a tmPreferences file that first associates the scope with an icon name (the above example is spot on for Python). You then need to create an actual icon for that name, such as file_type_python.png. The search location for icons is:

/file_type_python.png
/icons/file_type_python.png
file_type_python.png

This means that if you’re making a package for a specific programming language, then you can provide a sidebar icon for those files, while still allowing custom themes to override it.[/quote]

Hi Jon, great work on the icon changes.

I’m a bit stuck with leveraging the new file icon functionality for Soda Theme. Is it possible to allow themes to define the folder where icons are loaded from within the theme context?

With Soda Theme, the light and dark versions of the theme are together, and normally this is fine for assets because their paths are specified in the theme files and kept in separate sub-directories.

With the current implementation for the sidebar icons, the icon files can only exist at the top level theme directory in a single icons folder, or alongside the root level theme files. This means there doesn’t appear to be a way to specify folders for different light and dark icons.

Do you have any ideas on how to go about this? As a suggestion, could the theme rule for icon_file_type allow setting the leading path?

For example:

// Sidebar file icons
{
    "class": "icon_file_type",
    // layer0.texture is filled in by code with the relevant icon name
    "layer0.texture": "Theme - Soda/Soda Light/icons",
    "layer0.opacity": 1.0,
    "content_margin": [8, 8]
},
0 Likes

#25

{ "class": "icon_file_type", "attributes": "plugin-induced-foo"], layer0.tint": [49, 52, 55] }
would make my week (eg with hg-modified)

0 Likes

#26

Could someone please post their .sublime-theme file they use in their *‘Packages/Theme - Default’ * folder? Maybe, someone could just package up their entire *‘Packages/Theme - Default’ * folder (including their respective .sublime-theme file), that would be great.

0 Likes

#27

Jon, another suggestion would be to allow sidebar icons to be specified by extension as well as scope. Scope is fine, but there are a number of file extensions that aren’t included by default in tmLanguage files. For this reason, plugins like ApplySyntax have popped up to analyze file extension and set the correct syntax for such files. It is a pain to have to update different tmLanguages to automatically get the correct syntax to open, so defining rules in one place with ApplySyntax, this becomes much less painful. But these file, (files whose syntax is set by an external plugin) don’t get the correct icon due to the post processing and setting of the file via an external plugin. Being able to just specify extensions would make this much easier.

For instance. I see you included a binary icon, but currently when a binary view loads, it loads hex data, but the syntax is plain text. Basically, it is impossible to detect binary files with the current system, which I am sure is why no files icons show up as binary. I am pretty sure you plan on using the binary list in the settings file to eventually target binary files, but it would be nice to have a similar functionality for all file type icons.

0 Likes

#28

I like the specified by extension idea!

I’ve modified the Soda Light theme to support sidebar icons, and also created some custom icons based on Fugue and the Espresso icons.

Normal size:

Retina size:

0 Likes

#29

Thank you for the Sublime Theme mod! However my folders are still ugly and I get the spinner until they get expanded:

Ideas?

Does this forum still doesn’t support email notifications?

0 Likes