Your code will work, but yes, autoboxing can always happen.
I really like this guide for explaining when autoboxing happens https://typealias.com/guides/inline-classes-and-autoboxing/
To best avoid autoboxing you'd want something like a single Color value class, but with multiple constructors for string/int values. But what you've written works fine too, and autoboxing is unlikely to be a big problem, so I'd be more cautious about preoptimising!
10/06/2023, 8:39 AM
But we’re not gaining anything with value class either