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

Add a theme based on the 3-bit ANSI colors #159

Merged
merged 1 commit into from
Sep 26, 2023

Conversation

andrejp88
Copy link
Contributor

This PR adds a new color which uses the 3-bit ANSI colors rather than using the 256-bit colors as in the existing themes. Since Clipboard only has five colors in its output, I was able to stick to just those 3-bit colors and no high-intensity variants.

I would have opened an issue for this, but I checked out the code and it looked so easy to add this that I just went for it. I hope that's ok 🙂

I named the theme ansi because that's what Bat calls its version of this theme.

Motivation and Demo

The built-in themes weren't enough for me because some of the terminals I use are set to a light theme, and others are set to a dark theme. Unfortunately, the light-friendly themes don't look great when running in a dark terminal and vice versa.

The nice thing about those 3-bit colors is that they're theme-agnostic. Themes are usually designed to have readable colors with good contrast, so command line tools can take advantage of that to output text that is guaranteed to be readable no matter the user's terminal theme preferences. In other words, there's no reason to have separate dark and light variants.

As an example, here's what Clipboard's light theme looks like in my low-saturation, light-themed VSCode terminal:
Screenshot_20230926_202050

And here it is using the new ansi theme:
Screenshot_20230926_201822

I think the latter fits in much better with the overall vibe, and matches the colors of the prompt and most other colored output.

@codecov
Copy link

codecov bot commented Sep 26, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (59d1f12) 68.20% compared to head (0f789b3) 68.18%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #159      +/-   ##
==========================================
- Coverage   68.20%   68.18%   -0.03%     
==========================================
  Files          77       78       +1     
  Lines        5324     5374      +50     
==========================================
+ Hits         3631     3664      +33     
- Misses       1693     1710      +17     
Files Coverage Δ
src/cb/src/themes.cpp 100.00% <100.00%> (ø)

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Slackadays
Copy link
Owner

Thanks! 😎

@Slackadays Slackadays merged commit 8f8d4c5 into Slackadays:main Sep 26, 2023
34 of 81 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants