[Actions] Support 256 colors #10865

Closed
opened 2025-11-02 09:20:26 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @silverwind on GitHub (May 17, 2023).

Feature Description

Results from a color test script:

It looks like Gitea Actions only supports 16 color, no 256, but apparently true color backgrounds. Also there seems to be a bug where some 256-color escape sequences are interpreted as enabling underline style.

The implementation should detect the relevant ANSI escape sequences and use inline styles for at least the 256 and 16m variants, e.g. style="color:rgb(0,204,153)". We should also use some "nicer" colors for the 16-color variants that have sufficient contrast over the background.

Screenshots

GitHub

image Screenshot 2023-05-17 at 22 52 39 image

Gitea

image Screenshot 2023-05-17 at 22 52 52 image
Originally created by @silverwind on GitHub (May 17, 2023). ### Feature Description Results from a [color test script](https://gist.github.com/lilydjwg/fdeaf79e921c2f413f44b6f613f6ad53): - [GitHub Actions](https://github.com/silverwind/symlink-test/actions/runs/5007674680/jobs/8974583125) - [Gitea Actions](https://gitea.com/silverwind/symlink-test/actions/runs/1) It looks like Gitea Actions only supports 16 color, no 256, but apparently true color backgrounds. Also there seems to be a bug where some 256-color escape sequences are interpreted as enabling underline style. The implementation should detect the relevant ANSI escape sequences and use inline styles for at least the 256 and 16m variants, e.g. `style="color:rgb(0,204,153)"`. We should also use some "nicer" colors for the 16-color variants that have sufficient contrast over the background. ### Screenshots # GitHub <img width="743" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/b38496d3-b2d5-4eda-aa6b-2ce115662f91"> <img width="683" alt="Screenshot 2023-05-17 at 22 52 39" src="https://github.com/go-gitea/gitea/assets/115237/ea336061-c036-4a1d-b827-f42ca1a1ffb8"> <img width="727" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/41bf407a-3607-43a6-b3e7-d5514034c052"> # Gitea <img width="715" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/7a5570f8-f382-484e-bfe2-7d63ae4b1656"> <img width="653" alt="Screenshot 2023-05-17 at 22 52 52" src="https://github.com/go-gitea/gitea/assets/115237/791c4e54-f62a-4a5c-ad05-65e88828d637"> <img width="696" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/3e56a521-e96c-422f-8888-2ba654b7e7b6">
Author
Owner

@wxiaoguang commented on GitHub (May 18, 2023):

I think it can be done by finding a new JS term color library to replace "ansi-to-html". The action view page just calls a 3rd library to render the term outputs (or just write one by ourselves)

@wxiaoguang commented on GitHub (May 18, 2023): I think it can be done by finding a new JS term color library to replace "ansi-to-html". The action view page just calls a 3rd library to render the term outputs (or just write one by ourselves)
Author
Owner

@silverwind commented on GitHub (May 18, 2023):

I cursorly checked how GitHub does it, but it seems they didn't open-source the terminal rendering parts and it's mentioned that the code was mostly inherited from Azure pipelines.

The only other terminal rendering library I could find is https://github.com/drudru/ansi_up, it's worth a try to see if it fares any better.

I assume it's likely that we will need to incorporate and modify one of these libs.

@silverwind commented on GitHub (May 18, 2023): I cursorly checked how GitHub does it, but it seems they didn't open-source the terminal rendering parts and it's mentioned that the code was mostly inherited from Azure pipelines. The only other terminal rendering library I could find is https://github.com/drudru/ansi_up, it's worth a try to see if it fares any better. I assume it's likely that we will need to incorporate and modify one of these libs.
Author
Owner

@lafriks commented on GitHub (May 19, 2023):

I did use ansi_up in woodpecker and it works quite good

@lafriks commented on GitHub (May 19, 2023): I did use ansi_up in woodpecker and it works quite good
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10865