|
end |
|
function colour(A::AbstractArray, dims) |
|
all(d -> keys_or_axes(A,d) === OneTo(1), dims) && return :light_black |
|
colour(A, promote_type(map(d -> eltype(keys_or_axes(A,d)), dims)...)) |
|
end |
|
function colour(A::AbstractArray, T::Type) |
|
T <: AbstractFloat && return :cyan |
|
T <: Number && return :blue |
|
T <: AbstractString && return :yellow #:green |
|
T <: AbstractChar && return :yellow |
|
T <: Symbol && return :magenta |
|
:red |
|
end |
I like to have all-different axis colors so I want to override the color rule, but that is piracy which I prefer to avoid. Is there a way to either provide all-different colors by default or somehow let me override the default behavior without piracy?
julia> AxisKeys.colour(::AbstractArray, i::Int) = let cs = [:cyan, :yellow, :magenta, :blue]
cs[mod1(i,length(cs))]
end
AxisKeys.jl/src/show.jl
Lines 45 to 57 in c16d0fc
I like to have all-different axis colors so I want to override the color rule, but that is piracy which I prefer to avoid. Is there a way to either provide all-different colors by default or somehow let me override the default behavior without piracy?