Announcement

Collapse
No announcement yet.

button bg color and single byte rgb

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • button bg color and single byte rgb

    Is there a way to make a button or label reflect a chosen color picked from a color picker and is it possible to send the chosen color in single byte per color rgb instead of hex?

  • #2
    Are you talking about ViSi Buttons and labels?

    If so you just click on the color property and then the ellipsis that appears, when you set the colour in there you can see the hex code just above the OK button. You can also see the RGB code above the cancel button.

    To convert an RGB colour to 565 you can use the gfx_RGBto565() function.

    There is also the predefined colour names in the "4DGL_16bitColours.fnc" file
    Mark

    Comment


    • #3
      Am planning on using the color picker widget i in genie to choose a color for rgb leds connected to arduino mega pwm. Would like a label or button to reflect the current color of the leds
      Last edited by ElectricCraft1; 3 July 2014, 08:57 AM.

      Comment


      • #4
        I think I'm missing something if you just draw a filled rectangle with the value from the color picker isn't that 'it'?
        Mark

        Comment


        • #5
          No, the color is to be dynamic, to change based on user chosen color. Have a change led color button which opens the color picker widget, the user picks a color, the button changes to that color as well as the led.

          Comment


          • #6
            Right, so you just redraw the filled rectangle when the color picker changes.

            Perhaps you need to show your code, so I can properly understand what you are actually doing.
            Mark

            Comment


            • #7
              I have no code as of yet. Just received my screen and am trying to work out the detail before I actually begin. Like I said, I will be using Visi genie since my code writing skills are lacking. Just wanted to know if it was possible and how to do it in that platform.

              Comment


              • #8
                Right, so you will find you cannot do this in Genie, the supplied ViSi example, so actually already do what you want. Whether you can use this to easily achieve what you are after depends a lot on what else you want to achieve
                Mark

                Comment


                • #9
                  CONTROL DISPLAYED SCREEN COLORS WITH SEPARATE RGB VARIABLES

                  Originally posted by ESPsupport View Post
                  Are you talking about ViSi Buttons and labels?

                  If so you just click on the color property and then the ellipsis that appears, when you set the colour in there you can see the hex code just above the OK button. You can also see the RGB code above the cancel button.

                  To convert an RGB colour to 565 you can use the gfx_RGBto565() function.

                  There is also the predefined colour names in the "4DGL_16bitColours.fnc" file
                  I found this function isn't included in the Picaso_Serial_4DLib and I also doubt its in the Goldelox either...but the function isn't really needed anyway.

                  Here's an easy way to generate the desired RGB565 displayed colors from three int variables red, green, blue. with minimal code
                  (Credit given to Barth Development - RGB565 Color Picker)


                  Code:
                  int red, green, blue, rgb565;
                  
                  rgb565 = (((red & 0b11111000)<<8) + ((green & 0b11111100)<<3)+(blue>>3)); // binary conversion
                  
                  //sample usage draw a rgb565 filled rectangle from 0,60 to  239,102
                  
                  my_display_instance.gfx_RectangleFilled(0,60,239,102,rgb565);
                  Last edited by db2wings; 3 November 2019, 06:14 AM.

                  Comment

                  Working...
                  X