Skip to content

Add ANSI color code support in the logs viewer #5617

@qborder

Description

@qborder

Please confirm the following.

  • I checked the existing issues for duplicate feature requests
  • I have checked that this feature request is not on our roadmap

What parts of Modrinth is your feature request related too?

Modrinth App

Is your suggested feature related to a problem? Please describe.

The logs viewer currently shows raw ANSI escape codes as plain text instead of rendering them as colors. So instead of seeing colored output you just see things like [32m[INFO][0m scattered all over the log which makes it harder to read, especially when mods output a lot of colored info/warn/error lines.

Describe the solution you'd like

The log viewer should parse and render ANSI escape codes as actual colors instead of showing them as raw text. Most mods and Minecraft itself use standard ANSI color codes for things like green for info, yellow for warnings, red for errors, etc. Rendering those would make the logs a lot more readable at a glance.

Since the app is built on Tauri, the log text is likely being passed from the Rust backend to the frontend. The parsing could either happen on the Rust side before sending the log lines to the frontend, or on the frontend side directly. There are existing libraries for both that handle ANSI to styled text/HTML conversion, so it wouldn't need to be built from scratch.

Describe alternatives you've considered

At minimum, stripping the ANSI codes from the output so they don't clutter the log would already be an improvement over the current behavior. But actually rendering the colors would be the proper fix.

Additional context

Screenshot of how it currently looks in the log viewer with the raw escape codes visible:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions