Skip to content

Commit

Permalink
Default alphas for colors are your own alphas (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliascarv authored Apr 4, 2024
1 parent 8fcad1e commit 257c3bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/Colorfy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ Default color alphas for `values`.
"""
defaultalphas(values) = fill(1, length(values))

defaultalphas(values::Values{Colorant}) = alpha.(values)

"""
Colorfy.defaultcolorscheme(values)
Expand Down
7 changes: 6 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,14 @@ using Test
colorfier = Colorfier(values, alphas=0.5)
@test Colorfy.colors(colorfier) == coloralpha.(colors, 0.5)

values = colors
alphas = rand(5)
colorfier = Colorfier(colors; alphas)
colorfier = Colorfier(values; alphas)
@test Colorfy.colors(colorfier) == coloralpha.(colors, alphas)

values = coloralpha.(colors, alphas)
colorfier = Colorfier(values)
@test Colorfy.colors(colorfier) == values
end

@testset "colorfy" begin
Expand Down

2 comments on commit 257c3bd

@eliascarv
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/104241

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 257c3bdc829f3858c0ffe515dbf6a0a03c674c8f
git push origin v0.1.0

Please sign in to comment.