PHP Kuler API Library

Over the weekend I decided to do some experimenting with CSS 3 fonts, shadows and transitions. I decided to use Adobe Kuler’s API to power my little PHP experiment.

Adobe Kuler is a fantastic online color-picker, and more. You can create color themes based on an image, a color, engage with their community and interact through an API. The API part is what I liked the best.

I looked around and surprisingly there was no PHP library for Kuler, so I decided to create one. It is now hosted publicly in Github.

Usage is extremely simple:

require_once "Kuler/Api.php";

$kuler = new Kuler_Api('api_key');
$themes = $kuler->get('recent');

$colors = $themes[0]->getSwatchesHex(true);
//>> array("#516373", "#6C838C", "#F2E8C9", "#F2B999", "#F2F2F2")

$themeUrl = $themes[0]->getUrl();

I’ll continue to color my website with themes from the Kuler community and will probably create a WordPress plugin soon as well. Any ideas, questions or requests, leave a comment!

16 Comments PHP Kuler API Library

  1. JH Studio

    Hey, many thanks to this php libraray!
    I am going to use this to feed my Android Mobile app. (I am doing a small homework for a course for Android).
    Will send you the app later.

  2. Doug Stewart

    I would LOVE to use this in a WordPress plugin I’m developing, but your choice of license makes that impossible — CC isn’t compatible with GPL. Any way we could get a dual license?

    1. Gabriel Somoza

      I’m not an expert on licenses but as far as I understand the problem with using GPL is that one of its four key statements is it promotes “the freedom to use the software for any purpose”. However the Kuler API FAQ says “Commercial use of Kuler APIs is not permitted” ( While your plugin may not be for commercial purposes, releasing the library under a dual (CC+GPL) license would kind of violate the Kuler API license, right? That’s why I found the CC license to be superior to GPL in this particular scenario. Any ideas on how to solve that?

  3. Doug Stewart

    The Kuler API itself is restricted license. However, your code doesn’t have to match its license, as far as I understand it. You’re not using any of Adobe’s code so you can license your code as you see fit.

    Again, though: IANAL.

  4. Eric Mann

    Doug’s right. Your code doesn’t need to match Kuler’s restrictive license. It’s perfectly OK for GPL’d code to consume a non-GPL API.

    And the commercial use of the API restriction applies to the API itself … not to code that consumes it. So you’re in the clear if you want to dual license your code as CC and GPL.

    1. Gabriel Somoza

      Glad you like it! I just updated the license to GPL, I’m not going to dual-license it. Thanks for using the library and please give me a link to your plugin once its done cause I’d love to see the library in action.

  5. Doug Stewart

    Slight licensing problem — if I use your Kuler API lib, I can’t host it in the plugin repository!

    Even though GPLv3 is compatible with GPLv2+, the WordPress Foundation has taken a stance that all official repository-hosted projects must be GPLv2 compatible. v3 is actually backwards-incompatible with plain v2. (That Trac ticket I linked to explains it better — my head is still spinning from reading it.)

    Would it in any way be possible to re-re-license it down to GPLv2?


Leave a Reply