CyanogenMod modded

For my Nexus One, I’ve been trying a few new ROMs. One that is supposedly very good is CyanogenMod, and I personally kinda like it.
One downside however, is that the power widget colors for features turned on have been changed to an ugly light blue-ish color, that completely mismatches with any other android user interface parts. So I did what any respectable tinkerer would do, and changed them back to green. Here’s how I did it, hoping these instructions might help other people with the same or related problems. Note that all the tools I uesd should be easy to find using google 🙂

Apparently, the power widget is in Settings.apk. This file also contains a lot of other stuff, and not suprisingly the settings dialogs are among those. Seeing as CyanogenMod adds quite a bit to the settings dialogs, simply putting back a stock Settings.apk is not an option.
So instead, we should change something inside of Settings.apk. This is what I did to get the Settings.apk (and back it up) using the Android SDK:

adb remount
adb shell
cd /system/app
cp Settings.apk Settings.bak
adb pull /system/app/Settings.apk

Then I opened with winrar, and browsed around. I found the files needed in res/drawable-hdpi under filenames appwidget_settings_ind_on_?.9.png and appwidget_settings_ind_mid_?.9.png (where ? is c, r and l).
My first attempt was simply to change the colors using GIMP, but that messed up the scaling of the pictures.
To fix that, I used a program called tweakpng, and removed all PNG chunks not in the original file, and copied the one chunk that the new file didn’t have from the old file.
This targets the scaling issues, but somehow I still had some weird blue lines through the images.
Instead of turning it to white as I wanted, I figured the normal Android green would be sufficient too. So I set out to get it from a stock ROM.
I found the stock Nexus ROM, and found the system.img. Apparently it’s a YAFFS2 filesystem, and after some googling, I found a tool unyaffs (needed to compile that on a linux box) to extract it. As said before I couldn’t just take the Settings.apk from there, so instead I renamed it to, and with winrar moved the files I found earlier from the original into the modified zip file.
Then I used

adb push /system/app/Settings.apk

to push it back onto my device.
After re-adding the widget, the colors were green again 😀