Search code examples
csslessrgba

LESS Compiler Converts RGBA() to Hex


I am creating a LESS stylesheet with the SimpLESS compiler, and I notice when I create an entry using the CSS rbga() function, like this:

@contentDefaultOpacity: 0.5;

header#main-header {
    nav.navbar {
        div.container-fluid {
            div.collapse {
                ul.nav {
                    li {
                        a {
                            @alpha: 255 * @contentDefaultOpacity;

                            color: rgba(255, 255, 255, @alpha);
                        }
                    }
                }
            }
        }
    }
}

The compiler throws away the rgba() and outputs this instead:

header#main-header nav.navbar div.container-fluid div.collapse ul.nav li a {
    color: #ffffff;
}

Is there a way I can retain the rgba()?

Thank you for your time.


Solution

  • LESS' rgba() function takes a percentage between 0% and 100%.
    You're passing 128, which is fully opaque.