Creating Web galleries: Calling a colour directly in a gallery

Uncategorized Web Gallery

I’m in the middle of a standalone flash slideshow/gallery (different than the LRB XML Flash gallery!) and came across an issue which corresponds to both galleries.
Basically to make the Flash more effective I needed to be able to change the background colour of the flash. This is defined in the flash call in the HTML normally. The OBJECT code uses param name=”bgcolor” value=”#000000″, with EMBED using bgcolor=”#000000″. So I just drop in a nonCSS variable to call the Web colour? Wrong.. Or so I found out.

If I define my variable in the galleryInfo.lrweb file
[“nonCSS.flashBG”] = “#000000”,

And then call it in my HTML using either
<%= model.nonCSS.flashBG %>

I don’t get the colour appearing. I get AgColor(0,0,0,1). Now 99% of my learning coding came from looking at other galleries, but I hadn’t seen a way to do the conversion from Lightroom to Web colour (or at least noticed it!). Fortunately Andy Rahn suggested using AgColorToWebColor( nonCSS.flashBG ). Now it was a bit cryptic, because it didn’t tell me how to call it. Was it a string? or a quote? Eventually between digging and trying everything (literally), I came up with the answer.

There is probably a shorter way, but here’s what I did:
galleryInfo.lrweb: In the model section I define 2 variables:
[“nonCSS.flashBG”] = “#000000”,
[“”] = function() return string.format( “%s”, AgColorToWebColor( nonCSS.flashBG ) ) end,

In my HTML I call
param name=”bgcolor” value=”<%= %>”
bgcolor=”<%= %>“

To give me control over colour in the Gallery itself, I define a colour chip in the colorPalette section of views:

WPGPanelUI.label_and_color_row {
bindingValue = “nonCSS.flashBG”,
title = “Flash Background Colour”,

Hopefully this will help some of you with getting on with creating your own galleries. I intend doing a series of posts creating galleries from scratch for Lightroom News soon. I did eventually find examples of where this is used inside the default HTML gallery, but didn’t understand what was happening with it until Andy sent me in the right direction.

2 thoughts on “Creating Web galleries: Calling a colour directly in a gallery

  1. I’ve done that in several galleries. AgColorToWebColor is a useful thing to know. On some occasions, I’ve had to double up on nonCSS variables. On others, I’ve put the AgColorToWebColor command into my appearance settings. I think I’d originally pulled it from the code for the LR HTML Gallery.

Leave a Reply

Your email address will not be published. Required fields are marked *