isCustomColorValue

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.

template isCustomColorValue (
V
) {}

Members

Manifest constants

isCustomColorValue
enum isCustomColorValue;
Undocumented in source.

Examples

static struct IntCV {
    int value = 0;

    static auto fromReal(real v) {
        return IntCV(cast(int)(v / int.max));
    }

    real toReal() {
        return cast(real)value / int.max;
    }
}

assert(isCustomColorValue!IntCV);
assert(isColorValue!IntCV);

Meta