From f9fd8588cb3274d551fe19b6f336720111eb1e35 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Sat, 25 Aug 2018 00:11:02 +0200 Subject: [PATCH] make PlotUtils static compilable --- src/color_gradients.jl | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/src/color_gradients.jl b/src/color_gradients.jl index 47f3439..e17937b 100644 --- a/src/color_gradients.jl +++ b/src/color_gradients.jl @@ -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()