Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Theming In Android++

Theming In Android++

In this talk, I spoke about some of the mistakes I made with theming and how I overcame them.

Pabi Moloi

July 03, 2019
Tweet

More Decks by Pabi Moloi

Other Decks in Programming

Transcript

  1. <!--?xml version="1.0" encoding="UTF-8"?--> <resources> <color name="primaryColor">#f9a825</color> <color name="primaryLightColor">#ffd95a</color> <color name="primaryDarkColor">#c17900</color>

    <color name="secondaryColor">#ffffff</color> <color name="secondaryLightColor">#ffffff</color> <color name="secondaryDarkColor">#25cccccc</color> <color name="primaryTextColor">#ffffff</color> <color name="secondaryTextColor">#000000</color> </resources>
  2. <!--?xml version="1.0" encoding="UTF-8"?--> <resources> <color name="primaryColor">#f9a825</color> <color name="primaryLightColor">#ffd95a</color> <color name="primaryDarkColor">#c17900</color>

    <color name="secondaryColor">#ffffff</color> <color name="secondaryLightColor">#ffffff</color> <color name="secondaryDarkColor">#25cccccc</color> <color name="primaryTextColor">#ffffff</color> <color name="secondaryTextColor">#000000</color> </resources>
  3. <?xml version="1.0" encoding="utf-8"?> <resources> <color name="red">#d32f2f</color> <color name="mustard">#F9A825</color> <color name="yellow">#ffd95a</color>

    <color name="dark_mustard">#c17900</color> <color name="white">#ffffff</color> <color name="light_grey">#25CCCCCC</color> <color name="black">#000000</color> </resources>
  4. <style name="..." parent="..."> <item name="colorPrimary">@color/mustard</item> <item name= "colorOnPrimary">@color/white</item> <item name="colorPrimaryDark">@color/dark_mustard</item>

    <item name="colorAccent">@color/red</item> <item name="colorSecondary">@color/white</item> <item name="colorOnSecondary">@color/black</item> </style>
  5. Recap - Color - Give colors names, which helps in

    the reduction of duplication. - “On” colours are usually used for iconography, text, and strokes
  6. Attributes • textAppearanceHeadline1 - textAppearanceHeadline6 • textAppearanceSubtitle1 - textAppearanceSubtitle2 •

    textAppearanceBody1 - textAppearanceBody2 • textAppearanceCaption • textAppearanceButton • textAppearanceOverline
  7. ...is a type of style that is applied to: •

    The entire application • Activity • View Hierarchy
  8. <style name="NoActionBarTheme" parent="Theme.MaterialComponents.Light.NoActionBar"> <item name="colorPrimary">@color/mustard</item> <item name= "colorOnPrimary">@color/white</item> <item name="colorPrimaryVariant">@color/yellow</item>

    <item name="colorPrimaryDark">@color/dark_mustard</item> <item name="colorAccent">@color/red</item> <item name="colorSecondary">@color/white</item> <item name="colorOnSecondary">@color/black</item> <item name="android:windowBackground">@color/white</item> </style>