Skip to content

Commit

Permalink
Merge pull request #15 from mkborregaard/master
Browse files Browse the repository at this point in the history
Move rgba_string function
  • Loading branch information
mkborregaard authored May 11, 2017
2 parents 1648d98 + b01d63a commit 779b63e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/color_gradients.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@ function sample_evenly(v::AbstractVector, n::Integer = length(v))
v[idx]
end


# allows passing a ColorGradient to rgba_string and get a useful response by picking the first color - introduced because the plotly backend to Plots uses this functionality
rgba_string(cg::ColorGradient) = rgba_string(cg[1])

include("gradients/matplotlib.jl")
include("gradients/cmocean.jl")
include("gradients/colorbrewer.jl")
Expand Down
3 changes: 0 additions & 3 deletions src/color_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,3 @@ end
function rgba_string(c::Colorant)
@sprintf("rgba(%d, %d, %d, %1.3f)", make255(red(c)), make255(green(c)), make255(blue(c)), alpha(c))
end

# allows passing a ColorGradient to rgba_string and get a useful response by picking the first color - introduced because the plotly backend to Plots uses this functionality
rgba_string(cg::ColorGradient) = rgba_string(cg[1])

0 comments on commit 779b63e

Please sign in to comment.