2

Is that somehow possible? I want to use AppCompat and the new primaryColor and so on...

I don't want to create x themes but only one theme, and let the user set the colors in the settings.

I want to create a theme programmatically, is that somehow possible?

Btw., iterating all views of an activity or fragment and applying the custom colors would be possible, but I'm looking for a more clean way, using themes...

EDIT

What I want is, that I can define the colors in a theme like the following by code:

<style name="AppThemeDarkGreen" parent="AppThemeDefaultDark">
    <item name="colorPrimary">#4CAF50</item> <!-- 500 -->
    <item name="colorPrimaryDark">#388E3C</item><!-- 700 -->
    <item name="colorAccent">#C8E6C9</item><!-- 100 -->
</style>

<style name="AppThemeLightGreen" parent="AppThemeDefaultLight">
    <item name="colorPrimary">#4CAF50</item><!-- 500 -->
    <item name="colorPrimaryDark">#388E3C</item><!-- 700 -->
    <item name="colorAccent">#C8E6C9</item><!-- 100 -->
</style>

1 Answer 1

1

The most cleaner way is to create multiple themes according to the color, and allow the user to select the color to apply the theme.

Sign up to request clarification or add additional context in comments.

5 Comments

I'm doing that right now... But this limits the themes... I would like to allow all combinations, not just only predefined ones...
All combination in what sense..How do you actually want it?
I added some code... I want to be able to allow selecting all possible themes (meaning all color combinations) by allowing the user to set 3 colors... Instead of selecting a few themes defined by myself
Check this link vardhan-justlikethat.blogspot.in/2013/09/… if it could help you to find what you want to do.
actually, that's what I meant by iterating over views and then set colors programmatically... that's working of course, but that's no theme solution... I probably will have to stay with some predefined themes...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.