termlib 0.1.1 copy "termlib: ^0.1.1" to clipboard
termlib: ^0.1.1 copied to clipboard

Library that provides a set of utilities for terminal applications.

TermLib #

Dart library that provides a set of utilities for terminal applications. Provides information about the running terminal as well as a set of methods for styling the text output or interacting with the terminal.

Features #

  • Keyboard input handling (including Kitty protocol)
  • Mouse events
  • Focus tracking
  • Line wrapping
  • Terminal scrolling
  • Synchronous update mode
  • Terminal hyperlinking
  • Terminal notifications
  • RGB/TrueColor support
  • Convert colors to the best matching if needed
  • Bracketed Paste
  • a lot more...

Getting Started #

Add termlib to your pubspec.yaml file:

dependencies:
  termlib: ^0.1.0
  termparser: ^0.1.0

Then, run flutter pub get to fetch the package.

Usage #

Here's a simple example of using termlib:

import 'dart:io';

import 'package:termlib/termlib.dart';

Future<void> main() async {
  final t = TermLib();
  final color = await t.isBackgroundDark() ? Color('yellow') : Color('blue');

  t
    ..enableAlternateScreen()
    ..eraseClear()
    ..cursorHide()
    ..setTerminalTitle('My Terminal Application')
    ..writeAt(5, 5, t.style('Hello, World!')..fg(color));

  sleep(const Duration(seconds: 2));

  t
    ..disableAlternateScreen()
    ..cursorShow();
  await t.flushThenExit(0);
}

Examples #

You can find more examples of how to use termlib in the example directory.

Acknowledges #

This library draws inspiration from of inspiration and ideas from this other great libraries:

License #

termlib is licensed under the MIT license.

4
likes
0
pub points
39%
popularity

Publisher

verified publishernetflux.com.ar

Library that provides a set of utilities for terminal applications.

Homepage
Repository (GitHub)
View/report issues

Topics

#console #terminal #tui #ansi

Documentation

Documentation

License

unknown (license)

Dependencies

equatable, ffi, meta, termansi, termparser, win32

More

Packages that depend on termlib