text color guide
i will use this post to cover text color changes along with a few other tidbits.
although a tutorial on apktool has not yet been posted on this thread there are numerous threads on xda concerning it. this is slightly more advanced then image swapping so i wouldnt make this your first stop on learning how to theme. if you are new i would check out the thread posted on image swapping and the use of 7zip.
with that said assume that all direction on system and app text color is assuming you have decompiled your apk
oh and fyi im not big on certain punctuation. my apologies to the ocd crowd
as the op states this thread is a guide. i will not do the work for anyone. if thats what you want then your on the wrong thread. i want to go in a different direction so im scaling back on the work ive been doing. it would be nice tho to pass some of the apps i do off to someone eventually.
a few tips
- android open source project
- android application package file
- Extensible Markup Language
- an overlay library or skin htc builds into android operating software.
- a library htc has built into sense for the purpose of applying skins
*all android applications have a manifest. it sets permissions, applies themes, lists the package name and package icon and version code.
*unless it is framework apk's all applications will have resources (res) and sources (classes.dex otherwise known as smali when decompiled). the sources for framework-res.apk and com.htc.resources.apk are located in the framework folder of each rom. services.jar is the sources for framework-res and com.htc.framework.jar is the sources for com.htc.resources.
* each compiled application also has the file resources.arsc. this when decompiled displays the values folder. this is very important as it contains a few crucial xmls. i am not listing all just the ones we will be dealing with. those are-
( this is not present in every apk. please dont confuse this with the drawables folder in res)
my motivational speech
this can be daunting at first but stick with it! it will begin to make sense.
the areas that usually contain text color in an apk
*the res/colors folder- this is a folder not an xml and not to be confused with the colors xml in res/values
*res/drawables- though rare some text color is at times in xmls in this folder
*res/layout-land (landscape xmls)
*res/values/styles-this is very important xml and often times under utilized
* on rare occasions the raw folder may contain a decompiled file that contains code. gmail is an example of this.
and of course some text color values are found in smali. i will provide some tips and examples further on concerning this.
RGB red green blue. this is very important to know.
HTML colors are defined using a hexadecimal notation (HEX) for the combination of Red, Green, and Blue color values (RGB).
The lowest value that can be given to one of the light sources is 0 (in HEX: 00). The highest value is 255 (in HEX: FF).
HEX values are specified as 3 pairs of two-digit numbers, starting with a # sign.
when we are assigning color values for android xmls we need to assign an alpha value which is also a two digit code that precedes the six digit hex value.
so for example straight android blue would be #ff0000ff
our alpha value (FF) sets the transparency with ff being zero transparency. because the red position and green position are 00 our code assigns the color blue because the blue postion or hex is ff
an example of a softer blue and a code i have used for a while is #ff4283d8.
42 is the green value. the lower the number the less its influence on the value.
here is a link to a webpage where you can experiment with different values
applying the text color value in the res/color folder xmls
when you are applying a color value in an xml in the res/color folder you will notice that most xmls will reference a color value in res/values/colors.xml
here is an example in framework-res- res/colors/primary_text_dark.xml
<?xml version="1.0" encoding="utf-8"?>
<item android:state_enabled="false" android:color="@color/bright_foreground_dark_disabled" />
<item android:state_window_focused="false" android:color="@color/bright_foreground_dark" />
<item android:state_pressed="true" android:color="@color/bright_foreground_dark_inverse" />
<item android:state_selected="true" android:color="@color/bright_foreground_dark_inverse" />
<item android:state_focused="true" android:color="@color/bright_foreground_dark_inverse" />
<item android:color="@color/bright_foreground_dark" />
every color value listed is pointing to the xml in res/values/colors.
this is pretty much the primary white text for android. if you look in res/values/color/bright_foreground_dark.xml the text value is #ffffffff
you can change the referenced text color in res/values/color or you can do what i usually do and change the refernce to an actual value.
so this - <item android:color="@color/bright_foreground_dark"
would become this- <item android:color="#ff4283d8"
or any hex value you wish to add
applying the text color value in res/layout
this is an area where you can get creative. learning how to change or hacking layout xmls is essential for modding certain apps. social networking apps like google plus and facebook have numerous background and text color changes that need to be made in layout or layout-hdpi.
all xmls in the layout folders with text color value will have the line starting like this-
<TextView android:textColor="?android:textColorPrimary" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="4.0dip" android:layout_marginTop="4.0dip" android:text="@string/enter_credit_card" />
so look for <textView as you examine the xml. this is an example pulled from a decompiled android market. where the line begins <textView will tell you quickly where text color values are present and follow along that code line. this example is referencing a color value in framework-res. this is always undesirable for me. i want to control my text color internally in the app.
so this- android:textColor="?android:textColorPrimary"
becomes this- android:textColor="#ff4283d8"
(soft blue again)
often times you will just see android:textColor="#ffffffff"
. the ffffffff is just an example. it could be any hex value. here you you just change the 8 digits to whatever you would like your color to be.
always follow proper syntax <android:textColor="#ffffffff">
has to be exact.
lets say you run into this situation. the xml is pointing to an area in your app that has an undesired text color. but when you search all you find is this-
you could change the android:textAppearance to android:textColor but you really dont want that. it is referencing a text size. so just after-
add this right after it with a one digit gap between them
android:textAppearance="?android:textAppearanceLar ge" android:textColor="#ffffffff"
also make sure after the line you cut in has a one digit gap after it also.
even if you add a text color in a layout xml after <textView that has no reference to text apperance or color it will still compile without errors. even if the change doesnt work. as long as you are on the proper line and using the correct syntax you wont bork anything.
here is a tutorial on changing systemUI text color
there are always more tips that can be given but this should start you on your way to modding layout text color.
applying text color changes in res/values/styles
Sent from my PG86100 using xda premium