Viewing version 3.0.0. Open the latest package page.
colorize
3.0.0Colorize console output
Readme
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:
Styles front- name of front color (you can also use the constants of classStyles). Default value is''.Styles back: name of background color (you can also use the constants of classStyles). Default value is''.bool isUnderline- default value isfalse.bool isBold- default value isfalse.bool isDark- default value isfalse.bool isItalic- default value isfalse.bool isReverse- default value isfalse.
Example of usage
color("Bold Italic Underline", front: Styles.RED, isBold: true, isItalic: true, isUnderline: true);
Enum Styles
Enum Styles contains all styles which you can pass to Colorize.applyState method;
Changelog
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'colorize:3.0.0'pubspec.yaml
name: colorize
version: 3.0.0
description: Colorize console output
author: Alexey Salnikov <me@iamsalnikov.ru>
homepage: https://github.com/iamsalnikov/colorize
environment:
sdk: ">=2.12.0 <3.0.0"
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.1 | Cached · Upstream SHA-256 matched | Download | ea6d38d5…929229 |
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | ce5e050b…8b50c3 |
| 0.1.1 | Cached · Upstream SHA-256 matched | Download | a74cdd4b…7bd990 |
| 0.1.2 | Cached · Upstream SHA-256 matched | Download | ab687682…c36b48 |
| 2.0.0 | Cached · Upstream SHA-256 matched | Download | 336119aa…c29502 |
| 3.0.0 | Cached · Upstream SHA-256 matched | Download | 584746cd…1071ba |
Dependencies
No direct dependencies declared.