Skip to content

Commit

Permalink
Merge pull request #47 from JuliaPlots/sd/scompile
Browse files Browse the repository at this point in the history
make PlotUtils static compilable
  • Loading branch information
mkborregaard authored Oct 9, 2018
2 parents 966e7ff + f9fd858 commit 750daea
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/color_gradients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,30 @@ function clibrary(grad::Symbol)
_gradients[1] = grad
end

const _rainbowColors = [colorant"purple", colorant"blue", colorant"green", colorant"orange", colorant"red"]
const _testColors = [colorant"darkblue", colorant"blueviolet", colorant"darkcyan",colorant"green",
const _rainbowColors = RGBA{Float64}[colorant"purple", colorant"blue", colorant"green", colorant"orange", colorant"red"]
const _testColors = RGBA{Float64}[colorant"darkblue", colorant"blueviolet", colorant"darkcyan",colorant"green",
darken(colorant"yellow",0.3), colorant"orange", darken(colorant"red",0.2)]

const misc = ColorLibrary(Dict(:default => :sequential, :sequential => :heat, :diverging => :bluesreds), Dict(
:reds => [colorant"lightpink", colorant"darkred"],
:greens => [colorant"lightgreen", colorant"darkgreen"],
:redsblues => [colorant"darkred", RGB(0.8,0.85,0.8), colorant"darkblue"],
:bluesreds => [colorant"darkblue", RGB(0.8,0.85,0.8), colorant"darkred"],
:heat => [colorant"lightyellow", colorant"orange", colorant"darkred"],
:grays => [RGB(.05,.05,.05),RGB(.95,.95,.95)],
:rainbow => _rainbowColors,
:lightrainbow => map(lighten, _rainbowColors),
:darkrainbow => map(darken, _rainbowColors),
:darktest => _testColors,
:lighttest => map(c -> lighten(c, 0.3), _testColors),
))


register_color_library(:misc, misc)

const _gradients = [:Plots]

function __init__()
misc = ColorLibrary(Dict(:default => :sequential, :sequential => :heat, :diverging => :bluesreds), Dict(
:reds => [colorant"lightpink", colorant"darkred"],
:greens => [colorant"lightgreen", colorant"darkgreen"],
:redsblues => [colorant"darkred", RGB(0.8,0.85,0.8), colorant"darkblue"],
:bluesreds => [colorant"darkblue", RGB(0.8,0.85,0.8), colorant"darkred"],
:heat => [colorant"lightyellow", colorant"orange", colorant"darkred"],
:grays => [RGB(.05,.05,.05),RGB(.95,.95,.95)],
:rainbow => _rainbowColors,
:lightrainbow => map(lighten, _rainbowColors),
:darkrainbow => map(darken, _rainbowColors),
:darktest => _testColors,
:lighttest => map(c -> lighten(c, 0.3), _testColors),
))
register_color_library(:misc, misc)
end

"""
clibraries()
Expand Down

0 comments on commit 750daea

Please sign in to comment.