Skip to content
This repository was archived by the owner on Jul 13, 2021. It is now read-only.

Commit cccabc2

Browse files
authored
Merge pull request #400 from JuliaPlots/as/colormapalpha-1
Add a dispatch for `(colormap::Symbol, alpha::Real)`
2 parents 3c32864 + c9c0cb6 commit cccabc2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/conversions.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,15 @@ function convert_attribute(cs::Union{Tuple, Pair}, ::key"colormap", n::Int=2)
777777
return to_colormap([to_color.(cs)...], n)
778778
end
779779

780+
function convert_attribute(cs::Tuple{<: Union{Symbol, AbstractString}, Real}, ::key"colormap", n::Int=30)
781+
return RGBAf0.(to_colormap(cs[1]), cs[2]) # We need to rework this to conform to the backend interface.
782+
end
783+
784+
function convert_attribute(cs::NamedTuple{(:colormap, :alpha, :n), Tuple{Union{Symbol, AbstractString}, Real, Int}}, ::key"colormap")
785+
return RGBAf0.(to_colormap(cs.colormap, cs.n), cs.alpha)
786+
end
787+
788+
780789
to_colormap(x, n::Integer) = convert_attribute(x, key"colormap"(), n)
781790

782791
"""

0 commit comments

Comments
 (0)