colorAccent or colorSecondary with Material Component theme
Yes, I do believe colorSecondary
is the new term for colorAccent
and are interchangeable because if you read the docs specifically the definition of secondary color it says
A secondary color provides more ways to accent and distinguish your product. Having a secondary color is optional, and should be applied sparingly to accent select parts of your UI.
I guess just from that statement it is pretty clear that they both have the same purpose.
The Theme.MaterialComponents
uses the colorSecondary
as described in the material guidelines and in the official doc.
All the components defined in the library uses this attribute.
However, in the library, there are also the Bridge
themes which inherit from AppCompat
themes and you can use them, if you cannot change your theme to inherit from a Material Components theme.
These themes inherit from AppCompat
themes defining the new Material Components theme attributes for you.
You can check the bridge theme in the library:
<style name="Base.V14.Theme.MaterialComponents.Light" parent="Base.V14.Theme.MaterialComponents.Light.Bridge">
<!-- Colors -->
<item name="colorAccent">?attr/colorSecondary</item>
Here you can find the mapping between colorSecondary
and the colorAccent
for these themes.