https://github.com/lrstanley/bubbletint
Terminal tints for everyone
https://github.com/lrstanley/bubbletint
bubbletea cli go golang lipgloss terminal theme themes tui xterm
Last synced: 6 months ago
JSON representation
Terminal tints for everyone
- Host: GitHub
- URL: https://github.com/lrstanley/bubbletint
- Owner: lrstanley
- License: mit
- Created: 2022-10-31T03:39:07.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-02-19T02:58:50.000Z (8 months ago)
- Last Synced: 2025-03-30T19:05:32.492Z (6 months ago)
- Topics: bubbletea, cli, go, golang, lipgloss, terminal, theme, themes, tui, xterm
- Language: Go
- Homepage: https://pkg.go.dev/github.com/lrstanley/bubbletint
- Size: 1.11 MB
- Stars: 89
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
- Security: .github/SECURITY.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
README
## :link: Table of Contents
- [Features](#sparkles-features)
- [Usage](#gear-usage)
- [Global registry](#global-registry)
- [Custom Registry](#custom-registry)
- [Use specific tints](#use-specific-tints)
- [Examples](#clap-examples)
- [Package manager example](#package-manager-example)
- [Complex example](#complex-example)
- [Support & Assistance](#raising_hand_man-support--assistance)
- [Contributing](#handshake-contributing)
- [License](#balance_scale-license)## :sparkles: Features
- :heavy_check_mark: Utilize 280+ built-in tints. [Check them all out here!](./DEFAULT_TINTS.md)
We're taking advantage of the great work others have done
with [Windows Terminal Themes](https://windowsterminalthemes.dev/)
and [iTerm2-Color-Schemes](https://github.com/mbadolato/iTerm2-Color-Schemes),
and making them more accessible in a programmatic fashion.
- :heavy_check_mark: Support for dynamically changing tints at runtime, to give
immediate feedback on which tints might look the best for your application and
terminal setup.
- :heavy_check_mark: Piecemeal support for specific tints. Really like one specific
tint, and want to use that as the standard for your TUI? No problem!
- :heavy_check_mark: Extendible via interfaces. Easily create custom tints.
- :heavy_check_mark: Works with `lipgloss` and similar tools which support the
`color.Color` interface from **stdlib**!---
## :gear: Usage
```console
go get -u github.com/lrstanley/bubbletint@latest
```[Take a look at all tints here](./DEFAULT_TINTS.md).
BubbleTint supports three different modes of usage, as shown below:
### Global registry
```go
package mainimport (
// [...]
tint "github.com/lrstanley/bubbletint"
)func main() {
// [...]
tint.NewDefaultRegistry()
tint.SetTint(tint.TintDraculaPlus) // Set a specific tint.
tint.SetTintID("dracula_plus") // Or by ID (this aligns with a Tint's ID() method).// You can now use methods like tint.Bg(), tint.Fg(), tint.BrightGreen(), etc.
style := lipgloss.NewStyle().SetForeground(tint.Fg()).Background(tint.BrightGreen())
}
```### Custom Registry
```go
package mainimport (
// [...]
tint "github.com/lrstanley/bubbletint"
)func main() {
// [...]
theme := tint.NewRegistry(
tint.TintDraculaPlus, // Set default/current tint.
tint.TintGithub,
tint.TintTomorrow,
tint.TintTokyoNight,
}theme.Register(tint.TintNord) // Register additional tints on the custom registry.
theme.SetTint(tint.TintNord) // Can still set a tint on a custom registry.// Can also paginate through tints, using PreviousTint/NextTint
theme.NextTint()// You can now use methods like theme.Bg(), theme.Fg(), theme.BrightGreen(), etc.
style := lipgloss.NewStyle().SetForeground(theme.Fg()).Background(theme.BrightGreen())
}
```### Use specific tints
```go
package mainimport (
// [...]
tint "github.com/lrstanley/bubbletint"
)var (
statusbarStyle = lipgloss.NewStyle().
SetForeground(tint.TintDraculaPlus.Fg()).
Background(tint.TintDraculaPlus.BrightGreen())
)// Or:
var (
theme = tint.TintDraculaPlus
statusbarStyle = lipgloss.NewStyle().SetForeground(theme.Fg()).Background(theme.BrightGreen())
)
```... and that's it!
---
## :clap: Examples
### Package manager example
- Uses a static theme with a specific palette for the entire application.
- [Example source](./examples/package-manager/main.go).
### Complex example
- Uses the default registry (with all tints), and has keybinds to paginate through each tint.
- Note that only a portion of this example is styled (e.g. not a full background color, which
may make sense for some of the provided tints).
- [Example source](./examples/complex).
---
## :raising_hand_man: Support & Assistance
* :heart: Please review the [Code of Conduct](.github/CODE_OF_CONDUCT.md) for
guidelines on ensuring everyone has the best experience interacting with
the community.
* :raising_hand_man: Take a look at the [support](.github/SUPPORT.md) document on
guidelines for tips on how to ask the right questions.
* :lady_beetle: For all features/bugs/issues/questions/etc, [head over here](https://github.com/lrstanley/bubbletint/issues/new/choose).## :handshake: Contributing
* :heart: Please review the [Code of Conduct](.github/CODE_OF_CONDUCT.md) for guidelines
on ensuring everyone has the best experience interacting with the
community.
* :clipboard: Please review the [contributing](.github/CONTRIBUTING.md) doc for submitting
issues/a guide on submitting pull requests and helping out.
* :old_key: For anything security related, please review this repositories [security policy](https://github.com/lrstanley/bubbletint/security/policy).## :balance_scale: License
```
MIT LicenseCopyright (c) 2022 Liam Stanley
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```_Also located [here](LICENSE)_