Monday, January 12, 2009

A Simple Degrafa Color Picker

A comment from my last post suggested I check out com.degrafa.paint.palette.PaletteUtils. Thank you so very much, gwd, for pointing that out! PaletteUtils is very cool! I wish I would have known about it a couple of months ago when I wrote my own color generating code.

PaletteUtils has some static methods that will return an array of colors:

  • getCategoryPalette()
  • getCoolPalette()
  • getHotPalette()
  • getHSBPalette()
  • getInterpolatedPalette()

Below is an example of a simple color picker that uses PaletteUtils to generate colors. Note that I had to fix a few issues with getHSBPalette() and getCategoryPalette() (issues in Degrafa Beta 3, for which I've filed some bugs).

Right click on the app to view the Flex source. Click here for a larger version.

Note: some of the sliders (like Saturation2) are only used in conjunction w/some of the palettes.

1 comment:

  1. Thanks for the example, it was exactly what I was looking for! I used some of your code to implement a column chart that changes colors smoothly based on its value:
    http://tuckwat.com/blog/flex/flex-custom-column-chart-itemrenderer/

    ReplyDelete