TEXT widget not setting specific background color

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

    • TEXT widget not setting specific background color

      Hi,

      I am using the emwin simulation project. I am setting the background color of the TEXT widget to 0x4E4E4E or 0xE2B501 by using TEXT_SetBkColor.
      The background color is not getting set when i use the above colors. When i set the background color to GUI_RED or GUI_BLUE then the text background color is getting set.
      but specific color values such as 0x4E4E4E , 0xE2B501 are not getting set.

      To check whether it is a color issue i set the same colors 0x4E4E4E and 0xE2B501 to text foreground color using TEXT_SetColor then am able to see the text color change.
      so TEXT_SetBkColor seems to be working for only specific colors.

      Can anyone please help me out regarding this?

      Thanks
      Regards,

      Anuj
    • Hi,

      I found the solution but some issue is still present

      when i apply the same colors to EDIT widget background then it seems to work.
      and to make it work for TEXT widget i have to do GUI_MAKE_COLOR(0x01B5E2) then it works for TEXT widget. as you see here i have swapped the color value too.

      but don't have to use GUI_MAKE_COLOR for EDIT widget background color nor swap the color value.
      Why is that?

      Thanks
      Regards,

      Anuj
    • Hi,

      you can only use the GUI_MAKE_COLOR() macro with ABGR colors, not ARGB.

      With emWin V5.44, the default color format was changed from ABGR to ARGB. It is not that important to which color format you are using, but important is that you don't pass colors just as a hex value, but use the GUI_MAKE_COLOR() macro. This ensures that the given hex value will always be converted into the correct format.

      Best regards,

      Florian
    • Hi,

      How should i go about it if i don't want to use GUI_MAKE_COLOR() as i have all colors in ARGB format. I cannot use GUI_MAKE_COLOR as it requires ABGR format. The current colors i am using are in ARGB format. It seems i will have to swap the colors and pass to GUI_MAKE_COLOR. I get the expected result on the screen when i do this.

      How do i avoid using the GUI_MAKE_COLOR().

      Thanks
      Regards,

      Anuj
    • Hi,

      you can try with this macro that swaps the colors from ARGB to ABGR:

      C Source Code

      1. #define MAKE_COLOR(ARGB) GUI_MAKE_COLOR((((((U32)ARGB) & 0x00FF0000ul) >> 16) | (((U32)ARGB) & 0x0000FF00ul) | ((((U32)ARGB) & 0x000000FFul) << 16)))
      2. #define COLOR MAKE_COLOR(0xE2B501)
      Best regards,

      Florian