Skip to content

Add ability to change Progress Bar background color. #20

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

Closed
demongod77 opened this issue Jan 5, 2021 · 17 comments
Closed

Add ability to change Progress Bar background color. #20

demongod77 opened this issue Jan 5, 2021 · 17 comments

Comments

@demongod77
Copy link

Currently the background color is hardcoded in the library.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 5, 2021

you can change the colors used with parameters in the constructor. See the magtag example script here for an example of using custom colors:

x, y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x666666, outline_color=0xFFFFFF

The full init is:

progress_bar = ProgressBar(
    x, y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x666666, outline_color=0xFFFFFF
)

@demongod77
Copy link
Author

When I say background color, I am talking about the rightmost portion when the progress is less than 100%.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 7, 2021

Ah I see what you mean, I do think it would be good to allow it to be set to any color instead of hard-coded to 0x0.

Are you interested in making a PR with this change? We can help you along the way if you are new to git or github.

If not I can try to work on this enhancement later this week or next.

@demongod77
Copy link
Author

Yes, I would like to do the pull request, but would need some help walking me through how to so.

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Jan 7, 2021

Awesome! Thank you for being willing to contribute. For now I will link to you some great guides, and ask a few more questions so I can try to get a good understanding of your current level of experience with it so I know how to best help.

Taking a quick step back... Do you have an idea of what needs to change within the library code in order to support custom backgrounds? or would you like a point in the right direction on that front as well?

These guides cover git / github and the other tools that are needed when working on Circuit Python related libraries:

@demongod77
Copy link
Author

I have made the update to my local copy and seems to be working correctly. I will read through those guides over the next few days.

@demongod77
Copy link
Author

Other things came up, I am not going to be able to do my own pull request on this for a while. I can provide my version with the update I did locally.

@FoamyGuy
Copy link
Contributor

No worries. That would be great if you can provide your version.

I'll work on getting this implemented.

@demongod77
Copy link
Author

What would be the best way to do so? Copy here or attach?

@FoamyGuy
Copy link
Contributor

whatever is easiest for you honestly. you can paste here if you put triple back ticks around it (shift tilda key) it will get formatted:

# example

or you can try attaching the file. Maybe make it a txt file first, there may be restriction on type.

@demongod77
Copy link
Author

Lets see how this goes.
adafruit_progressbar.txt

@FoamyGuy
Copy link
Contributor

Perfect! Thank You for that! I'll work on getting a PR in with this.

@demongod77
Copy link
Author

Much thanks.

@hugodahl
Copy link
Contributor

This is one of the changes I've made as part of issue #21. While I intended to address it as its own separate issue, I got into it as I was refactoring and "in the plumbing".

@hugodahl
Copy link
Contributor

hugodahl commented May 1, 2021

This has been added as of v2.0 of the ProgressBar project when using either the HorizontalProgressBar or VerticalProgressBar widgets, and setting the fill_color property.

@hugodahl
Copy link
Contributor

hugodahl commented May 1, 2021

I recommend we close this issue as resolved, @CircuitPythonLibrarians.

@jposada202020
Copy link
Contributor

Closed by #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants