Terminal tints for everyone
lipgloss
and similar tools which support the
color.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!
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