How can I find the current background/foreground color?

It seems strange that there is not a specific get function to determine the current background color of a device.  How can this be accomplished when creating a widget and widget glance.  Specifically I have multiple devices with different glance backgrounds.  If I want to stay consistent with the overall look and feel I need to know what current is.  I'm not talking about night mode, I'm asking about simple standard displays.  Fenix 6 glances are black background with white lettering not to mention title in caps, Edge 1050 is white background with black lettering in lower case.  This really seems fundamental to me!  I am not able to find where I could find the current background color or for that matter even the device the widget is running on. Thanks for your help in advance.

  • I am also not using any Styles since they did not allow me to render the glance in the way I wanted for consistency.

    Have you by any chance figured out what type those style "Selectors" are?

    When I define a member variable of type ColorType:

    public static var textColor as ColorType = Graphics.COLOR_WHITE;

    and then later assign a system color:

    textColor = system_color_dark__text;

    I get the following error:

    ERROR: edge850: D:\GitHub\ohg\source-theme\night-mode\Theme.mc:21,12: Cannot assign module definition '$.Rez.Styles.system_color_dark__text' to member variable '$.DefaultTheme.textColor' of type 'PolyType<$.Toybox.Graphics.ColorValue or $.Toybox.Lang.Number>'.

  • Another trap I ran into: on Edge x50 devices, night mode is also used to indicate that a glance is focused. When you scroll to a glance using the hardware buttons, the app temporarily switches to the opposite display mode.

    This does not trigger AppBase.onNightModeChanged(), so you cannot rely on that callback. Instead, you need to check DeviceSettings.isNightModeEnabled() inside onUpdate() and adjust your colors there.

    As far as I can tell from public reviews, the Edge x40 devices use a frame as the focus indicator. I therefore assume, and hope, that night mode is not toggled when a glance receives focus on those devices. Unfortunately, the simulator does not reproduce what happens when the glance is focused, and I only have a physical Edge 850 available for testing.

  • system_color_dark__test is the style, which technically is a module. To get the ColorValue you have to use either system_color_dark__text.color, or system_color_dark__text.background, depending on what you want. This is documented somewhere. Also, in the bin/gen tree there is/are Rez.mcgen file(s). Open a Rez.mcgen and you can find details for all the available styles/personalities.