Skip to content

Gray arithmetic #38

Closed
Closed
@bjarthur

Description

@bjarthur

when mixing Gray with Number the type of the result depends on the order of the inputs:

julia> using ColorVectorSpace, Colors

julia> 2.0 / Gray(2.0)
1.0

julia> Gray(2.0) / 2.0
Gray{Float64}(1.0)

julia> Gray(2.0) / Gray(2.0)
1.0

my feeling is that the results should always be Gray, but wanted to ask for opinions before submitting a PR to fix it, as a whole a lot has to be changed, for all of + and - always returns Number when the inputs are of mixed types:

julia> Gray(2.0)+Gray(2.0)
Gray{Float64}(4.0)

julia> Gray(2.0)+2.0
4.0

julia> 2.0+Gray(2.0)
4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions