Coder Social home page Coder Social logo

Comments (6)

rohitvarkey avatar rohitvarkey commented on August 22, 2024

Works fine on v0.5.1 though!

from colors.jl.

stevengj avatar stevengj commented on August 22, 2024

Maybe base_color_type(C)(...) is relying on the implicit call to convert(base_color_type(C), ...) in 0.4+? Although the problem is probably in ColorTypes.jl, not Colors.jl, though.

from colors.jl.

stevengj avatar stevengj commented on August 22, 2024

No, I don't think it is that. It is almost looking like a bug in 0.3 (I tried 0.3.11). I added some println statements to see what colormap is doing. The error occurs in the mix_linearly function in colormaps.jl, which I changed to:

    function mix_linearly{C<:Color}(a::C, b::C, s)
        println("color $C($a,$b,$s)")
        B = base_color_type(C)
        (arg1,arg2,arg3) = ((1-s)*comp1(a)+s*comp1(b), (1-s)*comp2(a)+s*comp2(b), (1-s)*comp3(a)+s*comp3(b))
        println("$B($arg1, $arg2, $arg3)")
        dump(B)
        r = B(arg1, arg2, arg3)
        println("got $r")
        return r
    end

which gives

julia> using Colors

julia> colormap("RdBu")
color LCHuv{Float64}(LCHuv{Float64}(12.0,40.2976566476583,12.10439529418943),LCHuv{Float64}(53.2590994583839,178.4759397727335,12.000000000000023),0.6)
{36.75545967503034,123.20462652270342,12.041758117675787}
LCHuv{T<:FloatingPoint}(36.75545967503034, 123.20462652270342, 12.041758117675787)
LCHuv
ERROR: type cannot be constructed
 in mix_linearly at /Users/stevenj/.julia/v0.3/Colors/src/colormaps.jl:138
 in sequential_palette at /Users/stevenj/.julia/v0.3/Colors/src/colormaps.jl:160
 in diverging_palette at /Users/stevenj/.julia/v0.3/Colors/src/colormaps.jl:233
 in colormap at /Users/stevenj/.julia/v0.3/Colors/src/colormaps.jl:290
 in colormap at /Users/stevenj/.julia/v0.3/Colors/src/colormaps.jl:264

However, if I type it manually at the REPL, it works fine:

julia> C = LCHuv{Float64}
LCHuv{Float64} (constructor with 1 method)

julia> B = base_color_type(C)
LCHuv{T<:FloatingPoint} (constructor with 4 methods)

julia> B(36.75545967503034, 123.20462652270342, 12.041758117675787)
LCHuv{Float64}(36.75545967503034,123.20462652270342,12.041758117675787)

from colors.jl.

stevengj avatar stevengj commented on August 22, 2024

If I type the same mix_linearly function at the REPL, then mix_linearly(LCHuv{Float64}(12.0,40.2976566476583,12.10439529418943),LCHuv{Float64}(53.2590994583839,178.4759397727335,12.000000000000023),0.6) works fine.

Weird.

from colors.jl.

IainNZ avatar IainNZ commented on August 22, 2024

I'm seeing this on PkgEval now

from colors.jl.

timholy avatar timholy commented on August 22, 2024

Since we only support 0.4 and higher, this is no longer relevant.

from colors.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.