Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ColorType.gray(x::Real) is no longer needed #124

Closed
kimikage opened this issue Feb 23, 2020 · 6 comments · Fixed by #137 or #156
Closed

ColorType.gray(x::Real) is no longer needed #124

kimikage opened this issue Feb 23, 2020 · 6 comments · Fixed by #137 or #156

Comments

@kimikage
Copy link
Collaborator

gray(x::Fractional) was added in ColorTypes.jl v0.2 (JuliaGraphics/ColorTypes.jl@0b071ed), and it was modified to gray(x::Number) in ColorTypes.jl v0.2.12 (JuliaGraphics/ColorTypes.jl@988de55).

I think Number is too loose, but in any case the following is unnecessary:

ColorTypes.gray(x::Real) = x

@johnnychen94
Copy link
Member

If I read your words correctly, you suggest to

# in ColorTypes
- ColorTypes.gray(x::Number) = x
+ ColorTypes.gray(x::Real) = x

and by doing this, the same method should be removed here in ColorVectorSpace to avoid redefinition, right? That sounds good to me.

@kimikage
Copy link
Collaborator Author

Since Real<:Number, the change in ColorTypes.jl is optional. I think there is no ambiguity problem.

@kimikage
Copy link
Collaborator Author

I hope this will be fixed, along with other fixes. However, if needed, I will submit a standalone PR.

@kimikage
Copy link
Collaborator Author

The PR #131 is going to get rid of the gray(x::Real) in ColorVectorSpace.

timholy added a commit that referenced this issue Sep 11, 2020
timholy added a commit that referenced this issue Sep 11, 2020
@kimikage kimikage reopened this Apr 8, 2021
@kimikage
Copy link
Collaborator Author

kimikage commented Apr 8, 2021

When I saw PR #137, I thought @timholy was going to make some changes in ColorTypes.jl.
For example: JuliaGraphics/ColorTypes.jl#177

However, I don't understand the true intent.

@kimikage
Copy link
Collaborator Author

kimikage commented Apr 9, 2021

This is a separate issue, but I think the following should be in ColorTypes.jl.

real(::Type{C}) where {C<:AbstractGray} = real(eltype(C))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants