Skip to content

Commit

Permalink
Informative error message on spurious broadcast.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkborregaard committed Aug 16, 2018
1 parent e0583ef commit ac7e048
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/color_gradients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ end

# if the values aren't passed in, pass to the cgrad method for processing
ColorGradient(colors; kw...) = cgrad(colors; kw...)

Base.length(::ColorGradient) = @error "length(::ColorGradient) was called, possibly due to a spuriously broadcast call to a function accepting ColorGradient (e.g. PlotUtils.plot_color). Please open an issue on the library you're using (e.g. Plots)"

Base.getindex(gradient::ColorGradient, idx::Integer) = gradient.colors[mod1(idx, length(gradient.colors))]

Expand Down

0 comments on commit ac7e048

Please sign in to comment.