Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From the <a href="http://lesscss.org/#-javascript-evaluation" rel="nofollow">docs</a>:</p> <blockquote> <p>However, if you still want to use JavaScript in .less, this is done by wrapping the expression with back-ticks:</p> </blockquote> <pre><code>@var: `"hello".toUpperCase() + '!'`; </code></pre> <p>So your line should be this (I think):</p> <pre><code>@ievalue:`Math.floor(@alpha * 255).toString(16)`; </code></pre> <p>And since you're using a variable inside, you might need to use <a href="http://lesscss.org/#-string-interpolation" rel="nofollow">string interpolation</a>, but then again, you might not, because your @alpha isn't inside a string. If that doesn't work, give this a try:</p> <pre><code>@ievalue:`Math.floor(@{alpha} * 255).toString(16)`; </code></pre> <p><em>That one looks funny, I think it's wrong. Hopefully the first one works. But it looks like you will need to use interpolation where you later do this:</em></p> <pre><code>"...#@ievalue+@myred+@mygreen+@myblue..." </code></pre> <p><em>Because you are inside a string on the last line of your example code, I think that should be:</em></p> <pre><code>"...#@{ievalue}+@{myred}+@{mygreen}+@{myblue}..." </code></pre> <p>As for your latest question, you probably need to use this other bit called Escaping:</p> <blockquote> <p><strong><a href="http://lesscss.org/#-escaping" rel="nofollow">Escaping</a></strong></p> <p>Sometimes you might need to output a CSS value which is either not valid CSS syntax, or uses proprietary syntax which LESS doesn’t recognize.</p> <p>To output such value, we place it inside a string prefixed with ~, for example:</p> </blockquote> <pre><code>.class { filter: ~"ms:alwaysHasItsOwnSyntax.For.Stuff()"; } </code></pre> <p>So your last two lines should probably be this:</p> <pre><code>filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=#@{ievalue}+@{myred}+@{mygreen}+@{myblue}, endColorstr=#@{ievalue}+@{myred}+@{mygreen}+@{myblue})"; /* For IE 8*/ -ms-filter: ~"progid:DXImageTransform.Microsoft.gradient(startColorstr=#@{ievalue}+@{myred}+@{mygreen}+@{myblue}, endColorstr=#@{ievalue}+@{myred}+@{mygreen}+@{myblue})"; </code></pre> <p>I found <a href="http://www.thebrightlines.com/2011/11/25/filter-styles-in-less/" rel="nofollow">this very brief example</a> to back it up, but again, I haven't tried it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload