Currently the definition of the ANSIColor struct (in src/crayon.jl) has three fields of type Int, and an inner constructor that checks the bounds of the values passed to these fields.
I'd like to propose changing the type of these fields to UInt8. I think using a smaller integer type would:
Make the intent of the fields clearer, and the comments redundant
Make the inner constructor unnecessary. Julia will throw an error when out of bounds
Make the struct smaller (to a convenient 64 bits)
An alternative would be to parametrize these fields, allowing ANSIColor structs of different sizes.
I'm still new to the Julia language, so if there's a good reason for defining the struct like that, It'd be good to know. I noticed this while setting up OhMyREPL, very cool project, thanks for working on this.
Hello there,
Currently the definition of the ANSIColor struct (in src/crayon.jl) has three fields of type
Int
, and an inner constructor that checks the bounds of the values passed to these fields.I'd like to propose changing the type of these fields to
UInt8
. I think using a smaller integer type would:An alternative would be to parametrize these fields, allowing ANSIColor structs of different sizes.
I'm still new to the Julia language, so if there's a good reason for defining the struct like that, It'd be good to know. I noticed this while setting up OhMyREPL, very cool project, thanks for working on this.