mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 22:32:59 +03:00
Replace "ramp" with "gradient" on exposed functions
This commit is contained in:
parent
7e5ef42924
commit
c303de1e85
@ -18,7 +18,7 @@ const (
|
||||
)
|
||||
|
||||
func main() {
|
||||
progress, err := progress.NewModel(progress.WithDefaultRamp())
|
||||
progress, err := progress.NewModel(progress.WithDefaultGradient())
|
||||
if err != nil {
|
||||
fmt.Println("Could not initialize progress model:", err)
|
||||
os.Exit(1)
|
||||
|
@ -21,27 +21,27 @@ var color func(string) termenv.Color = termenv.ColorProfile().Color
|
||||
// )
|
||||
type Option func(*Model) error
|
||||
|
||||
// WithDefaultRamp sets a gradient fill with default colors.
|
||||
func WithDefaultRamp() Option {
|
||||
return WithRamp("#00dbde", "#fc00ff")
|
||||
// WithDefaultGradient sets a gradient fill with default colors.
|
||||
func WithDefaultGradient() Option {
|
||||
return WithGradient("#00dbde", "#fc00ff")
|
||||
}
|
||||
|
||||
// WithRamp sets a gradient fill blending between two colors.
|
||||
func WithRamp(colorA, colorB string) Option {
|
||||
// WithGradient sets a gradient fill blending between two colors.
|
||||
func WithGradient(colorA, colorB string) Option {
|
||||
return func(m *Model) error {
|
||||
return m.setRamp(colorA, colorB, false)
|
||||
}
|
||||
}
|
||||
|
||||
// WithDefaultScaledRamp sets a gradient with default colors, and scales the
|
||||
// WithDefaultScaledGradient sets a gradient with default colors, and scales the
|
||||
// gradient to fit the filled portion of the ramp.
|
||||
func WithDefaultScaledRamp() Option {
|
||||
return WithScaledRamp("#00dbde", "#fc00ff")
|
||||
func WithDefaultScaledGradient() Option {
|
||||
return WithScaledGradient("#00dbde", "#fc00ff")
|
||||
}
|
||||
|
||||
// WithScaledRamp scales the gradient to fit the width of the filled portion of
|
||||
// WithScaledGradient scales the gradient to fit the width of the filled portion of
|
||||
// the progress bar.
|
||||
func WithScaledRamp(colorA, colorB string) Option {
|
||||
func WithScaledGradient(colorA, colorB string) Option {
|
||||
return func(m *Model) error {
|
||||
return m.setRamp(colorA, colorB, true)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user