[One (M8) Themes and Apps] fisha21:
With the avalanche of Sense 6 ROMs, and the release of the M8, we are finally getting to dig into the themes HTC reintroduced in Sense 6. Some of you may remember Sense skins, like we used to have on Sense 3 -- 4.5, and be eagerly looking forward to put those skinning skills back into action.

HTC, however had other ideas - gone are the standalone skin .apks, and instead we have a slightly convoluted implementation instead...thanks HTC ;) (If the concept of Sense skins mean nothing to you, then please just ignore this bit....nothing to see here, other than a themer who's been at this way too long!)

So, what and where are these themes? I've uncovered a few things while digging around, and thought I'd share what I learnt with my fellow themers. Please note, this thread is not intended to be a guide on how to theme - there are plenty of excellent threads covering this already. The purpose of this thread is to share ideas and findings

What are the Sense 6 themes?​

This is the easy bit! If you open Settings/Personalise/Theme, you'll be presented with the four built-in themes:

​

Where are the Sense 6 themes?​

This is where things get complicated.

There are four themes, each of which is split into five categories. The themes are called:

​

The system wide theme is controlled by hex colour codes located in colors.xml and styles.xml of com.htc.resources. This controls the majority of system apps.

If you look at com.htc.resources.apk/styles.xml line 2047 for example, you'll see that there are entries called:

<style name="ThemeOne.CategoryOne" parent="@style/HtcDeviceDefault">
<style name="ThemeOne.CategoryTwo" parent="@style/HtcDeviceDefault">
<style name="ThemeOne.CategoryThree" parent="@style/HtcDeviceDefault">
<style name="ThemeOne.CategoryFour" parent="@style/HtcDeviceDefault">

etc, starting from line 2047

Categories 1-4 are represented by the four boxes along the top of the theme preview. The fifth category is defined by HTC within apks as Category 0, and this is the default category. It is used when the code within the apk doesn't specify which category to use (more on this later). With the default theme, you'll probably have noticed that various HTC apps have different coloured header bars, which correspond to the four boxes on the preview image:

​

So if you wanted to change the colour of the dialer, you'd edit the colour codes for HtcDeviceDefault.CategoryOne. If you were using the second theme, the orange one, you'd edit ThemeOne.CategoryOne to change dialer header, and so on...

I've managed to track down which category each HTC app uses, but if there are any I'm missing, please let me know

Category 0

HTC Backup

Internet

Settings

Setup

Tips & Help

Scribble

All apps launched while in Car mode

Category 1

Calendar

Contacts

Mail

Message

Tasks

Phone

Category 2

Calculator

Clock

Stocks

Voice recorder

Weather

Category 3

Camera

FM radio

Music

Category 4

Didn't actually find any apps that seemed to use this category

All of these apps use the specified category from com.htc.resources, so that's where you should edit it. There are some HTC apps that have seem to have their own internal themes:

Prism.apk

HMS_Gallery.apk

HTC-IME.apk

Video_Center.apk

HtcExtremePowerSaverLauncher.apk

so they have their own specified themes and categories within the colors and styles.xml of their own apk. There may be other apks as well, I just haven't spotted them yet. They read the system flag to determine which Theme to use, but then use their own categories for various elements within the app.

So Prism for example will set the overall Theme according to what's been set in the Theme picker but then will use its own internal categories. From my testing so far, all aspects of Prism (app drawer header, Blinkfeed, app drawer icon overlay) seem to use Category 4 colours from within Prism.apk. Haven't looked into any of the other apps listed above!
​

How are the Sense 6 themes used?​

So, which theme the system is using is determined by you, via the Theme Picker. As for which category an app uses, that is determined within the java code - thanks to [MENTION=5386198]Mikanoshi[/MENTION] for some more detailed info

Still not sure where the current theme flag is set, so that the other themed apps (Gallery, Prism etc) know which theme to use. I'm guessing framework2.jar or framework3.jar, though I guess it doesn't really matter!

As for the preview images, these are generated within, and then cached in /data/data/com.htc.home.personalize/files/themePreview/ - again, thanks to [MENTION=5386198]Mikanoshi[/MENTION] for more detailed info.

If you want the Theme picker screen to show your edited themes, rather than the default ones, you'll need to delete these cached images. This can be done by full wiping, but obviously not so convenient. The other option is to add the following line

delete_recursive("/data/data/com.htc.home.personalize/files/themePreview");

somewhere in the updater-script of your rom/theme zip.​

Can we add new ones?​

The four built in themes offer a great way to offer multiple variations of your theme. But what if 4 options aren't enough?

I'm currently looking into this question. The biggest uncertainty I have right now is whether the themes are entirely defined in xml, or whether there is a smali compoment - some hidden smali arrays perhaps. Certainly, editing the theme don't require any smali edits, but it may be the overall number is hardcoded somewhere. Even if we can add our own, it will be via apk modification, so the themes will have to be flashed, and compatibility will likely be limited depending on much a given rom has modified their com.htc.res, Prism or Gallery apks. However it ends up working, it certainly won't be as easy as installing a skin apk from the Playstore....part of me suspects this may have been a factor behind HTC's decision to use this integrated theming solution.

I've had a few messages comparing this to the CM Theme chooser. Having never flashed any non-Sense rom, I've no experience of this. Perhaps someone more familiar with Theme chooser could offer some insight?​

Well, that's all for now. Apologies for the slightly wordy post, a consequence of me thinking out loud. I will say one more thing though. When Sense 6 first landed, I was not a fan of these new themes at all. But having spent time exploring and getting to know how they work, I actually really like them now. Overall, theming Sense 6 requires less smali edits than Sense 5/5.5 did, and the theme picker aspect is actually quite powerful....how else could you offer 4 variants of a theme so easily. I suspect that it's better for themers like myself, who theme specific roms, than it is for standalone themers.

Happy theming!!​