colorize 0.1.2

  • README.md
  • Installing
  • Versions
  • 60

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

Analysis

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

  • Dart: 2.0.0-dev.54.0
  • pana: 0.10.6

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
72 / 100
Health:
Code health derived from static analysis. [more]
81 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0 / 100
Overall score:
Weighted score of the above. [more]
60
Learn more about scoring.

Platforms

Detected platforms: web, other

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

Suggestions

  • Maintain CHANGELOG.md.

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

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 5 errors 5 hints.

    Strong-mode analysis of lib/src/color.dart failed with the following error:

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

    Run dartfmt to format lib/colorize.dart.

    Similar analysis of the following files failed:

    • lib/src/colorize.dart (hint)
    • lib/src/styles.dart (hint)
  • 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 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.