Android Color Generator

Android Color Generator is the initiative of http://programmerguru.com to help Android community, programmerguru.com is one of the top tutorial sites which writes tutorials on technologies like Android, jQuery, AJAX, JSON and more.

What is Android Color Generator?

It is a free online tool which helps you to create colors.xml. A color name and value are defined in colors.xml which will be used in Android applications to apply colors to Views.

With the help of this tool, you can generate colors.xml with upto 50 colors at a time.

Generate colors.xml in just three steps:

Step 1: Pick colors from Android Swatch, HTML Color chart or Color Picker.

Step 2: Review and update color name of the selected colors.

Step 3: Generate colors.xml and download it.

How to use colors.xml in Andriod applications?

Here is the sample colors.xml which has two colors defined.

Sample Color XML

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="full_red">#f00</color>
    <color name="half_red">#80ff0000</color>
</resources>

Where to place colors.xml?

Just place the file under res/values/ folder.

How to use colors defined in colors.xml in Android applications?

Application code retrieves the color resource:

Resources res = getResources();
int color = res.getColor(R.color.full_red);

Layout XML applies the color to an attribute:

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="@color/half_red" android:text="Hello"/>

The server requested authentication method unknown to the client