Skip to content
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

Status bar color #58

Open
danieleorlando opened this issue Jan 16, 2017 · 8 comments
Open

Status bar color #58

danieleorlando opened this issue Jan 16, 2017 · 8 comments

Comments

@danieleorlando
Copy link

Hi, I just added support to status bar color on my local project.
Only 3 lines of code on Android, but it needs an update on JSON file too.

How can I help you to release officially?

@gliechtenstein
Copy link
Contributor

Are you trying to set a different color for the status bar compared to the toolbar? or are they the same color?

The reason I ask is because maybe it's a better idea to just make the statusbar color match the toolbar color, assuming that that's what most people would want.

@danieleorlando
Copy link
Author

It's a different color. Cause in Material Design guidelines, status bar has a darker color from toolbar

I added this on JasonViewActivity.java in setup_header function
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { String statusColor = header.getJSONObject("style").getString("status"); getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); getWindow().setStatusBarColor(JasonHelper.parse_color(statusColor)); }

As you can see, I added "status" also on JSON file structure

@realitix
Copy link
Contributor

Hello @gliechtenstein.
I think it's a good idea to let user customize status bar color, it's just a single string.
Do we do it ?

@gliechtenstein
Copy link
Contributor

@realitix iOS provides only two options (.default and .lightcontent) https://developer.apple.com/documentation/uikit/uistatusbarstyle?language=objc

Basically, there are two modes on iOS:

  1. UIStatusBarStyleLightContent: white text with transparent background
  2. UIStatusBarStyleDefault: black text with transparent background

uistatusbarstyle

For now we are trying to keep the JSON markup as cross-platform as possible, so one idea I have is do something similar for Android instead of manual color setting. Any better ideas?

@maks
Copy link
Contributor

maks commented Jul 20, 2017

Tricky to keep it x-platform. Perhaps allow any colour on android and on iOS ignore if not 000 or fff ?

@danieleorlando
Copy link
Author

If you want to keep the JSON markup as cross-platform as possible, the only way is to use material color 700 for the status bar only when the toolbar color is a 500 color

https://material.io/guidelines/style/color.html

@maks
Copy link
Contributor

maks commented Jul 20, 2017

@danieleorlando sorry I don't follow what you mean about the colours?

@danieleorlando
Copy link
Author

@maks

Material design specs:

"A primary color is the color displayed most frequently across your app’s screens and components. It can also be used to accent elements, if you don’t have a secondary color.

To create contrast between elements, you can use lighter or darker tones of your primary color. The contrast between lighter and darker tones helps show division between surfaces, such as between the status bar and a toolbar."

So, primary color (toolbar) is the one on JSON.

If this color is in Material Design Palette (#500), we pick the darker version (#700) and set to status bar.

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