mquan / lavish

a rails app that generates Bootstrap color scheme from an image
http://lavishbootstrap.com/
691 stars 92 forks source link

API exposure to enable the integration with other web application platform #24

Closed ericq closed 9 years ago

ericq commented 9 years ago

Just love the simplicity brought by this tool.

I'm using non rails platform (angularjs instead) and I'm wondering how to leverage the feature your tool brings. I don't expect anyone to re-write the tool. but is it possible that you expose your current capability into API. for example:

  1. the request is an image, and the output is the color options?
  2. the request is color options, and the optput is the css or less files?

In this way, I can run your app on the backend and I can put some angularjs app on the front end to interact with your API? If you're not interested in doing it, can you let me know the feasibility.

thanks.

mquan commented 9 years ago

Thanks for your interest in using lavish but I don't plan on releasing an API in the near future. If you're using javascript I think there are a few decent libs that offer the capability of extracting colors from given image, such as this https://github.com/lokesh/color-thief/

From there you can replace bootstrap colors in less and parse it to css

ericq commented 9 years ago

Thanks for the feedback. I think this will solve the #1 question. Do you have any comments on question #2? how to generate all the variables in bootstrap way? anything to reuse or we need to code from scratch?

mquan commented 9 years ago

@ericq that's the easy part, you just need to replace these variables in variables.less https://github.com/mquan/lavish/blob/master/app/controllers/styles_controller.rb#L30-L42

Hope this helps

mquan commented 9 years ago

btw, the colors are sorted in order of increasing darkness