Color WithR(byte/int/float);
Color WithG(byte/int/float);
Color WithB(byte/int/float);
Color WithA(byte/int/float);
Color32 WithR(byte/int/float);
Color32 WithG(byte/int/float);
Color32 WithB(byte/int/float);
Color32 WithA(byte/int/float);
Parameters
Parameter
Type
Description
r / g / b / a
byte / int / float
The new component value.
Description
Returns a color whose components are the same as a given color, but with one component specified as a new value.
Benefits
Provides an easy way to transform a Color without constructing a new one with .NET's FromArgb.
Drawbacks
In Unity, this is already easily achievable using a with expression, since Unity's Color/Color32 structs are mutable.
Types
Extension method signatures
byte
/int
/float
Description Returns a color whose components are the same as a given color, but with one component specified as a new value.
Benefits Provides an easy way to transform a
Color
without constructing a new one with .NET'sFromArgb
.Drawbacks In Unity, this is already easily achievable using a
with
expression, since Unity's Color/Color32 structs are mutable.(Optional) Implementation example n/a