Skip to content
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

change default colors #167

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches: [master]
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "PlotUtils"
uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043"
version = "1.4.1"
version = "2.0.0"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
Expand Down
2 changes: 1 addition & 1 deletion src/PlotUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export optimize_ticks, optimize_datetime_ticks

include("ticks.jl")

const _default_colorscheme = generate_colorscheme()
const _default_colorscheme = ColorSchemes.colorschemes[:seaborn_colorblind]

if VERSION ≥ v"1.8.0"
@compile_workload begin
Expand Down
5 changes: 3 additions & 2 deletions src/colorschemes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function cgrad(
end

function cgrad(colors, args...; kwargs...)
colors ≡ :default && (colors = :inferno)
colors ≡ :default && (colors = DEFAULT_COLOR_GRADIENT[])
cgrad(get_colorscheme(colors), args...; kwargs...)
end

Expand Down Expand Up @@ -335,7 +335,7 @@ is_colorscheme(sym) =
sym ∈ keys(COLORSCHEME_ALIASES) ||
sym ∈ keys(MISC_COLORSCHEMES)

const DEFAULT_COLOR_GRADIENT = Ref(cgrad(ColorSchemes.colorschemes[:inferno]))
const DEFAULT_COLOR_GRADIENT = Ref(cgrad(ColorSchemes.colorschemes[:haline]))

## Compat

Expand Down Expand Up @@ -422,6 +422,7 @@ const TEST_COLORS = RGBA{Float64}[
]

const MISC_COLORSCHEMES = Dict{Symbol,ColorScheme}(
:plots_v1 => generate_colorscheme(),
:blues => ColorScheme(RGBA{Float64}[colorant"lightblue", colorant"darkblue"]),
:reds => ColorScheme(RGBA{Float64}[colorant"lightpink", colorant"darkred"]),
:greens => ColorScheme(RGBA{Float64}[colorant"lightgreen", colorant"darkgreen"]),
Expand Down
39 changes: 29 additions & 10 deletions test/downstream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Pkg, PlotUtils, Test
LibGit2 = Pkg.GitTools.LibGit2
TOML = Pkg.TOML

failsafe_clone_checkout(path, url) = begin
failsafe_clone_checkout(path, url; version = :stable) = begin
local repo
for i ∈ 1:6
try
Expand All @@ -27,10 +27,13 @@ failsafe_clone_checkout(path, url) = begin
end
@assert isfile(versions)

stable = maximum(VersionNumber.(keys(TOML.parse(read(versions, String)))))
tag = LibGit2.GitObject(repo, "v$stable")
hash = string(LibGit2.target(tag))
LibGit2.checkout!(repo, hash)
if version === :stable
stable = maximum(VersionNumber.(keys(TOML.parse(read(versions, String)))))
vrs = "v$stable"
tag = LibGit2.GitObject(repo, vrs)
hash = string(LibGit2.target(tag))
LibGit2.checkout!(repo, hash)
end
nothing
end

Expand All @@ -50,11 +53,27 @@ end
develop_stable_Plots() = begin
tmpd = mktempdir()
Plots_jl = joinpath(tmpd, "Plots.jl")

failsafe_clone_checkout(Plots_jl, "https://github.com/JuliaPlots/Plots.jl")
fake_supported_version!(Plots_jl)

Pkg.develop(path = Plots_jl)
PlotThemes_jl = joinpath(tmpd, "PlotThemes.jl")
PlotsBase_jl = joinpath(Plots_jl, "PlotsBase")
RecipesPipeline_jl = joinpath(Plots_jl, "RecipesPipeline")

failsafe_clone_checkout(
Plots_jl,
"https://github.com/JuliaPlots/Plots.jl",
version = :default,
)
fake_supported_version!(RecipesPipeline_jl)
fake_supported_version!(PlotsBase_jl)

failsafe_clone_checkout(PlotThemes_jl, "https://github.com/JuliaPlots/PlotThemes.jl")
fake_supported_version!(PlotThemes_jl)

Pkg.develop([
PackageSpec(path = Plots_jl),
PackageSpec(path = RecipesPipeline_jl),
PackageSpec(path = PlotsBase_jl),
PackageSpec(path = PlotThemes_jl),
])
Pkg.status(["PlotUtils", "Plots"])
nothing
end
Expand Down
Loading