-
Notifications
You must be signed in to change notification settings - Fork 36
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
Simplify display of colors and arrays of colors #206
Conversation
Codecov Report
@@ Coverage Diff @@
## master #206 +/- ##
==========================================
+ Coverage 82.52% 82.62% +0.10%
==========================================
Files 8 8
Lines 738 754 +16
==========================================
+ Hits 609 623 +14
- Misses 129 131 +2
Continue to review full report at Codecov.
|
Before (Julia v1.4.2) julia> rand(RGB{Float32})
RGB{Float32}(0.010770321f0,0.30586517f0,0.20819986f0)
julia> rand(RGB{Float32}, 2, 2)
2×2 Array{RGB{Float32},2} with eltype RGB{Float32}:
RGB{Float32}(0.405684,0.257278,0.958491) RGB{Float32}(0.589914,0.38923,0.914833)
RGB{Float32}(0.509395,0.950449,0.49083) RGB{Float32}(0.428022,0.876569,0.0370699)
julia> RGB[rand(RGB{Float32}, 2, 2);]
2×2 Array{RGB,2} with eltype RGB:
RGB{Float32}(0.251354,0.515818,0.796756) RGB{Float32}(0.625089,0.364764,0.478725)
RGB{Float32}(0.776938,0.891641,0.704014) RGB{Float32}(0.770691,0.598743,0.283114) After (Julia v1.4.2) julia> rand(RGB{Float32})
RGB{Float32}(0.010770321,0.30586517,0.20819986)
julia> rand(RGB{Float32}, 2, 2)
2×2 Array{RGB{Float32},2}:
RGB(0.405684,0.257278,0.958491) RGB(0.589914,0.38923,0.914833)
RGB(0.509395,0.950449,0.49083) RGB(0.428022,0.876569,0.0370699)
julia> RGB[rand(RGB{Float32}, 2, 2);]
2×2 Array{RGB,2}:
RGB{Float32}(0.251354,0.515818,0.796756) RGB{Float32}(0.625089,0.364764,0.478725)
RGB{Float32}(0.776938,0.891641,0.704014) RGB{Float32}(0.770691,0.598743,0.283114) |
Before (Julia v1.4.2) julia> Gray{Float32}[1 0; 0.2 0.5]
2×2 Array{Gray{Float32},2} with eltype Gray{Float32}:
Gray{Float32}(1.0) Gray{Float32}(0.0)
Gray{Float32}(0.2) Gray{Float32}(0.5)
julia> Gray24[1 0; 0.2 0.5]
2×2 Array{Gray24,2} with eltype Gray24:
Gray24(1.0) Gray24(0.0)
Gray24(0.2) Gray24(0.502)
julia> Gray{Bool}(1)
Gray{Bool}(true)
julia> Gray{Bool}[1 0; 0 1]
2×2 Array{Gray{Bool},2} with eltype Gray{Bool}:
Gray{Bool}(true) Gray{Bool}(false)
Gray{Bool}(false) Gray{Bool}(true) After (Julia v1.4.2) julia> Gray{Float32}[1 0; 0.2 0.5]
2×2 Array{Gray{Float32},2}:
1.0 0.0
0.2 0.5
julia> Gray24[1 0; 0.2 0.5]
2×2 Array{Gray24,2}:
1.0 0.0
0.2 0.502
julia> Gray{Bool}(1)
Gray{Bool}(1)
julia> Gray{Bool}[1 0; 0 1]
2×2 Array{Gray{Bool},2}:
1 0
0 1 |
After merging PR #210 (i.e. releasing v0.10.8), I will run Edit: |
A possible additional change would be to add a space after the component separator ",". I prefer the spaced style for consistency with the rest of Julia, but that's not a sufficient motivation to break compatibility. |
Julia v1.6.0-beta1 is now available. Since Julia v1.6 introduces some breaking changes to printing, I think it's not a bad idea to put a space after the comma, "now". |
a04cbd2
to
5e3158e
Compare
I regret to say that this breaks the tests for some packages... julia> RGB{Float32}(1.0,0.5,0.0)
RGB{Float32}(1.0, 0.5, 0.0)
julia> (1.0,0.5,0.0)
(1.0, 0.5, 0.0) |
If it's released in a breaking version, that's not a problem. You have approval, so merge when ready. |
Oh, I thought you were trying to do the method migration from ColorVectorSpace first (without changing Colors.jl minor version). I think it is better to separate the method migration from other breaking changes. Of course, that doesn't mean I think it's a good idea to leave this behind, though. Edit: |
This simplifies the display of array elements based on the :typeinfo property. This also simplifies the display of color components by setting the :typeinfo property. This prints the elements of gray arrays as real numbers.
This makes consistent with Julia v1.6 the data and type printing.
I apologize in advance that this may break your doctests. |
This reverts commit 213e0de.
Fixes #202, Fixes #191
(and #179 (comment))This simplifies the display of array elements based on the
:typeinfo
property. This also simplifies the display of color components by setting the:typeinfo
property.This prints the elements of gray arrays as real numbers.