IssueRaiser

[theming] Access theme's colors programmatically

I think we should add support for accessing theme's colors programmatically. For instance let's take as an example the popular [OneDark Pro](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json) theme, I'd like to access colors defined under [tokenColors](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json#L67). My use case: I'm making an extension that decorates some tokens, and I'd like them to have the same color that comments have in my theme, the problem is that the regex I use to find those tokens depends on some configurable value, so I cannot pre-compute it in advance and just put it in a `.tmLanguage` file. It's already possible to somehow access colors defined under the [colors](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json#L4) key, via something like `new vscode.ThemeColor ( 'activityBar.background' )`, adding support for this sounds like a useful generalization to me. What do you think?

Posted by fabiospampinato on Aug 19, 2017, 12:53 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.4,500 issues0 comments

support (Software)

[theming] Access theme's colors programmatically

fabiospampinatoAug 19, 2017, 12:53 AM

I think we should add support for accessing theme's colors programmatically. For instance let's take as an example the popular [OneDark Pro](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json) theme, I'd like to access colors defined under [tokenColors](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json#L67). My use case: I'm making an extension that decorates some tokens, and I'd like them to have the same color that comments have in my theme, the problem is that the regex I use to find those tokens depends on some configurable value, so I cannot pre-compute it in advance and just put it in a `.tmLanguage` file. It's already possible to somehow access colors defined under the [colors](https://github.com/Binaryify/OneDark-Pro/blob/master/themes/OneDark-Pro.json#L4) key, via something like `new vscode.ThemeColor ( 'activityBar.background' )`, adding support for this sounds like a useful generalization to me. What do you think?

Comments (0)

No comments yet. Start the discussion.

Comment on this issue