Line data Source code
1 : import 'dart:ui'; 2 : 3 : class PaletteEntry { 4 : final Color color; 5 : 6 40 : Paint paint() => Paint()..color = color; 7 : 8 41 : const PaletteEntry(this.color); 9 : 10 0 : PaletteEntry withAlpha(int alpha) { 11 0 : return PaletteEntry(color.withAlpha(alpha)); 12 : } 13 : 14 0 : PaletteEntry withRed(int red) { 15 0 : return PaletteEntry(color.withRed(red)); 16 : } 17 : 18 0 : PaletteEntry withGreen(int green) { 19 0 : return PaletteEntry(color.withGreen(green)); 20 : } 21 : 22 0 : PaletteEntry withBlue(int blue) { 23 0 : return PaletteEntry(color.withBlue(blue)); 24 : } 25 : } 26 : 27 : class BasicPalette { 28 : static const PaletteEntry white = PaletteEntry(Color(0xFFFFFFFF)); 29 : static const PaletteEntry black = PaletteEntry(Color(0xFF000000)); 30 : static const PaletteEntry red = PaletteEntry(Color(0xFFFF0000)); 31 : static const PaletteEntry green = PaletteEntry(Color(0xFF00FF00)); 32 : static const PaletteEntry blue = PaletteEntry(Color(0xFF0000FF)); 33 : static const PaletteEntry magenta = PaletteEntry(Color(0xFFFF00FF)); 34 : }