Skip to content

Latest commit

 

History

History
87 lines (55 loc) · 2.48 KB

File metadata and controls

87 lines (55 loc) · 2.48 KB

vectordrawableresdir2colorresfile

Converts a vector drawable resource directory into a color resource file.

This is used to find and replace usages of colors in vector drawables (e.g., to force usage of colors in the Material Design spec only).

Table of Contents

"Click to expand"

Prerequisites

pip3 install -r requirements.txt

Usage

The command below will output a colors.xml file in directory vectordrawableresdir2colorresfile

cd vectordrawableresdir2colorresfile
python3 vectordrawableresdir2colorresfile.py $project/app/src/main/res/drawable

Advanced usage

To ensure the script has no external dependencies, an array and dictionary is used instead of input files.

If you want to use other color palettes:

python3 rgbcsv2colorarray.py @Material-Design-Color.palette.csv

Open output file rgbcsv2colorarray.py.txt and paste content into vectordrawableresdir2colorresfile.py

python3 rgbcsv2colordict.py @Material-Design-Color.palette.csv

Open output file rgbcsv2colordict.py.txt and paste content into vectordrawableresdir2colorresfile.py

Requirements

To run the Python script you'll need:

  • Python 3.6.0 or higher

Feedback

Feel free to send us feedback by submitting an issue. Bug reports, feature requests, patches, and well-wishes are always welcome.

Note: Pull requests are welcome. For major changes, please submit an issue first to discuss what you would like to change.

Credits

Built with

Attributions

Acknowledgments

Special thanks to Optimized RGB-To-ColorName for the algorithm that identifies the name of a color closest to an RGB value provided as input.