Skip to content

Add custom ansi colors and CSS variables for them #25546

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

Merged
merged 3 commits into from
Jun 28, 2023

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Jun 27, 2023

Use our existing color palette to map to the 16 basic ansi colors. This is backwards-compatible because it aliases the existing color names.

Side note: I think the colors in console.css for console file rendering are incomplete, but fixing those is out of scope here imo.

Before and after:

Screenshot 2023-06-28 at 00 26 12 Screenshot 2023-06-28 at 00 28 24

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 27, 2023
@silverwind silverwind added type/enhancement An improvement of existing functionality topic/gitea-actions related to the actions of Gitea labels Jun 27, 2023
@silverwind silverwind added the topic/ui Change the appearance of the Gitea UI label Jun 27, 2023
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 28, 2023
@wxiaoguang
Copy link
Contributor

Does it affect 256 and other colors?

@silverwind
Copy link
Member Author

silverwind commented Jun 28, 2023

No, only 16 colors. 256 colors and above still use inline style and I don't think ansi_up supports classes for those either. It's validated in this existing test:

  expect(renderAnsi('\x1b[48;5;88ma\x1b[38;208;48;5;159mb\x1b[m')).toEqual(`<span style="background-color:rgb(135,0,0)">a</span><span style="background-color:rgb(175,255,255)">b</span>`);

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 28, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 28, 2023
@silverwind silverwind merged commit fdab4e3 into go-gitea:main Jun 28, 2023
@GiteaBot GiteaBot added this to the 1.21.0 milestone Jun 28, 2023
@silverwind silverwind deleted the ansi branch June 28, 2023 13:39
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jun 28, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/gitea-actions related to the actions of Gitea topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants