Sublime Forum

Obtaining data through API


Is there a way to obtain data about the packages installed, themes & color schemes used etc via the sublime API ?



There’s not an API for obtaining that sort of information directly, but the API does allow you to introspect the list of all package resources, so you can do it that way if you like.

For example, you can gather the list of all Packages by checking the name of every known package resource:

def package_list():
    packages = set()
    for filename in sublime.find_resources(""):
        if filename.startswith("Packages/"):

    return packages

or as a one liner:

{f.split('/')[1] for f in sublime.find_resources("") if f.startswith("Packages/")}

Similarly if you wanted to find all of the color schemes, you can do the same thing by passing *.sublime-color-scheme and *.tmTheme to successive calls to sublime.find_resources(). In the specific case of color schemes, files with the same name combine even if the extension is different, so in that case you would need to strip the extension off the filename before adding it to the set.

A caveat of this (which likely does not matter) is that find_resources() only returns the resources that Sublime knows about, so it won’t show you things in packages that are currently in the list of ignored packages (for example, Vintage won’t show up in the list above for most people).

If you need information on packages that are ignored, then you need to gather the list of sublime-package files manually, along with the folders that appear in the Packages folder in order to know all of the packages, and look inside the files/folders directly to see what they contain.

There’s code that does this in OverrideAudit in lib/ but generally it’s not useful to know about things that could potentially be enabled but currently are not.

1 Like