Skip to content

Commit

Permalink
Merge pull request #26 from pfitzseb/sp/juno
Browse files Browse the repository at this point in the history
get Juno theme colors from Atom syntax theme
  • Loading branch information
daschw authored Mar 1, 2018
2 parents d024efe + 98d20e1 commit 380837d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
julia 0.6
PlotUtils 0.4
Requires
6 changes: 3 additions & 3 deletions src/PlotThemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ __precompile__(true)

module PlotThemes

using PlotUtils
using PlotUtils, Requires

export
add_theme, palette
Expand Down Expand Up @@ -49,10 +49,10 @@ include("solarized.jl")
include("sand.jl")
include("lime.jl")
include("orange.jl")
include("juno.jl")
include("wong.jl")
include("juno.jl")

function __init__()
@init begin
# need to do this here so PlotUtils picks up the change
for (s,thm) in _themes
add_theme(s, thm)
Expand Down
31 changes: 30 additions & 1 deletion src/juno.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ juno_palette = [
colorant"#3f9778", # green
colorant"#005D7F" # blue
]

juno_bg = colorant"#282C34"

_themes[:juno] = PlotTheme(
Expand All @@ -15,6 +16,34 @@ _themes[:juno] = PlotTheme(
fgguide = colorant"#9EB1BE",
fglegend = colorant"#9EB1BE",
palette = expand_palette(juno_bg, juno_palette; lchoices=linspace(57,57,1),
cchoices=linspace(100,100,1)),
cchoices=linspace(100,100,1)),
gradient = cgrad(:fire).colors
)

@require Juno begin
if Juno.isactive()
colors = Juno.syntaxcolors()
colors = Dict(k => parse(Colorant, "#"*hex(colors[k], 6)) for (k, v) in colors)

juno_palette = unique([colors[k] for k in keys(colors) if k ["background", "variable"]])

colvec = sort(HSV.(juno_palette), lt=(a,b) -> a.h < b.h)
filter!(c -> c.s > 0.5*mean(c -> c.s, colvec), colvec)
grad = Vector{eltype(colvec)}(0)
for i = 1:length(colvec)-1
append!(grad, linspace(colvec[i], colvec[i+1]))
end

_themes[:juno] = PlotTheme(
bg = colors["background"],
bginside = colors["background"],
fg = colors["variable"],
fgtext = colors["variable"],
fgguide = colors["variable"],
fglegend = colors["variable"],
palette = expand_palette(colors["background"], juno_palette; lchoices=linspace(57,57,1),
cchoices=linspace(100,100,1)),
gradient = grad
)
end
end

0 comments on commit 380837d

Please sign in to comment.