Set the Opacity of a Button Background

Randy Hengst iowahengst at mac.com
Tue Mar 1 15:20:40 EST 2016


It sounds to me that you want the color of the button to be 50% … meaning that the card (or whatever) below it will show though. And, you want the border and name of button to be opaque… if all that is correct, you might want to give this a try.

create an image in the color you want the button background to be … perhaps white (you can do that within LC with import snapshot). Then assign that image as the icon for the button (you’ll have to fiddle with sizing the image). Set the iconGravity of the button to “center”. Then adjust the blendLevel of the image and you’ll see that reflected in the button’s background.

If you just set the blendLevel of the button, then the name and border will also change opacity.

be well,
randy

Randy Hengst
www.classroomFocusedSoftware.com


> On Mar 1, 2016, at 1:25 PM, Sannyasin Brahmanathaswami <brahma at hindu.org> wrote:
> 
> We looking at very simple button design:
> 
> 1)  Border color is on/white/2px
> 2)  background is set to clear (no color assignment and no icon)
> 3)  background opacity set to 50% # if we can figure out how....
> 4)  Button name/label white
> 
> Now... I realize that if # 2 above is true, then possibly, since there are no pixels at all in the background that the algorithm might not be possible from a video card point of view... so we *could* set the background to white and set the opacity to a grayscale?transparency value of say... 50%  but the idea is that the text of the button name/label remains fully, 100% opaque, even thought background has an alpha channel value (some level of transparency)
> 
> From my fiddling... (I could be missing something) this is not possible either with buttons of fields  or graphics.
> 
> The use case is, again, as discussed in another thread: we want visibility of the text on top of *any* image to be visible. We do this in print all the time... but we cannot separate the blending of the text label or text itself and the background of a button/field in LC... at least I have not found a way.
> 
> 
> 
> 
> 
> On March 1, 2016 at 9:15:36 AM, RM (richmondmathewson at gmail.com<mailto:richmondmathewson at gmail.com>) wrote:
> 
> Do you mean that you want a button where an icon/image is set at 100%
> opacity and the rest of
> the button to, say, 50% transparency?
> 
> Would be grateful if you could clarify this.
> 
> Richmond.
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list