My kul CFC (Kuler API CFC)

Most of the folks I hang out with are pretty scaryare code geeks so we rarely talk about design or design related issues. As someone interested in technology in general though I find it interesting. Some time ago Adobe released kuler, a site that lets people create and share color swatches. I’m not sure what a swatch is - I think it has something to do with putting colors together nicely. For me ‘putting colors together nicely’ means getting dressed and checking out the face my wife makes. The kuler site is pretty fun to look at and play with - and it turns out it has a pretty nice API as well.

As you know - the only word that makes me more excited than API is wishlist - so when I saw the docs I thought I’d see if I could whip up a quick little CFC.

It turned out to be rather easy. My CFC supports everything the API does:

  • Get latest, most popular, and highest rated themes
  • Search themes
  • And it also provides a few utility functions to make linking a bit easier. </ul> Check out the sample code below: <cfset k = createObject("component", "kuler")> <cfdump var="#k.getRecent()#" label="Recent" top="3" expand="false"> <cfdump var="#k.getPopular()#" label="Popular" top="3" expand="false"> <cfdump var="#k.getHighestRated()#" label="Highest Rated" top="3" expand="false"> <cfoutput> <a href="#k.getThemeURL(11)#"><img src="#k.getThumbURL(11)#"></a> </cfoutput> <cfdump var="#k.search('ocean')#" label="Search for ocean" top="3"> <cfdump var="#k.search(title='Asian')#" label="Search for title=Asian" top="3">

    Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments