Ratio

Ratio is a string literal type representing a fraction of the terminal width. It is one of the accepted forms of CardWidth and can also be passed directly to the ratio() utility function to convert it to a pixel count.

Type Definition

type Ratio = "1/2" | "1/3" | "2/3" | "full";

Values

  • "1/2" — half the terminal width
  • "1/3" — one third of the terminal width
  • "2/3" — two thirds of the terminal width
  • "full" — the full terminal width (same as passing process.stdout.columns)

Usage

import { Card } from "ts-better-console";

// Takes up half the terminal
const card = new Card("Half-width card", "1/2").render();

Want to support this project?

If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.

Want to contribute to this project?

Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!