Skip to content

feat: add ansi colorscheme, refactor#43

Merged
caarlos0 merged 4 commits intomainfrom
themes
Jun 23, 2025
Merged

feat: add ansi colorscheme, refactor#43
caarlos0 merged 4 commits intomainfrom
themes

Conversation

@caarlos0
Copy link
Copy Markdown
Contributor

@caarlos0 caarlos0 commented Jun 23, 2025

based on #29

uses less colors because the code block gets quite unreadable otherwise.

also improved the mechanics of setting a colorscheme, renamed some methods, etc

looks like this:

CleanShot 2025-06-23 at 10 20 17@2x

@caarlos0 caarlos0 requested review from Copilot and meowgorithm June 23, 2025 13:20
@caarlos0 caarlos0 self-assigned this Jun 23, 2025
@caarlos0 caarlos0 added the enhancement New feature or request label Jun 23, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a refactored color scheme API for the project, deprecating the old theme functions and adding improved ANSI colors support. Key changes include replacing the direct ColorScheme pointer with a function-based approach, adding a new AnsiColorScheme function, and updating the settings and option functions accordingly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
theme.go Refactored color scheme functions; added DefaultColorScheme and AnsiColorScheme; updated mustColorscheme.
fang.go Replaced the theme pointer with a function for colorscheme; added WithColorSchemeFunc; marked WithTheme as deprecated.
Comments suppressed due to low confidence (2)

theme.go:115

  • The signature of mustColorscheme has changed to accept a function instead of a ColorScheme pointer. Consider updating its documentation comment to clearly explain the new parameter type and usage.
func mustColorscheme(cs func(lipgloss.LightDarkFunc) ColorScheme) ColorScheme {

fang.go:28

  • A comment explaining the rationale for switching from a direct ColorScheme pointer to a function type for colorscheme would improve clarity for future maintainers.
	colorscheme func(lipgloss.LightDarkFunc) ColorScheme

@caarlos0
Copy link
Copy Markdown
Contributor Author

caarlos0 commented Jun 23, 2025

after some tuning, also improved spacing when profile is notty/ascii:

CleanShot 2025-06-23 at 14 41 01@2x

same tuning if the block bg is nocolor:

CleanShot 2025-06-23 at 14 41 58@2x

keep as it was on the default profile and conditions:

CleanShot 2025-06-23 at 14 43 29@2x

Copy link
Copy Markdown
Member

@meowgorithm meowgorithm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks so good!

@caarlos0 caarlos0 merged commit bac0327 into main Jun 23, 2025
18 checks passed
@caarlos0 caarlos0 deleted the themes branch June 23, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants