Skip to first unread message

amrinder kamboj

unread,
Jul 23, 2014, 9:05:59 AM7/23/14
to mitappinv...@googlegroups.com
Hello Guys,
any idea how to create color palette as shown in attached file, i want to select particular color when clicked then set it canvas color.
I am able to create a sort of this stuff but not exactly like this....i have to create individual blocks for each color :( .... .i want to avoid creating such mess

any help would be appreciated

thnks
Capture.PNG
myblock.PNG

Taifun

unread,
Jul 23, 2014, 10:23:34 AM7/23/14
to mitappinv...@googlegroups.com
see Scott's examples https://groups.google.com/forum/#!searchin/app-inventor-developers-library/color$20picker
Taifun

Trying to push the limits of App Inventor! Snippets and Tutorials from Pura Vida Apps by Taifun.         

Gareth Haylings

unread,
Jul 23, 2014, 10:27:39 AM7/23/14
to mitappinv...@googlegroups.com
An easier way to do this is to use a canvas and set the Canvas.BackgroundImage to the a picture of the color chart. In you block code add the following

Hope This helps


Scott Ferguson

unread,
Jul 23, 2014, 10:23:59 PM7/23/14
to mitappinv...@googlegroups.com
If you want to use the palette in your Capture.PNG image then you can place that image as the background of a canvas.
When the user touches it, use the Canvas Touched event block to get the Canvas GetPixelColor (x,y) of the touched point.
That color value can then be used anywhere a color is needed.
---
sf

amrinder kamboj

unread,
Jul 24, 2014, 2:28:04 AM7/24/14
to mitappinv...@googlegroups.com
hi Scott/Taifun, I used the block that you mentioned but it doent seem to working.

Image1 is the capture.png 

i m using Samsung Galaxy Express GT-i8730 ( 4.1.2)



block.PNG

Gareth Haylings

unread,
Jul 24, 2014, 3:13:37 AM7/24/14
to mitappinv...@googlegroups.com
Hi

The reason it is not work is because you can't change the canvas.backgroundcolor when you have a canvas.backgroundimage set.  To correct this you need to set you canvas.backgroundimage="" after the canvas.getbackgroundpixelcolor as below

Hope this helps



amrinder kamboj

unread,
Jul 24, 2014, 5:29:47 AM7/24/14
to mitappinv...@googlegroups.com
Thanks Gareth .... it worked
Reply all
Reply to author
Forward
Message has been deleted
0 new messages