Quantcast
Channel: First steps - JuliaLang
Viewing all articles
Browse latest Browse all 2795

Make a LCHab{Float32} color darker

$
0
0

I’ll be direct! I’m trying to make a LCHab{Float32} color made with Colors.jl darker; at first glance, I thought in iterating and giving it a smaller value, however perhaps I’m very dumb for not knowing that I cannot probably iterate it, Julia 1.5.3 gave the following error trying with foreach and println:

julia> w = LCHab{Float32}(70.0f0,70.0f0,0.0f0)
LCHab{Float32}(70.0f0,70.0f0,0.0f0)

julia> foreach(println, w)
ERROR: MethodError: no method matching iterate(::LCHab{Float32})
Closest candidates are:
  iterate(::Base.MethodList, ::Any...) at reflection.jl:874
  iterate(::LibGit2.GitBranchIter) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/LibGit2/src/reference.jl:343
  iterate(::LibGit2.GitBranchIter, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/LibGit2/src/reference.jl:343
  ...
Stacktrace:
 [1] foreach(::typeof(println), ::LCHab{Float32}) at ./abstractarray.jl:2009
 [2] top-level scope at REPL[13]:1
 [3] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

julia> w[1]
ERROR: MethodError: no method matching getindex(::LCHab{Float32}, ::Int64)
Stacktrace:
 [1] top-level scope at REPL[14]:1
 [2] run_repl(::REPL.AbstractREPL, ::Any) at /build/julia/src/julia-1.5.3/usr/share/julia/stdlib/v1.5/REPL/src/REPL.jl:288

Or perhaps it is iterable and I just can’t figure it out, anyway, I’d be glad if someone can show me how to make this type of color darker.

3 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 2795

Trending Articles