-
-
Notifications
You must be signed in to change notification settings - Fork 34
feat: make gradient colours configurable (#133) #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new --gradient flag to customize the progress bar gradient via presets or custom hex pairs.
- Introduce
gradientFlagand register the--gradientCLI option with help text. - Define
gradientPresetsmap and select the appropriate gradient at runtime. - Replace the hardcoded default gradient with dynamic gradient handling in
main.go.
Comments suppressed due to low confidence (1)
main.go:162
- The new gradient parsing logic lacks unit tests. Add tests covering preset selection, custom hex parsing, and invalid-input fallback to ensure expected behavior.
var progressBar progress.Model
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
caarlos0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey, thanks for the pr
have a couple of comments
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new --gradient flag to allow users to customize the progress bar gradient using predefined presets or two custom hex colors.
- Introduced
gradientflag andgradientPresetsmap. - Implemented logic to select a preset or parse custom hex colors.
- Updated the Cobra command initialization to register and document the new flag.
Comments suppressed due to low confidence (2)
main.go:170
- [nitpick] Enhance this error message by listing valid presets or the expected format to guide users (e.g. "invalid gradient %q; valid presets are %v or two hex colors separated by a comma").
return fmt.Errorf("invalid gradient %q", gradient)
main.go:218
- Add unit tests for the new
--gradientflag, covering valid presets, valid custom color pairs, and invalid inputs to ensure the parsing logic behaves as expected.
rootCmd.Flags().StringVarP(&gradient, "gradient", "g", "default", "Gradient preset (default, sunset, aqua, forest, fire) or two hex colors separated by comma (ex: --gradient=#00FF00,#0000FF)")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add configurable gradient support for progress bar
This PR introduces a new
--gradient (-g)flag that allows users to customize the progress bar gradient. Users can now select from predefined presets (default, sunset, aqua, forest, fire) or specify two custom hex colors separated by a comma (e.g., --gradient=#00FF00,#0000FF). If the flag is not set or an invalid value is provided, the default gradient is used.Features:
New --gradient flag for selecting gradient style.
Support for both presets and custom color pairs.
Updated help text to document the new flag.