- ✔️ Utilize 280+ built-in tints. Check them all out here! We're taking advantage of the great work others have done with Windows Terminal Themes and iTerm2-Color-Schemes, and making them more accessible in a programmatic fashion.
- ✔️ Support for dynamically changing tints at runtime, to give immediate feedback on which tints might look the best for your application and terminal setup.
- ✔️ Piecemeal support for specific tints. Really like one specific tint, and want to use that as the standard for your TUI? No problem!
- ✔️ Extendible via interfaces. Easily create custom tints.
- ✔️ Works with
lipgloss
and similar tools which support thecolor.Color
interface from stdlib!
go get -u github.com/lrstanley/bubbletint@latest
Take a look at all tints here.
BubbleTint supports three different modes of usage, as shown below:
package main
import (
// [...]
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())
}
package main
import (
// [...]
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())
}
package main
import (
// [...]
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!
- Uses a static theme with a specific palette for the entire application.
- Example source.
- 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.
- ❤️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
- 🙋♂️ Take a look at the support document on guidelines for tips on how to ask the right questions.
- 🐞 For all features/bugs/issues/questions/etc, head over here.
- ❤️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
- 📋 Please review the contributing doc for submitting issues/a guide on submitting pull requests and helping out.
- 🗝️ For anything security related, please review this repositories security policy.
MIT License
Copyright (c) 2022 Liam Stanley <[email protected]>
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