colorize 0.1.2

  • README.md
  • Installing
  • Versions
  • 34

Colorize

Colorize console output in dart console apps!

Install

Add dependency to your pubspec.yaml:

colorize: any

Run

pub get

Usage

Import package:

import 'package:colorize/colorize.dart';

You have two way to colorize your string:

  • use class Colorize
  • use top-level function color()

Use Colorize

For colorize string with Colorize class you should create object of type Colorize:

Colorize string = new Colorize("This is my string!");

Then you can call methods of Colorize.

Text color

  • default()
  • black()
  • red()
  • green()
  • yellow()
  • blue()
  • magenta()
  • cyan()
  • lightGray()
  • darkGray()
  • lightRed()
  • lightGreen()
  • lightYellow()
  • lightBlue()
  • lightMagenta()
  • lightCyan()
  • white()

Background color

  • bgDefault()
  • bgBlack()
  • bgRed()
  • bgGreen()
  • bgYellow()
  • bgBlue()
  • bgMagenta()
  • bgCyan()
  • bgLightGray()
  • bgDarkGray()
  • bgLightRed()
  • bgLightGreen()
  • bgLightYellow()
  • bgLightBlue()
  • bgLightMagenta()
  • bgLightCyan()
  • bgWhite()

Formatting

  • reset()
  • bold()
  • dark()
  • italic()
  • underline()
  • blink()
  • reverse()
  • concealed()

After apply styles to string you can print it to console:

print(string);

Use top-level function color()

Top-level function color apply one required parameter - String text. It is text, that would be print on console.

Also top-level function color has seven named parameters:

  • String front - name of front color (you can also use the constants of class Styles). Default value is ''.
  • String back: name of background color (you can also use the constants of class Styles). Default value is ''.
  • bool isUnderline - default value is false.
  • bool isBold - default value is false.
  • bool isDark - default value is false.
  • bool isItalic - default value is false.
  • bool isReverse - default value is false.

Example of usage

color("Bold Italic Underline", front: Styles.RED, isBold: true, isItalic: true, isUnderline: true);

Class Styles

Class Styles contains constants with color's names.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  colorize: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:colorize/colorize.dart';
  
Version Uploaded Documentation Archive
0.1.2 Oct 27, 2014 Go to the documentation of colorize 0.1.2 Download colorize 0.1.2 archive
0.1.1 Oct 27, 2014 Go to the documentation of colorize 0.1.1 Download colorize 0.1.1 archive
0.1.0 Oct 27, 2014 Go to the documentation of colorize 0.1.0 Download colorize 0.1.0 archive
0.0.1 Oct 27, 2014 Go to the documentation of colorize 0.0.1 Download colorize 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
55
Health:
Code health derived from static analysis. [more]
24
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
34
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: web, other

Primary library: package:colorize/colorize.dart with components: mirrors.

Issues and suggestions

Fix lib/src/color.dart.

Analysis of lib/src/color.dart failed with 5 errors:

line 24 col 12: The method 'underline' isn't defined for the class 'Colorize'.

line 28 col 12: The method 'bold' isn't defined for the class 'Colorize'.

line 32 col 12: The method 'dark' isn't defined for the class 'Colorize'.

line 36 col 12: The method 'italic' isn't defined for the class 'Colorize'.

line 40 col 12: The method 'reverse' isn't defined for the class 'Colorize'.

Maintain CHANGELOG.md.

Changelog entries help clients to follow the progress in your code.

Add SDK constraint in pubspec.yaml.

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Package is too old.

The package was released more than two years ago.

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Maintain an example.

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use colorize.dart.

Format lib/colorize.dart.

Run dartfmt to format lib/colorize.dart.

Fix lib/src/colorize.dart.

Analysis of lib/src/colorize.dart reported 1 hint:

line 3 col 2: 'proxy' is deprecated and shouldn't be used.

Format lib/src/styles.dart.

Run dartfmt to format lib/src/styles.dart.