Attached patch allows you to define your variables inside my_theme.info and alters the theme settings to end-users can override those settings without the need to alter the theme. If jquery_colorpicker is installed and active, they see a colorpicker. This only works if you don't declare the same variable inside your my_theme.css.less.
This patch also adds a new hook so developers can define custom php functions to be used inside less (http://leafo.net/lessphp/docs/index.html#custom_functions, added in version 0.3.1)
Example
my_theme.info
less_use_default = TRUE
less[@bckcolor] = #222266
less[@pagecolor] = darken(@bckcolor, 5%)
less[@textcolor] = #ffffff
less[@linkcolor] = @textcolor
less[@linkactive] = rgb(0, 88, 107)
less[@buttontext] = rgb(0, 88, 107)
Theme settings

Comments
Comment #1
attiks commentedSmall fix, new patch attached
Comment #2
stovak commentedAh. Mah. Zing. This is an awsome contrib. It should be adopted immediately.
Comment #3
rbayliss commentedThese are two awesome ideas, but IMO, the theme settings should be added via an alter hook. I also don't think the LESS module should provide any kind of UI for setting these variables - let the theme do it and let the theme implement an alter hook to push those variables into the array. Otherwise, two thumbs up.
Comment #4
jay.dansand commentedI may have accidentally almost-duped this issue/solved it a little differently (my solution passes functions and variables via code to drupal_add_css()) in #1543276: Support passing/defining LESS variables/functions via drupal_add_css() and theme.info
The solutions are a little different since one is code-driven and the other uses .info settings, so perhaps we can merge them and keep both.
Comment #5
attiks commentedI'm all in favor of merging, but i think our goals are different:
Mine was to allow an end user to change some variables using the appearance page and for all pages on the site.
Yours look like you want to be able to alter each css before it's gets added depending on some condition (like path, content type, ...)
Or did I miss something?
Comment #6
corey.aufang commentedDoes this patch allow you to use functions registered with ->registerFunction() in the default or user entered values?
Comment #7
attiks commentedYou can use the function inside any less file, with or without entered values
Comment #8
jay.dansand commentedMy goal is two-fold:
1: (original goal) To let site developers change variables and functions passed to LESS files, regardless of why/when (could be across the whole site, for example).
2: I discovered that #1 doesn't work unless you find some way to invalidate the LESS file (AND the aggregated CSS if you have Performance/Aggregate CSS turned on in your site) - that's why I added the cache management/$tag/$expire=TRUE stuff to my code. #1 doesn't work without it, because if you change the variables passed to LESS, it won't recompile the destination file and your new settings will not take effect.
So, I think #1543276: Support passing/defining LESS variables/functions via drupal_add_css() and theme.info is the closest thing to a solution. I've wrapped up the functionality in this issue into the latest patch as well, so everything should be covered from both of these issue tickets. Could you test the patch and make sure it does what your patch in this issue did?
Comment #9
jelle_sre-rolled patch
Comment #10
jay.dansand commentedI think #1543276: Support passing/defining LESS variables/functions via drupal_add_css() and theme.info is the latest version of this issue, and includes both this functionality and some related capabilities.
Comment #11
corey.aufang commentedTake a look at the latest dev.
Settings can be adjusted from the specific theme's configuration page.
Comment #12
corey.aufang commentedMoving discussion to here:
#1787160: Theme/module settings, variables, and functions...