private static QuantumType ParseHexQ8(string color, int offset)
{
ushort result = 0;
ushort k = 1;
int i = 3;
while (i >= 0)
{
char c = color[offset + i];
if (c >= '0' && c <= '9')
result += (ushort)(k * (c - '0'));
else if (c >= 'a' && c <= 'f')
result += (ushort)(k * (c - 'a' + '\n'));
else if (c >= 'A' && c <= 'F')
result += (ushort)(k * (c - 'A' + '\n'));
else
throw new ArgumentException("Invalid character: " + c + ".", nameof(color));
i--;
k = (ushort)(k * 16);
}
return Quantum.Convert(result);
}
#endif