Colors.js in dart.

Akash Pattnaik - Jan 18 '22 - - Dev Community

Ever used colors.js? How about the same in dart?

Here, we will be using the colorx.dart package.

So, Let's Get Started!

Installing

  • pubspec.yaml
dependencies:
  colorx: ^1.0.0
Enter fullscreen mode Exit fullscreen mode
  • Then run dart pub get or flutter pub get.

Usage

  • main.dart
import 'package:colorx/colorx.dart';

void main(List<String> args) {
    print(Colors('Red, Bold and with Blue background').red.bold.bgBlue);
    print('Red, Bold and with Blue background'.red.bold.bgBlue);
    print('This is a raindow text'.rainbow());
    print('This is the INDIAN Flag'.indianFlag());
}
Enter fullscreen mode Exit fullscreen mode

Made with Extensions on the String class, this can be very productive and helpful...

Example.dart

Example Image 1Example Image 2

All Available Methods

  • You may look here for all available methods...

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .