Replace "ramp" with "gradient" on exposed functions

This commit is contained in:
Christian Rocha 2020-11-20 10:47:01 -05:00 committed by Christian Rocha
parent 7e5ef42924
commit c303de1e85
2 changed files with 11 additions and 11 deletions

View File

@ -18,7 +18,7 @@ const (
) )
func main() { func main() {
progress, err := progress.NewModel(progress.WithDefaultRamp()) progress, err := progress.NewModel(progress.WithDefaultGradient())
if err != nil { if err != nil {
fmt.Println("Could not initialize progress model:", err) fmt.Println("Could not initialize progress model:", err)
os.Exit(1) os.Exit(1)

View File

@ -21,27 +21,27 @@ var color func(string) termenv.Color = termenv.ColorProfile().Color
// ) // )
type Option func(*Model) error type Option func(*Model) error
// WithDefaultRamp sets a gradient fill with default colors. // WithDefaultGradient sets a gradient fill with default colors.
func WithDefaultRamp() Option { func WithDefaultGradient() Option {
return WithRamp("#00dbde", "#fc00ff") return WithGradient("#00dbde", "#fc00ff")
} }
// WithRamp sets a gradient fill blending between two colors. // WithGradient sets a gradient fill blending between two colors.
func WithRamp(colorA, colorB string) Option { func WithGradient(colorA, colorB string) Option {
return func(m *Model) error { return func(m *Model) error {
return m.setRamp(colorA, colorB, false) 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. // gradient to fit the filled portion of the ramp.
func WithDefaultScaledRamp() Option { func WithDefaultScaledGradient() Option {
return WithScaledRamp("#00dbde", "#fc00ff") 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. // the progress bar.
func WithScaledRamp(colorA, colorB string) Option { func WithScaledGradient(colorA, colorB string) Option {
return func(m *Model) error { return func(m *Model) error {
return m.setRamp(colorA, colorB, true) return m.setRamp(colorA, colorB, true)
} }