JuliaGraphics / ColorTypes.jl

Basic color definitions and traits
Other
77 stars 35 forks source link

unsupport the peeling version of `float`/`real` #285

Open johnnychen94 opened 1 year ago

johnnychen94 commented 1 year ago

@myrddin89 noticed this in https://github.com/JuliaGraphics/ColorTypes.jl/issues/123#issuecomment-1271826700

My understanding of the function float doesn't peel off the Colorant wrapper: float(::Gray) will still be a Gray, float(::RGB) will still be an RGB, etc. Similar usages are float64, n0f8, etc.

julia> using Colors

julia> float(Gray{Float64}(0.5))
0.5

julia> using ImageCore

julia> float(Gray{Float64}(0.5))
Gray{Float64}(0.5)

We should probably unsupport float/real here. And let the users decide if it's still the Colorant. If the purpose is to peel off the colorant wrapper, use the "standard" API gray. @timholy how do you think?