Clone this repo:

Branches

  1. ff0503f chore: set max SDK version to <3.0.0 (#5) by Patrice Chalin · 10 weeks ago master 1.0.1
  2. b5e9b30 misc: update dev_dependencies to support latest SDK (#4) by Kevin Moore · 3 months ago
  3. e7fae44 Enable Travis, add analysis_options, update .gitignore (#3) by Kevin Moore · 7 months ago
  4. 8b0ec0a Add the package's contents. (#1) by Natalie Weizenbaum · 1 year, 9 months ago 1.0.0
  5. 0968278 Template files. by Natalie Weizenbaum · 1 year, 9 months ago

This library contains getters for useful Unicode glyphs as well as plain ASCII alternatives. It's intended to be used in command-line applications that may run on Windows and libraries that may be used by those applications.

We recommend that you import this library with the prefix “glyph”. For example:

import 'package:term_glyph/term_glyph.dart' as glyph;

/// Formats [items] into a bulleted list, with one item per line.
String bulletedList(List<String> items) =>
    items.map((item) => "${glyph.bullet} $item").join("\n");

ASCII Mode

The default Windows cmd.exe shell is unable to display Unicode characters, so this package is able to transparently switch its glyphs to ASCII alternatives by setting the ascii attribute. When this attribute is true, all glyphs use ASCII characters instead. It currently defaults to false, although in the future it may default to true for applications running on the Dart VM on Windows. For example:

import 'dart:io';

import 'package:term_glyph/term_glyph.dart' as glyph;

void main() {
  glyph.ascii = Platform.isWindows;

  // Prints "Unicode => ASCII" on Windows, "Unicode ━▶ ASCII" everywhere else.
  print("Unicode ${glyph.rightArrow} ASCII");
}

All ASCII glyphs are guaranteed to be the same number of characters as the corresponding Unicode glyphs, so that they line up properly when printed on a terminal. The specific ASCII text for a given Unicode glyph may change over time; this is not considered a breaking change.