HTMLText image (<img>) coloroverlay or background color

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
heyvern
Posts: 30
Joined: Sun Feb 21, 2010 12:38 am

HTMLText image (<img>) coloroverlay or background color

Post by heyvern » Sun Mar 07, 2010 2:17 am

I am using a project I found called "XML Tree". Working great for my project.

My question pertains to the <img> tag for inserting icons. I understand that RR has a "rudimentary" version of html built in for styling text and inserting graphics with text in a field. What I would like to do is to change the overlay color of an image inserted into the field. Can a single image referenced multiple times in a field have it's background color or overlay color changed? If so how do I know which one is which?

Basically what I'm doing is loading this icon for attributes in an xml file. Each of these attributes has an rgb color value I can extract. I would like to apply that rgb color to the image used as an icon for that line of the xml tree in the field. The code used to apply the icon is very simple:

Code: Select all

"<img src=" & quote & imageVariable & quote & ">"
Is there a way in that spot to apply the foreground or color overlay value? At this point in the processing I would have access to the color value in an array and can easily pull it out and "stick it in there"... uh... if I knew how. ;) IT seems that the HTMLText doesn't have that kind of styling? Is there a way to access an "ID" of that image? The tricky part for me is that it's just one image I want to change for each tag in a specific section of the xml or html text in a field.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: HTMLText image (<img>) coloroverlay or background color

Post by Mark » Sun Mar 07, 2010 10:18 am

heyvern,

Indeed, it seems that RunRev doesn't have that kind of styling, but you might try to set the backColor of the character that your image is attached to.

set the backColor of char 345 of fld "Your XML Display" to red

I don't know whether this works for images.

Best regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

heyvern
Posts: 30
Joined: Sun Feb 21, 2010 12:38 am

Re: HTMLText image (<img>) coloroverlay or background color

Post by heyvern » Sun Mar 07, 2010 11:05 pm

Thanks, yes, that was my next option.

Another option which I have to "learn" first would be to create the image reference "on the fly". Create a new graphic (very very very tiny. A few pixels of flat color) and then insert that into the HTMLText. This would work well because the text is processed before the icons are needed so I could loop through all the elements, create a whole pile of tiny icon images and then assign them to the HTML when the item is displayed. This wouldn't be too much overhead since the image files could even be 1 and scaled up. Or maybe I could use 1 original image and "copy/paste" it and fill it with a different color using the paint tools.

My concern would be the overhead on the application with all of those little images. However the total amount would barely be larger than 1 really big image in an application.

Post Reply