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() {
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)

View File

@ -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)
}