Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Actions] Support 256 colors #24777

Closed
silverwind opened this issue May 17, 2023 · 3 comments · Fixed by #25401
Closed

[Actions] Support 256 colors #24777

silverwind opened this issue May 17, 2023 · 3 comments · Fixed by #25401
Labels
proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. topic/gitea-actions related to the actions of Gitea type/enhancement An improvement of existing functionality type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@silverwind
Copy link
Member

silverwind commented 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
@silverwind silverwind added type/proposal The new feature has not been accepted yet but needs to be discussed first. type/feature Completely new functionality. Can only be merged if feature freeze is not active. topic/gitea-actions related to the actions of Gitea labels May 17, 2023
@silverwind silverwind changed the title [Actions] Support 256 and 16m colors [Actions] Support 256 colors May 17, 2023
@wxiaoguang
Copy link
Contributor

wxiaoguang commented 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)

@silverwind
Copy link
Member Author

silverwind commented 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 silverwind added type/enhancement An improvement of existing functionality and removed type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels May 18, 2023
@yardenshoham yardenshoham added the proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. label May 18, 2023
@lafriks
Copy link
Member

lafriks commented May 19, 2023

I did use ansi_up in woodpecker and it works quite good

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
proposal/accepted We have reviewed the proposal and agree that it should be implemented like that/at all. topic/gitea-actions related to the actions of Gitea type/enhancement An improvement of existing functionality type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants