isPrimaryColor static method
Check if the given color is included in any Material primary color swatch.
Returns true if the color is a Material primary color, otherwise false.
Implementation
static bool isPrimaryColor(Color color) {
for (final ColorSwatch<Object> swatch in primaryColors) {
for (final int i in _indexPrimaryWith850) {
if (swatch[i] == color || swatch[i]?.value32bit == color.value32bit) {
return true; // Color found in a swatch, return true.
}
}
}
// Color was not in any primary color swatch, return false.
return false;
}