1 static struct IntCV {
2 int value = 0;
3
4 static auto fromReal(real v) {
5 return IntCV(cast(int)(v / int.max));
6 }
7
8 real toReal() {
9 return cast(real)value / int.max;
10 }
11 }
12
13 assert(isCustomColorValue!IntCV);
14 assert(isColorValue!IntCV);
Template for checking whether a type is a valid custom color value. A custom color value must have a static `init` property, a static `fromReal` that converts a real to `V`, and a `toReal` function that converts a `V` back to a real.