Name: term_glyph
Owner: Dart
Description: Useful glyphs and Windows-safe equivalents
Created: 2017-01-05 22:03:47.0
Updated: 2018-03-12 23:13:48.0
Pushed: 2018-03-13 00:13:51.0
Homepage: https://pub.dartlang.org/packages/term_glyph
Size: 9
Language: Dart
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
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:
rt 'package:term_glyph/term_glyph.dart' as glyph;
Formats [items] into a bulleted list, with one item per line.
ng bulletedList(List<String> items) =>
items.map((item) => "${glyph.bullet} $item").join("\n");
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:
rt 'dart:io';
rt 'package:term_glyph/term_glyph.dart' as glyph;
main() {
yph.ascii = Platform.isWindows;
Prints "Unicode => ASCII" on Windows, "Unicode ?? ASCII" everywhere else.
int("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.