Draw(somethin,colorant'blue'). I want to change colour programmatically and do Draw(somethin, colorant'rgb($(val),$(val),$(val))'). This doesnt work. Nor does concatenation with *. Any ideas
Draw method doesnt interpret colorant properly
The colorant string macro comes from the package Colors. If you do not know how to do something in Julia try first dump:
colorant
Colors
dump
julia> dump(colorant"blue") RGB{FixedPointNumbers.N0f8} r: FixedPointNumbers.N0f8 i: UInt8 0x00 g: FixedPointNumbers.N0f8 i: UInt8 0x00 b: FixedPointNumbers.N0f8 i: UInt8 0xff
You can see that colorant"blue" just created an RGB object. Let's see how one can be constructed:
colorant"blue"
RGB
julia> methods(RGB) # 6 methods for type constructor: [1] RGB(r::T, g::T, b::T) where T<:Integer @ c:\JuliaPkg\Julia-1.10.1\packages\ColorTypes\1dGw6\src\types.jl:460 [2] RGB(r::T, g::T, b::T) where T<:Union{AbstractFloat, FixedPointNumbers.FixedPoint} @ c:\JuliaPkg\Julia-1.10.1\packages\ColorTypes\1dGw6\src\types.jl:108 ...
So let's see if we learnt how to construct colors:
julia> RGB(0.0, 0.0, 1.0) == colorant"blue" true julia> RGB(1.0, 1.0, 0.0) == colorant"yellow" true
The
colorantstring macro comes from the packageColors. If you do not know how to do something in Julia try firstdump:You can see that
colorant"blue"just created anRGBobject. Let's see how one can be constructed:So let's see if we learnt how to construct colors: