Query on automatic color inversion

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Query on automatic color inversion

    Dear all,

    I would like to experiment on a feature - color inversion of UI elements based on a configuration option.
    If I enable that option, all UI elements should follow a particular theme.
    If I disable it, another theme should have to be applied.

    You can even think it of as a day and night mode feature for the UI screen [so as the user feels comfortable with the color schemes used in the UI during day/night].
    One of the trivial method is to implement a simple LUT to hold these color values corresponding to the mode and set to those color during mode change.

    As emWin seems to be a high-end UI platform (understood from the sample demos created using emWin library) I am curious to know if there are any inbuilt features in emWin that helps me in implementing this feature in a standard way. Could you please share your thoughts on this?

    Looking forward to your replies.
    Thank you,
    Lullaby
  • Automatic color inversion

    Dear all,

    Are there any updates to my query?

    Even if a complex theme change is not possible with emWin, Can anyone point out what can be done with emWin library (Any built-in features) to distinguish the screen in day and night mode?
    Automatic change is not required. Change is only needed on a user input via a button press.


    Thank you,
    Lullaby
  • Hi,

    You can try to invert the screen with the function GUI_InvertRect() but I think it wouldn't look like a night mode (see sample attached).

    Another way might be to set up two diffrent sets of colors for your GUI and reload the color set on button press or any other event.

    With some widgets this can easily be achieved by setting a diffrent property structure with the skinning feature.
    But not all widget are supported by this, so you would have to overwrite some callbacks or set owner draw functions.

    Please refer to capter 22 'Skinning' for more details on how to set diffrent properties or a custom skinning routine.

    Regards,
    Sven
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • Automatic color inversion

    Hi Sven,

    Understood the point. Tried out the sample program as such.

    Suppose if my application has multiple screens and my button for day/night mode transition is present in home screen only,
    can any of these methods be used to color invert all of the screens with a simple button press?

    From a layman point of view, for the second case, we may need the handle of all the widgets (present in every screen) at the home screen button callback and set the skinning properties manually for each and every one of it.
    Do you think there is any easy way to achieve this?

    Could you please share your valuable thoughts on this?

    Thank you for your valuable time and response,
    Regards,
    Lullaby
  • Hi,

    Suppose if my application has multiple screens and my button for day/night mode transition is present in home screen only,

    can any of these methods be used to color invert all of the screens with a simple button press?
    You have to remember which mode it is (day or night) and call GUI_InvertRect everywhere something gets drawn. Not sure how why this shouldn't work outside the home screen.

    From a layman point of view, for the second case, we may need the handle
    of all the widgets (present in every screen) at the home screen button
    callback and set the skinning properties manually for each and every one
    of it.

    Do you think there is any easy way to achieve this?
    The handles of a widget can be quite easily received with the function WM_GetDialogItem() if an ID was set for a widget on creation.
    You can set the skinning properties as a default value, then you do not know a specific handle.

    The most complex part is to define all the diffrent properties (this takes some line of code) but setting the properties can be done quite easily.

    Take a look into the sample (attached). Ok, the colors which are used are not the best, but you should get an idea of how it could be done.

    Regards,
    Sven
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.