Why aren't color vectors composed of int4 or better yet byte4?

Am I missing something?

Colors (at least RBG) are 0-255, each, in value, right? So why float4 or float3?

Pete Alvin,
Charlotte, NC, USA

In Fuse, each channel (RGBA) is actually 0 to 1, hence:

    <Grid RowCount="2" CellSpacing="4" Margin="4">
        <Panel Color="0,0.5,1,0.5" />
        <Panel Color="#08f8" />

I’m not that good with hex->float conversions, but these two appear to be really close, if not identical.

Though in most cases, we suggest sticking to HEX representation for colors.

Peter Alvin: Uno (the language underlaying Fuse) is actually a hybrid CPU/GPU langauge so using types like float4 ease interop with shaders (GPU code).

Using floats is more practical when doing color calculations, as they have more accuracy and can represent values outside the 0…1 range (which tends to happen in intermediate calculations, when animating colors with easings etc).

byteN types are obviously better for memory when storing large arrays of colors that don’t need high dynamic range, like images. However, for properties in UX interfaces floatN types are used consistently throughout Fuse as this doesn’t represent any significant amount of data.