getColorRangeDartCode method

String getColorRangeDartCode(
  1. String baseName, [
  2. String prefix = '@override\nfinal '
])

Implementation

String getColorRangeDartCode(
  String baseName, [
  String prefix = '@override\nfinal ',
]) {
  final output = StringBuffer();
  output.writeln('// $baseName');

  void add(int i) {
    final color = getMix(i)?.value.toRadixString(16).toUpperCase();
    //output.writeln('@override');
    output.writeln('$prefix$baseName$i = const Color(0x$color);');
  }

  add(0);
  add(50);
  for (var i = 100; i <= 1000; i += 100) {
    add(i);
  }
  return output.toString();
}