Reason Native
  • Docs
  • Help
  • GitHub

›Pastel

Overview

  • Introduction
  • Native Basics
  • Getting Started

Rely

  • Introduction
  • Quickstart
  • Guides

    • Setup and Teardown
    • Mock Functions

    API Reference

    • Basic API
    • Expect
  • Advanced

Console

  • Introduction
  • Quickstart
  • API

Pastel

  • Introduction
  • Quickstart
  • API
  • Console

Refmterr

  • Introduction
  • Quickstart

File Context Printer

  • Introduction
  • Quickstart
  • API

Pastel Quickstart

This quickstart builds off Getting Started and assumes you have a native Reason project set up.

Install Pastel

To install Pastel in your project with esy, run

esy add @reason-native/pastel

This will add @reason-native/pastel into your package.json.

In order to use Pastel, you must add it to your build system. With dune, pastel.lib must be added to the relevant dune file:

(libraries ... pastel.lib)

Sample Code

Pastel is fundamentally a Reason JSX element that wraps text in ANSI-compatible formatting. You can specify attributes such as bold, underline, and color to format terminal output. Wrap your pastel elements with Pastel.() to convert it to a string:

let output =
  Pastel.(
    <Pastel bold=true color=Green>
      "Hello "
      <Pastel italic=true underline=true> "World" </Pastel>
    </Pastel>
  );
print_endline(output);
Hello World
← IntroductionAPI →
  • Install Pastel
  • Sample Code
Reason Native
Projects
RelyConsolePastelRefmterrFile Context Printer
More
GitHubStar
Facebook Open Source
Copyright © 2021 Facebook Inc.