breautek commented on issue #1967:
URL: 
https://github.com/apache/cordova-android/issues/1967#issuecomment-4907523235

   > I'll test and try to track down exactly what or how the status bar color 
gets decided.
   
   I think I traced down the logic here -- it starts at 
https://github.com/apache/cordova-android/blob/cdbeb603bd6cf2ad7063ba54fd138be97adb5d79/framework/src/org/apache/cordova/SystemBarPlugin.java#L150
   
   Basically it tries to determine the background color of the statusbar area 
and does a luminescence check to determine if it should use light or dark 
appearance...
   
   In the case of E2E mode the background color is always `0` aka 
`TRANSPARENT`, in which case it uses:
   
   ```java
   /**
        * Determines the background color for status bar & root layer.
        * The color will come from the app's R.color.cdv_background_color.
        * If for some reason the resource is missing, it will try to fallback 
on the uiMode.
        * <p>
        * The uiMode as follows.
        *   If night mode: "#121318" (android.R.color.system_background_dark)
        *   If day mode: "#FAF8FF" (android.R.color.system_background_light)
        * If all fails, light mode will be returned.
        * </p>
        * The hex values are supplied instead of "android.R.color" for 
backwards compatibility.
        *
        * @return int color
        */
       @SuppressLint("DiscouragedApi")
       private int getUiModeColor() {
           boolean isNightMode = (resources.getConfiguration().uiMode & 
Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
           String fallbackColor = isNightMode ? "#121318" : "#FAF8FF";
           int colorResId = resources.getIdentifier("cdv_background_color", 
"color", context.getPackageName());
           return colorResId != 0
                   ? ContextCompat.getColor(context, colorResId)
                   : Color.parseColor(fallbackColor);
       }
   ```
   
   Basically this tries to get the `cdv_background_color` resource which by 
default (and appears to be hard-coded) it uses #FAF8FF for day, and #121318 for 
night -- these same values are used as a fallback if the color resource is not 
in the app resources. So the color you get would depend on the system 
appearance settings (whether the OS is using a dark "night" theme or not).
   
   I operate my device in dark theme so the statusbar stays white... But users 
operating in light theme will get a dark font status bar.
   
   This is obviously not really ideal because regardless of the OS theme, it 
might not match what is actually rendered on the screen in E2E mode. So 
definite room for improvement here.
   
   Using `<edit-config>` on the `cdv_colors.xml` resource to replace 
`cdv_background_color` might be a workaround...
   
   There are 4 places that would need manipulation:
   
   - values/cdv_themes.xml
   - values-34/cdv_themes.xml
   - values-night/cdv_themes.xml
   - values-night-34/cdv_themes.xml
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to