Skip to content

Commit

Permalink
fix union{} ambiguity (#527)
Browse files Browse the repository at this point in the history
  • Loading branch information
Roger-luo committed Dec 13, 2022
1 parent b550b7b commit 1a153e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ docs/build/
docs/site/
.DS_Store
/docs/Manifest.toml
Manifest.toml
8 changes: 4 additions & 4 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ end


function Base.show(io::IO, mime::MIME"image/svg+xml", cs::AbstractVector{T};
max_swatches::Integer=0) where T <: Color
max_swatches::Integer=0) where {Union{} <: T <: Color}
mat = Base.ReshapedArray(cs, (1, length(cs)), ())
show(io, mime, mat, max_swatches=max_swatches)
end

function Base.show(io::IO, mime::MIME"image/svg+xml",cs::AbstractVector{T};
max_swatches::Integer=0) where T <: TransparentColor
max_swatches::Integer=0) where {Union{} <: T <: TransparentColor}

# use random id to avoid id collision when the SVG is embedded inline
id = "pat_" * string(rand(UInt32), base=62)
Expand Down Expand Up @@ -97,7 +97,7 @@ end


function Base.show(io::IO, mime::MIME"image/svg+xml", cs::AbstractMatrix{T};
max_swatches::Integer=0) where T <: Color
max_swatches::Integer=0) where {Union{} <: T <: Color}
m, n = size(cs)
actual_max_swatches = max_swatches > 0 ? max_swatches : default_max_swatches
if m * n > actual_max_swatches
Expand Down Expand Up @@ -151,7 +151,7 @@ end


function show_strokes(io::IO, mime::MIME"image/svg+xml", cs::AbstractMatrix{T};
max_swatches::Integer=0) where T <: Color
max_swatches::Integer=0) where {Union{} <: T <: Color}
m, n = size(cs)
actual_max_swatches = max_swatches > 0 ? max_swatches : default_max_swatches
# When `max_swatches` is specified, the following warning is suppressed.
Expand Down

0 comments on commit 1a153e3

Please sign in to comment.