libgdx/libgdx — pull request #2026 by NoelDeMartin (2014-06-24 14:51:44+00:00)
Title: Add new Drawable class ColorDrawable

Hello,

I started working on a project and I found it difficult to create a simple Drawable with a plain color (my case was for using a color in the background of a button, as seen in the image below).
![buttons](https://cloud.githubusercontent.com/assets/1517677/3372863/b8209642-fbae-11e3-9236-5450b334c0af.png)

For that purpose I created this class, ColorDrawable. Later on I discovered android has a class with the exact same name, so I guess that's a good point for the correctness of this class (conceptually at least, not sure if the implementation of the ShapeRenderer usage could improve).

I have tried to follow all the instructions for contributing, the only thing missing is the Contributor License Agreement. If this commit is ok and it will be merged, I will proceed to send that document.

An example usage of how I am using this new class is the following (in a skin json file):

com.badlogic.gdx.graphics.Color: {
font-color: { r: 1, g: 1, b: 1, a: 1 },
main-strong: { r: 1, g: 0, b: 0, a: 1 },
main-soft: { r: 1, g: 1, b: 0, a: 1 }
},
com.badlogic.gdx.scenes.scene2d.utils.ColorDrawable: {
main-strong-drawable: { color: main-strong }
main-soft-drawable: { color: main-soft }
},
com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: fonts/default.fnt } },
com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
call-to-action: {
font: default-font,
fontColor: font-color,
down: main-strong-drawable,
up: main-soft-drawable
}
}

Cheers