-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expose syntax theme colors to julia? #15
Comments
I don't see why this wouldn't be possible. One of the obstructions would be that I don't think this information could be gotten directly via Juno.jl, so it would require an Atom dependency. But Juno.jl could export a macro which will error when Atom isn't installed, but gives this information when it is (by simply making the expression which calls that right Atom.jl function). Then it would just require a Juno.jl dependency for PlotThemes.jl (which is a light dependency) and work on @pkofod's side to integrate it. |
For the record, I don't mind adding |
Thanks @pkofod. I don't mind making the PR on PlotThemes if I can work out how to get this info from Atom. Would be cool (I think?) to also use the Atom font for axis labels etc. |
Another way to do this without dependencies is to use You can combine this by checking This route wouldn't require Juno.jl exposing anything through a macro (it works for different reasons, but gets to the same endpoint). |
I think this should be doable – but I'm not yet sure how to do the appropriate reflection inside Atom. Will look into it. |
Hi, I still think it would be cool to do this and wouldn't mind putting it together on the PlotThemes side (though I am not sure it is still viable to depend on Juno, as PlotThemes is now a Plots dependency). Maybe a conditional dependency approach is viable? |
This is possible with
I chose those selectors based on what OhMyREPL uses so we can generate a theme for that, but you can in principle query every syntax color you want (as long as you know the appropriate selector, obviously). |
@mkborregaard if you want to use this, it should be pretty easy to do it with requires to avoid the dependency. |
And if anyone wants to use this to create an OhMyREPL theme: using OhMyREPL, Crayons
using OhMyREPL: Passes.SyntaxHighlighter
function generateOMRtheme()
cs = SyntaxHighlighter.ColorScheme()
colors = Juno.syntaxcolors()
SyntaxHighlighter.symbol!(cs, Crayon(foreground = colors["symbol"]))
SyntaxHighlighter.comment!(cs, Crayon(foreground = colors["comment"]))
SyntaxHighlighter.string!(cs, Crayon(foreground = colors["string"]))
SyntaxHighlighter.call!(cs, Crayon(foreground = colors["funccall"]))
SyntaxHighlighter.op!(cs, Crayon(foreground = colors["operator"]))
SyntaxHighlighter.keyword!(cs, Crayon(foreground = colors["keyword"]))
SyntaxHighlighter.text!(cs, Crayon(foreground = colors["variable"]))
SyntaxHighlighter.macro!(cs, Crayon(foreground = colors["macro"]))
SyntaxHighlighter.function_def!(cs, Crayon(foreground = colors["funcdef"]))
SyntaxHighlighter.argdef!(cs, Crayon(foreground = colors["type"]))
SyntaxHighlighter.number!(cs, Crayon(foreground = colors["number"]))
SyntaxHighlighter.add!("Atom", cs)
OhMyREPL.colorscheme!("Atom")
return cs
end
generateOMRtheme() Can't test that right now though because I'm on windows :( |
Should we be loading that by default when OhMyREPL is present? |
Awesome!!! 💯 💖 |
Hi, I saw that @pkofod have been doing some themes for Plots.jl, among them a dark theme that would fit well with Atom I'm sure (PlotThemes.jl). I had the idea that it would be cool to have a Plots color scheme for use specifically in Atom that automatically selected colors based on Atom's current syntax color theme. Is that less file exposed by Atom in some way (or could it be)? Thanks!
The text was updated successfully, but these errors were encountered: