Skip to content

Commit

Permalink
Merge pull request #36 from daschw/colorgradient
Browse files Browse the repository at this point in the history
Replace "gradient" with "colorgradient" to avoid confusion with Plots' quiver alias "gradient".
  • Loading branch information
daschw authored Nov 27, 2019
2 parents 11d1666 + fcf69a3 commit 3a054ea
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 17 deletions.
7 changes: 4 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name = "PlotThemes"
uuid = "ccf2f8ad-2431-5c83-bf29-c5338b663b6a"
version = "0.4.0"
version = "1.0.0"

[deps]
PlotUtils = "995b91a9-d308-5afd-9ec6-746e21dbc043"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
PlotUtils = "≥ 0.5.0"
julia = "≥ 0.7.0"
PlotUtils = "0.5, 0.6"
Requires = "0.5"
julia = "0.7, 1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ Themes can be previewed using `Plots.showtheme(thm::Symbol)`:

## Contributing
A theme specifies default values for different Plots [attributes](http://docs.juliaplots.org/attributes/).
At the moment these are typically colors, palettes and gradients, but any Plots attribute can be controlled by a theme in general.
At the moment these are typically colors, palettes and colorgradients, but any Plots attribute can be controlled by a theme in general.
PRs for new themes very welcome! Adding a new theme (e.g. `mytheme`) is as easy as adding a new file (mytheme.jl) that contains at least the following line:
```julia
_themes[:mytheme] = PlotTheme(; kwargs...)
```
The keyword arguments can be any collection of Plots attributes.
The keyword arguments can be any collection of Plots attributes plus a colorgradient keyword argument.
4 changes: 2 additions & 2 deletions src/PlotThemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ const _themes = Dict{Symbol, PlotTheme}(:default => PlotTheme())
gradient_name(s::Symbol) = s == :default ? :inferno : Symbol(s, "_grad")

function add_theme(s::Symbol, thm::PlotTheme)
if haskey(thm.defaults, :gradient)
PlotUtils.register_gradient_colors(gradient_name(s), thm.defaults[:gradient], :misc)
if haskey(thm.defaults, :colorgradient)
PlotUtils.register_gradient_colors(gradient_name(s), thm.defaults[:colorgradient], :misc)
end
_themes[s] = thm
end
Expand Down
2 changes: 1 addition & 1 deletion src/dark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ _themes[:dark] = PlotTheme(
fgguide = colorant"#FFFFFF",
fglegend = colorant"#FFFFFF",
palette = expand_palette(dark_bg, dark_palette; lchoices = [57], cchoices = [100]),
gradient = cgrad(:fire).colors
colorgradient = cgrad(:fire).colors
)
2 changes: 1 addition & 1 deletion src/juno.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ _themes[:juno] = PlotTheme(
fgguide = colorant"#9EB1BE",
fglegend = colorant"#9EB1BE",
palette = expand_palette(juno_bg, juno_palette; lchoices = [57], cchoices = [100]),
gradient = cgrad(:fire).colors
colorgradient = cgrad(:fire).colors
)
2 changes: 1 addition & 1 deletion src/juno_smart.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ if Juno.isactive()
fgguide = colors["variable"],
fglegend = colors["variable"],
palette = expand_palette(colors["background"], juno_palette; lchoices = [57], cchoices = [100]),
gradient = grad
colorgradient = grad
)
end
2 changes: 1 addition & 1 deletion src/lime.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ _themes[:lime] = PlotTheme(
fgguide = lime_palette[2],
fglegend = lime_palette[2],
palette = expand_palette(black, lime_palette[1:4]),
gradient = cgrad(:viridis).colors
colorgradient = cgrad(:viridis).colors
)
2 changes: 1 addition & 1 deletion src/orange.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ _themes[:orange] = PlotTheme(
fgguide = orange_palette[2],
fglegend = orange_palette[2],
palette = expand_palette(black, orange_palette[1:4]),
gradient = cgrad(:viridis).colors
colorgradient = cgrad(:viridis).colors
)
2 changes: 1 addition & 1 deletion src/sand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ _themes[:sand] = PlotTheme(
fgguide = colorant"#725B61",
fglegend = colorant"#725B61",
palette = expand_palette(sand_bg, sand_palette),
gradient = cgrad(:dense).colors
colorgradient = cgrad(:dense).colors
)
4 changes: 2 additions & 2 deletions src/solarized.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ _themes[:solarized] = PlotTheme(
fgguide = _solarized_colors[:base01],
fglegend = _solarized_colors[:base01],
palette = expand_palette(_solarized_colors[:base03], [_solarized_colors[c] for c in _solarized_palette]),
gradient = cgrad(:YlOrRd_r).colors
colorgradient = cgrad(:YlOrRd_r).colors
)

_themes[:solarized_light] = PlotTheme(
Expand All @@ -39,5 +39,5 @@ _themes[:solarized_light] = PlotTheme(
fgguide = _solarized_colors[:base1],
fglegend = _solarized_colors[:base1],
palette = expand_palette(_solarized_colors[:base3], [_solarized_colors[c] for c in _solarized_palette]),
gradient = cgrad(:YlOrRd_r).colors
colorgradient = cgrad(:YlOrRd_r).colors
)
4 changes: 2 additions & 2 deletions src/wong.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const wong_palette = [

_themes[:wong] = PlotTheme(
palette = expand_palette(colorant"white", wong_palette; lchoices = [57], cchoices = [100]),
gradient = cgrad(:viridis).colors,
colorgradient = cgrad(:viridis).colors,
)

_themes[:wong2] = PlotTheme(
palette = expand_palette(colorant"white", [RGB(0,0,0); wong_palette]; lchoices = [57], cchoices = [100]),
gradient = cgrad(:viridis).colors,
colorgradient = cgrad(:viridis).colors,
)

2 comments on commit 3a054ea

@daschw
Copy link
Member Author

@daschw daschw commented on 3a054ea Nov 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/5929

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.0.0 -m "<description of version>" 3a054ea260f1a2f9c1a89854362156b9c4ae4ada
git push origin v1.0.0

Please sign in to comment.