# Strategy help

**URL:** https://discourse.julialang.org/t/strategy-help/109370
**Category:** General Usage
**Created:** [January 28, 2024, 10:35pm UTC](https://discourse.julialang.org/t/strategy-help/109370 "2024-01-28T22:35:18Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 28, 2024, 10:35pm UTC](https://discourse.julialang.org/t/strategy-help/109370/1 "2024-01-28T22:35:18Z")

</div>

I’d looking for some input on the best way to tackle this.

Right now I have a struct that looks something like this:

```Julia
mutable struct Line 
    win::Window
    startPoint::Vector{Int64}
    endPoint::Vector{Int64}
    lineColor::Vector{Int64}            
    #----------
    function Line( win::Window,
                    startPoint::Vector{Int64} = [0,0],
                    endPoint::Vector{Int64} = [10,10];
                    width::Int64 = 1,
                    lineColor::Vector{Int64} = fill(128, (4)),               
			)
 
        new(win, 
            startPoint,
            endPoint,
            width,
            lineColor
            )

    end
end

```

There is more to it than that: I pulled out superfluous code to make it easier to read.

Right now lineColor is a vector of RGBA values from 0-255 (I’m using SDL). I’d like to make it more flexible, so that it can take vectors of floating point numbers from 0.0 to 1.0, or even the word “red”, and automatically translate the value passed to it into an RGBA Int vector based on its type (maybe \_lineColor as an ‘hidden’ variable used internally for setting the final color).

I’m not sure of the right way, or best way, to tackle this. Should I replace `lineColor::Vector{Int64}` with `lineColor::{Any}`? Is there a way to do multiple dispatch or overload the inner constructor, so that I have one for `lineColor::Vector{Int64}`, one for` lineColor::Vector{Float64}`, and one for `lineColor::String`?

How would you tackle this?

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [January 28, 2024, 10:40pm UTC](https://discourse.julialang.org/t/strategy-help/109370/2 "2024-01-28T22:40:35Z")

</div>

Make linecolor a Color from Colors.jl.

[https://juliagraphics.github.io/Colors.jl/](https://juliagraphics.github.io/Colors.jl/)

---

<div class="post-metadata">

### Author: ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)
#### Post date: [January 28, 2024, 10:56pm UTC](https://discourse.julialang.org/t/strategy-help/109370/3 "2024-01-28T22:56:17Z")

</div>

I think you can also make the `struct` immutable, as the Vector properties can be modified, appended to, and manipulated even in a immutable struct.

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 28, 2024, 11:26pm UTC](https://discourse.julialang.org/t/strategy-help/109370/4 "2024-01-28T23:26:38Z")

</div>

I used Colors.jl for another project a few months ago, and I found it to be not the most user friendly experience. After looking back through their documentation, it’s non-obvious how I would use Colors.jl.

My ideal is that the user (other programers) would not have to worry about color type conversion: they could simply pass a vector of ints, floats, or a string and the code would automagically translate it to SDL’s RGBA255 color format. That part is easy. It’s the big picture structuring of the problem that I’m struggling with. It’s more of a language thing: I know how I would solve the problem in C++, but not in Julia.

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 28, 2024, 11:27pm UTC](https://discourse.julialang.org/t/strategy-help/109370/5 "2024-01-28T23:27:11Z")

</div>

Dan: what would immutable get me?

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [January 28, 2024, 11:38pm UTC](https://discourse.julialang.org/t/strategy-help/109370/6 "2024-01-28T23:38:11Z")

</div>

> [@mpeters2](#):
>
> it’s non-obvious how I would use [Colors.jl](https://juliahub.com/ui/Packages/Colors).

Do you want a line to have a single RGBA color? You can make a field

```julia
julia> struct Foo
           color::RGBA{Float64}
       end

julia> Foo(RGBA(.1, .2, .3, .4))
Foo(RGBA{Float64}(0.1,0.2,0.3,0.4))

julia> Foo(colorant"orange")
Foo(RGBA{Float64}(1.0,0.6470588235294118,0.0,1.0))

```

> [@mpeters2](#):
>
> simply pass a vector of ints, floats, or a string

```julia

julia> Foo(s::AbstractString) = Foo(parse(Colorant, s))
Foo

julia> Foo("yellow")
Foo(RGBA{Float64}(1.0,1.0,0.0,1.0))

```

You can make more constructors if you like. Check out the [Construction and Conversion](https://juliagraphics.github.io/Colors.jl/stable/constructionandconversion/#Color-Parsing) page.

---

<div class="post-metadata">

### Author: ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)
#### Post date: [January 28, 2024, 11:54pm UTC](https://discourse.julialang.org/t/strategy-help/109370/7 "2024-01-28T23:54:47Z")

</div>

> [@mpeters2](#):
>
> what would immutable get me?

immutable values are easier for the compiler to reason about, and therefore optimize for. Specifically, immutable values can often reside in processor registers avoiding the back and forth to memory (which is a huge deal).

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 29, 2024, 12:05am UTC](https://discourse.julialang.org/t/strategy-help/109370/8 "2024-01-29T00:05:59Z")

</div>

I think we are off track here: conversion is trivially simple, so that is a non-issue, and I can do that without Colors.jl.

What I’m really asking is how to structure things. Should I replace `lineColor::Vector{Int64}` with `lineColor::{Any}` ? Is there a way to do multiple dispatch or overload the inner constructor, so that I have one for `lineColor::Vector{Int64}` , one for` lineColor::Vector{Float64}` , and one for `lineColor::String` ?

---

<div class="post-metadata">

### Author: ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)
#### Post date: [January 29, 2024, 12:16am UTC](https://discourse.julialang.org/t/strategy-help/109370/9 "2024-01-29T00:16:04Z")

</div>

No, you shouldn’t store the color as a string. You should store the color as a single canonical color type, and convert any argument to that type in the construction function.

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 29, 2024, 12:42am UTC](https://discourse.julialang.org/t/strategy-help/109370/10 "2024-01-29T00:42:37Z")

</div>

That is what I was planning on doing.

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 29, 2024, 12:51am UTC](https://discourse.julialang.org/t/strategy-help/109370/11 "2024-01-29T00:51:33Z")

</div>

OK, forget color completely.

Let’s say it is coordinate systems. If the struct constructor receives a vector of Ints, then the coordinates are in pixels, else if it is a vector of Floats, then the coordinates are in percentage of screen height (which is then converted into pixels held in another variable).

How would you structure things? Is it possible to have two constructors, one expecting vector of Ints and another expecting a vector of floats? Or should I specify the coordinates as a vector::{Any} and have the [single] constructor determine what to do based on the coordinates type?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 29, 2024, 1:05am UTC](https://discourse.julialang.org/t/strategy-help/109370/12 "2024-01-29T01:05:03Z")

</div>

If you want maximum flexibility use type parameters for each field.

```julia
mutable struct Line{S,E,C}
    win::Window
    startPoint::S
    endPoint::E
    width::Int64
    lineColor::C
end

```

You can then create outer constructors as needed.

```julia
function Line(
    win::Window,
    startPoint::S = [0,0],
    endPoint::E = [10,10],
    width = 1,
    lineColor::C = fill(128, 4)
) where {S,E,C}
    Line{S,E,C}(
        win,
        startPoint,
        endPoint,
        width,
        lineColor,
    )
end

```

Demonstration:

```julia
julia> struct Window end

julia> mutable struct Line{S,E,C}
           win::Window
           startPoint::S
           endPoint::E
           width::Int64
           lineColor::C
       end

julia> function Line(
           win::Window,
           startPoint::S = [0,0],
           endPoint::E = [10,10],
           width = 1,
           lineColor::C = fill(128, 4)
       ) where {S,E,C}
           Line{S,E,C}(
               win,
               startPoint,
               endPoint,
               width,
               lineColor,
           )
       end
Line

julia> Line(Window())
Line{Vector{Int64}, Vector{Int64}, Vector{Int64}}(Window(), [0, 0], [10, 10], 1, [128, 128, 128, 128])

julia> Line(Window(), (0,0), (1.0, 1.0), 0x5, fill(128,4))
Line{Tuple{Int64, Int64}, Tuple{Float64, Float64}, Vector{Int64}}(Window(), (0, 0), (1.0, 1.0), 5, [128, 128, 128, 128])

julia> Line(Window(), (0,0), (1.0, 1.0), 0x5, :yellow)
Line{Tuple{Int64, Int64}, Tuple{Float64, Float64}, Symbol}(Window(), (0, 0), (1.0, 1.0), 5, :yellow)

```

> [@mpeters2](#):
>
> Let’s say it is coordinate systems. If the struct constructor receives a vector of Ints, then the coordinates are in pixels, else if it is a vector of Floats, then the coordinates are in percentage of screen height (which is then converted into pixels held in another variable).

You can offer a more specific constructor that will convert floats to integer pixel values.

```julia
function Line(
    win::Window,
    startPoint::S,
    endPoint::E,
    width::Float64 = 0.5,
    lineColor::C = fill(128, 4)
) where {
    S <: AbstractVector{<: AbstractFloat},
    E <: AbstractVector{<: AbstractFloat},
    C
}
    screenSize = getScreenSize()
    startPoint = map(screenSize, startPoint) do s, percent
        round(Int64, s*percent)
    end
    endPoint = map(screenSize, endPoint) do s, percent
        round(Int64, s*percent)
    end
    width = round(Int, screenSize[1] * width)
    return Line(win, startPoint, endPoint, width, lineColor)
end

```

```julia-repl
julia> getScreenSize() = (1024, 768)
getScreenSize (generic function with 1 method)

julia> function Line(
           win::Window,
           startPoint::S,
           endPoint::E,
           width::Float64 = 0.5,
           lineColor::C = fill(128, 4)
       ) where {
           S <: AbstractVector{<: AbstractFloat},
           E <: AbstractVector{<: AbstractFloat},
           C
       }
           screenSize = getScreenSize()
           startPoint = map(screenSize, startPoint) do s, percent
               round(Int64, s*percent)
           end
           endPoint = map(screenSize, endPoint) do s, percent
               round(Int64, s*percent)
           end
           width = round(Int, screenSize[1] * width)
           return Line(win, startPoint, endPoint, width, lineColor)
       end
Line

julia> Line(Window(), [0.3,0.4], [0.5,0.6])
Line{Vector{Int64}, Vector{Int64}, Vector{Int64}}(Window(), [307, 307], [512, 461], 512, [128, 128, 128, 128])

```

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 29, 2024, 3:09am UTC](https://discourse.julialang.org/t/strategy-help/109370/13 "2024-01-29T03:09:41Z")

</div>

Thanks Mkiti. I feel like a dummy, but what does the {S,E,C} do in `mutable struct Line{S,E,C}` ?

---

<div class="post-metadata">

### Author: ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)
#### Post date: [January 29, 2024, 6:05am UTC](https://discourse.julialang.org/t/strategy-help/109370/14 "2024-01-29T06:05:33Z")

</div>

Those are type parameters.

[https://docs.julialang.org/en/v1/manual/types/#Parametric-Types](https://docs.julialang.org/en/v1/manual/types/#Parametric-Types)

Basically we have a `Line` type that has a `startPoint` of type `S`, `endPoint` of type `E` and a `lineColor` of type `C`.

Thus we could have a `Line{Vector{Int64}, Vector{Int64}, Vector{Int64}}` where each of `S`, `E`, and `C` are all `Vector{Int64}`.

```julia-repl
julia> default_line = Line(Window())
Line{Vector{Int64}, Vector{Int64}, Vector{Int64}}(Window(), [0, 0], [10, 10], 1, [128, 128, 128, 128])

julia> typeof(default_line)
Line{Vector{Int64}, Vector{Int64}, Vector{Int64}}

julia> fieldnames(typeof(default_line))
(:win, :startPoint, :endPoint, :width, :lineColor)

julia> fieldtypes(typeof(default_line))
(Window, Vector{Int64}, Vector{Int64}, Int64, Vector{Int64})

```

We could bring in some other packages such as `GeometryBasics` and `Colors`. We could then use the types `GeometryBasics.Point3` and `Colors.RGB` with `Line`.

```julia
julia> using GeometryBasics, Colors

julia> other_line = Line(Window(), Point3(1,2,3), Point3(4,5,6), 1, Colors.RGB(1,0,0))
Line{Point3{Int64}, Point3{Int64}, RGB{FixedPointNumbers.N0f8}}(Window(), [1, 2, 3], [4, 5, 6], 1, RGB{N0f8}(1.0,0.0,0.0))

julia> other_line_type = typeof(other_line)
Line{Point3{Int64}, Point3{Int64}, RGB{FixedPointNumbers.N0f8}}

julia> fieldnames(other_line_type)
(:win, :startPoint, :endPoint, :width, :lineColor)

julia> fieldtypes(other_line_type)
(Window, Point3{Int64}, Point3{Int64}, Int64, RGB{FixedPointNumbers.N0f8})

```

Here `S` and `E` are `Point3{Int64}` and `C` is `RGB{FixedPointNumbers.N0f8}`.

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [January 29, 2024, 6:22am UTC](https://discourse.julialang.org/t/strategy-help/109370/15 "2024-01-29T06:22:20Z")

</div>

> [@mpeters2](#):
>
> How would you structure things?

You can, of course, use type parameters, as demonstrated above, but both in the case of colors and coordinates it is, arguably, better to decide on a canonical representation (such as RGBA) and then use the constructors to convert different inputs to that representation. For some reason, though, you seem resistant to that approach.

> [@mpeters2](#):
>
> Or should I specify the coordinates as a vector::{Any}

No, avoid this unless absolutely necessary.

> [@mpeters2](#):
>
> ```julia
> startPoint::Vector{Int64}
> endPoint::Vector{Int64}
> lineColor::Vector{Int64}
> 
> ```

Using `Vector` for _any_ of these seems like a suboptimal approach. I would use a data structure that enforces the correct format, such as `Tuple`s and a Color type. There is nothing in the type of `Vector` that guarantees length, for example. `Vector`s are also bad for memory and performance.

---

<div class="post-metadata">

### Author: ![sylvaticus](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvaticus/32/203883_2.png) [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)
#### Post date: [January 29, 2024, 6:58am UTC](https://discourse.julialang.org/t/strategy-help/109370/16 "2024-01-29T06:58:15Z")

</div>

I think the simplest thing here is the one you initially tought: get the field colour in the struct as you think is better for how your struct will work (for example a tuple of 3 integers), create a construcor that accepts exactly that “format”, and then create (override) the constructors for accepting string, integers, floats or whatever you think it is convenient for the user, and for each you “convert” to the “format” you defined in the struct in the constructor…

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [January 29, 2024, 8:35am UTC](https://discourse.julialang.org/t/strategy-help/109370/17 "2024-01-29T08:35:22Z")

</div>

> [@jar1](#):
>
> No, you shouldn’t store the color as a string. You should store the color as a single canonical color type, and convert any argument to that type in the construction function.

> [@mpeters2](#):
>
> That is what I was planning on doing.

I’m really confused by this thread, and in particular by the last response. Your other posts seem to contradict that you were planning to do this, but if you mean this, then your question is answered, isn’t it?

And the solution has nothing to do with colors, but exactly addresses general strategy: decide on a definitive/canonical representation, then convert other input formats in the constructor(s). If you need input on how to do conversion, we will be happy to help, but you also said

> [@mpeters2](#):
>
> That part is easy.

What’s missing for a full solution?

---

<div class="post-metadata">

### Author: ![GHTaarn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ghtaarn/32/216007_2.png) [@GHTaarn](https://discourse.julialang.org/u/GHTaarn)
#### Post date: [January 29, 2024, 5:01pm UTC](https://discourse.julialang.org/t/strategy-help/109370/18 "2024-01-29T17:01:31Z")

</div>

Are you looking for something like

```julia
mutable struct Line 
    win::Window
    startPoint::Vector{Int64}
    endPoint::Vector{Int64}
    width::Int64
    lineColor::Vector{Int64}            
    #----------
    function Line( win::Window,
                    startPoint::Vector{Int64} = [0,0],
                    endPoint::Vector{Int64} = [10,10];
                    width::Int64 = 1,
                    lineColor::Vector{Int64} = fill(128, (4)),               
			)
 
        new(win, 
            startPoint,
            endPoint,
            width,
            lineColor
            )
    end

    function Line( win::Window,
                    startPoint::Vector{Int64} = [0,0],
                    endPoint::Vector{Int64} = [10,10];
                    width::Int64 = 1,
                    lineColor::Vector{Float64},               
			)
        @assert all(0 .<= lineColor .<= 1) 
        new(win, 
            startPoint,
            endPoint,
            width,
            round.(Int64, lineColor .* 255))
            )
    end

end

```

or

```julia
mutable struct Line 
    win::Window
    startPoint::Vector{Int64}
    endPoint::Vector{Int64}
    width::Int64
    lineColor::Vector{Int64}            
    #----------
    function Line( win::Window,
                    startPoint::Vector{Int64} = [0,0],
                    endPoint::Vector{Int64} = [10,10];
                    width::Int64 = 1,
                    lineColor::Union{AbstractString, AbstractVector{<:Real}} = fill(127, 4),               
			)
        if lineColor isa AbstractString
            error("Not yet implemented")
        elseif !(Integer in supertypes(eltype(lineColor)))
            @assert all(0 .<= lineColor .<= 1) 
            lineColor = round.(Int64, lineColor .* 255))
        end
        new(win, 
            startPoint,
            endPoint,
            width,
            lineColor
            )
    end

end

```

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 30, 2024, 2:23am UTC](https://discourse.julialang.org/t/strategy-help/109370/19 "2024-01-30T02:23:44Z")

</div>

This is what I ended up doing for the two types of coordinates (pixels vs percentage of screen height). Pixels are Int64 and percentages are Float64.

```julia
mutable struct Line2    
    win::Window
    startPoint::Vector{Real}
    endPoint::Vector{Real}
    lineColor::Vector{Int64}           
    _startPoint::Vector{Int64}
    _endPoint::Vector{Int64}
    #----------	Pixel Coordinates
    function Line2( win::Window,
                    startPoint::Vector{Int64} = [0,0],
                    endPoint::Vector{Int64} = [10,10];
                    width::Int64 = 1,
                    lineColor::Vector{Int64} = fill(128, (4)),             
                    _startPoint::Vector{Int64} = [0,0],
                    _endPoint::Vector{Int64} = [10,10]
            )

        if length(endPoint) != 2
            message = "endPoint needs two coordinates, got " * String(length(endPoint)) * " instead."
            error(message)
        end
        if length(startPoint) != 2
            message = "startPoint needs two coordinates, got " * String(length(startPoint)) * " instead."
            error(message)
        end     
        new(win, 
            startPoint,
            endPoint,
            width,
            convert(Vector{Int64},lineColor),
            startPoint,
            endPoint
            )

    end
    #----------	Percentage of screen height coordinates
    function Line2( win::Window,
                    startPoint::Vector{Float64} = [0.1,0.1],
                    endPoint::Vector{Float64} = [0.2,0.2];
                    width::Int64 = 1,
                    lineColor::Vector{Int64} = fill(128, (4)),              
                    _startPoint::Vector{Int64} = [0,0],
                    _endPoint::Vector{Int64} = [10,10]
                )

        if length(endPoint) != 2
            message = "endPoint needs two coordinates, got " * String(length(endPoint)) * " instead."
            error(message)
        end
        if length(startPoint) != 2
            message = "startPoint needs two coordinates, got " * String(length(startPoint)) * " instead."
            error(message)
        end     
        _, displayHeight = getSize(win)

        _startPoint[1] = round(Int64, startPoint[1] * displayHeight) # convert percentage to pixels
        _startPoint[2] = round(Int64, startPoint[2] * displayHeight)
        _endPoint[1] = round(Int64, endPoint[1] * displayHeight)
        _endPoint[2] = round(Int64, endPoint[2] * displayHeight)

        new(win, 
            startPoint,
            endPoint,
            width,
            convert(Vector{Int64},lineColor),
            _startPoint,
            _endPoint
            )

    end

end

```

For the coordinates, would it make more sense to replace ::Vector{Type} with ::MVector{2, Type} ?

---

<div class="post-metadata">

### Author: ![mpeters2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mpeters2/32/202247_2.png) [@mpeters2](https://discourse.julialang.org/u/mpeters2)
#### Post date: [January 30, 2024, 2:36am UTC](https://discourse.julialang.org/t/strategy-help/109370/20 "2024-01-30T02:36:46Z")

</div>

GHTaarn: yes, something like that.

On the otherhand, for color, what if I typed `lineColor` as Any, and called an external function to translate it (string or float colors) to an internal variable \_lineColor for drawing?

```julia
lineColor::Any # what the usesr passes: string, or vectors of ints or floats
_lineColor::Vector{Int64} # internal SDL-style RGBA255 color

```

or does it make more sense to use a Union\*

```julia
lineColor::Union{String, MVector{4, Int64}, MVector{4, Float64}} # what the usesr passes: string, or vectors of ints or floats
_lineColor::Vector{Int64} # internal SDL-style RGBA255 color

```

- which I lasted used in C/C++ 20 years ago…

[Next page](https://discourse.julialang.org/t/strategy-help/109370.md?page=2)
