XF 2.3 How to use an image with variations as a background image

Kirby

Well-known member
I might be missing smth, but it seems like I am unable to figure out how to use an image with variations (like publicLogoUrl) as a background image.

Smth. like
Code:
#myid
{
    background-image: url({$xf.style.getPropertyVariation('publicLogoUrl', 'default'});
   
    .m-colorScheme(dark {
        background-image: url({$xf.style.getPropertyVariation('publicLogoUrl', 'alternate'});
    });
}
might work, but that seems pretty complicated (and kinda inefficient) - there must be a simpler way to do this?
 
That is the way to do it.

 
So I'm having trouble with this. Here is my less code.

CSS:
.fr-box.fr-basic .fr-element:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url({$xf.style.getPropertyVariation('publicLogoUrl', 'default'}) no-repeat bottom right;
 
    .m-colorScheme(dark {
        background: url({$xf.style.getPropertyVariation('publicLogoUrl', 'alternate'}) no-repeat bottom right;
    });  
    background-size: 300px; /* Adjust size as needed */
    opacity: 0.2; /* Set opacity to 20% or whatever you prefer */
    pointer-events: none; /* Make it non-interactive */
    z-index: -1; /* Ensure it appears behind the text content */
}

But when I try to save it I get, "Syntax error - Template modifications: public:extra.less"
 
Last edited:
So this ended up being the correct way to acheive it:
CSS:
    background: url({$xf.style.getPropertyVariation('publicLogoUrl', 'default')}) no-repeat bottom right;
    .m-colorScheme(dark, {
        background: url({$xf.style.getPropertyVariation('publicLogoUrl', 'alternate')}) no-repeat bottom right;
    });
 
Back
Top Bottom