Extending core themes?


#1

Continuing the discussion from How do I write theme specific styles:


As the original post is asking, we should be able to override theme styles without changing the source.

It’s simple if we’re overriding custom themes (since they reside in ~/.atom/packages).

child-theme/index.less

@import "~/.atom/packages/parent-theme/index.less";

// Override parent styles.

But if we want to override any of the core themes which are currently bundled into Atom.app, we can’t assume the user has the file installed at a specific location, which makes importing stylesheets a little tricky.

I’ve hacked together this bit of LESS just to figure out where the user has Atom installed (with some degree of certainty):

@coreThemeName: "atom-dark-syntax";
@windowPath: `window.location`;
@atomPath: `"@{windowPath}".slice("@{windowPath}".indexOf('file://')+7, "@{windowPath}".indexOf('Atom.app')) + 'Atom.app'`;
@coreThemeDir: "@{atomPath}/Contents/Resources/app/node_modules";
@coreTheme: "@{coreThemeDir}/@{coreThemeName}";

Not very pretty. :frowning:

Are there any plans to officially support extending core themes?


#2

You can fork the syntax package, it’s easier to edit.


#3

Forking themes works fine in practice. The main thing I’d like to see is a way to keep things DRY instead of having a bunch of duplicate files floating around. It seems like something that could be useful for people that might want to have a base theme and multiple sub themes.

Updating the parent theme would have all the changes automatically applied to all the children themes instead of having to go through each theme and merge in changes.