Skip to content

Mordant is a multiplatform library for rendering styled text in the terminal. You can use it to add color and style to text, create tables, draw animations, and more.

Mordant has:

  • Easy colorful ANSI output with automatic detection of terminal capabilities
  • Markdown rendering directly to the terminal
  • Widgets for laying out terminal output, including lists, tables, panels, and more
  • Support for animating any widget, like progress bars and dashboards

Installation

Mordant is distributed through Maven Central.

dependencies {
    implementation("com.github.ajalt.mordant:mordant:3.0.0")

    // optional extensions for running animations with coroutines
    implementation("com.github.ajalt.mordant:mordant-coroutines:3.0.0")

    // optional widget for rendering Markdown
    implementation("com.github.ajalt.mordant:mordant-markdown:3.0.0")
}

On JVM, there are more granular dependencies available. See the docs for details.

If you’re using Maven instead of Gradle, use <artifactId>mordant-jvm</artifactId>

Snapshots

Snapshot builds are also available

You'll need to add the Sonatype snapshots repository:

repositories {
    maven {
        url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
    }
}