Closed EinfachAleks closed 7 years ago
Hi @EinfachAleks, no this isn't possible sorry - not at least without some hacks. What you could do is somehow parse the LESS variable value (a quick Google search for "less variables in javascript" brings up a few hacks), and then use your parsed value instead. As this is not possible without hacks though, it's not something the plugin itself will be supporting.
I createt my own "hack" ..
HTML
<span class="theme-color hide"></span>
JavaScript
var themeColor = $("span.theme-color.hide").css("color"); function rgb2hex(rgb) { rgb = rgb.match(/^rgba?((\d+),\s(\d+),\s(\d+)(?:,\s*(\d+))?)$/); function hex(x) { return ("0" + parseInt(x).toString(16)).slice(-2); } return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); } var cursorColor = rgb2hex(themeColor); $(".carousel.slide a.right.carousel-control").awesomeCursor("chevron-right", { color: cursorColor, size: 32 }); $(".carousel.slide a.left.carousel-control").awesomeCursor("chevron-left", { color: cursorColor, size: 32 });
Ah cool solution @EinfachAleks! You shouldn't need to convert from RGB to hex though, the plugin should handle any valid CSS colour string already.
https://github.com/jwarby/jquery-awesome-cursor#colour
Can i add a Less Variable instead hex color to the Color parameter like this:
Less-File:
@green: #00cc00;
JS-File:
$('.carousel.slide a.right.carousel-control').awesomeCursor('chevron-right', { color: '@green' });