Skip to content

Commit

Permalink
[M3][Color] Added framework color roles support for content color
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 493027582
  • Loading branch information
Material Design Team authored and leticiarossi committed Dec 5, 2022
1 parent 6c85b59 commit ce68ec6
Show file tree
Hide file tree
Showing 12 changed files with 260 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorHighlight for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="@dimen/material_emphasis_medium" android:color="@color/material_personalized_color_primary" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorHighlightInverse for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="@dimen/material_emphasis_medium" android:color="@color/material_personalized_color_primary_inverse" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorPrimary for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_on_surface"/>
<item android:color="@color/material_personalized_color_on_surface"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorPrimaryInverse for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_text_primary_inverse"/>
<item android:color="@color/material_personalized_color_text_primary_inverse"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorSecondary for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_on_surface"/>
<item android:color="@color/material_personalized_color_on_surface_variant"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorSecondaryInverse for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_text_secondary_and_tertiary_inverse_disabled"/>
<item android:color="@color/material_personalized_color_text_secondary_and_tertiary_inverse"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorHint for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true"
android:state_pressed="true"
android:alpha="@dimen/material_emphasis_medium"
android:color="@color/material_personalized_color_on_background" />
<item android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_on_background" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorHintInverse for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true"
android:state_pressed="true"
android:alpha="@dimen/material_emphasis_medium"
android:color="@color/material_personalized_color_text_hint_foreground_inverse" />
<item android:alpha="@dimen/material_emphasis_disabled"
android:color="@color/material_personalized_color_text_hint_foreground_inverse" />
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorPrimaryInverseDisableOnly for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_medium" android:color="@color/material_personalized_color_text_primary_inverse_disable_only"/>
<item android:color="@color/material_personalized_color_text_primary_inverse_disable_only"/>
</selector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2022 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Material3 alternative to textColorPrimaryDisableOnly for personalized theme -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="@dimen/material_emphasis_medium" android:color="@color/material_personalized_color_on_background"/>
<item android:color="@color/material_personalized_color_on_background"/>
</selector>
16 changes: 16 additions & 0 deletions lib/java/com/google/android/material/color/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,26 @@
<color name="material_personalized_color_on_surface_variant">#FFFFFF</color>
<color name="material_personalized_color_surface_inverse">#FFFFFF</color>
<color name="material_personalized_color_on_surface_inverse">#FFFFFF</color>
<color name="material_personalized_color_surface_bright">#FFFFFF</color>
<color name="material_personalized_color_surface_dim">#FFFFFF</color>
<color name="material_personalized_color_surface_container">#FFFFFF</color>
<color name="material_personalized_color_surface_container_low">#FFFFFF</color>
<color name="material_personalized_color_surface_container_high">#FFFFFF</color>
<color name="material_personalized_color_surface_container_lowest">#FFFFFF</color>
<color name="material_personalized_color_surface_container_highest">#FFFFFF</color>
<color name="material_personalized_color_surface_outline">#FFFFFF</color>
<color name="material_personalized_color_error">#FFFFFF</color>
<color name="material_personalized_color_on_error">#FFFFFF</color>
<color name="material_personalized_color_error_container">#FFFFFF</color>
<color name="material_personalized_color_on_error_container">#FFFFFF</color>

<color name="material_personalized_color_control_activated">#FFFFFF</color>
<color name="material_personalized_color_control_normal">#FFFFFF</color>
<color name="material_personalized_color_control_highlight">#FFFFFF</color>
<color name="material_personalized_color_text_primary_inverse">#FFFFFF</color>
<color name="material_personalized_color_text_secondary_and_tertiary_inverse">#FFFFFF</color>
<color name="material_personalized_color_text_secondary_and_tertiary_inverse_disabled">#FFFFFF</color>
<color name="material_personalized_color_text_primary_inverse_disable_only">#FFFFFF</color>
<color name="material_personalized_color_text_hint_foreground_inverse">#FFFFFF</color>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="NewApi">

<style name="ThemeOverlay.Material3.HarmonizedColors" parent="">
<item name="colorError">@color/material_harmonized_color_error</item>
Expand Down Expand Up @@ -50,14 +50,36 @@
<item name="colorOnSurfaceVariant">@color/material_personalized_color_on_surface_variant</item>
<item name="colorSurfaceInverse">@color/material_personalized_color_surface_inverse</item>
<item name="colorOnSurfaceInverse">@color/material_personalized_color_on_surface_inverse</item>
<item name="colorSurfaceBright">@color/material_personalized_color_surface_bright</item>
<item name="colorSurfaceDim">@color/material_personalized_color_surface_dim</item>
<item name="colorSurfaceContainer">@color/material_personalized_color_surface_container</item>
<item name="colorSurfaceContainerLow">@color/material_personalized_color_surface_container_low</item>
<item name="colorSurfaceContainerHigh">@color/material_personalized_color_surface_container_high</item>
<item name="colorSurfaceContainerLowest">@color/material_personalized_color_surface_container_lowest</item>
<item name="colorSurfaceContainerHighest">@color/material_personalized_color_surface_container_highest</item>
<item name="colorOutline">@color/material_personalized_color_surface_outline</item>
<item name="colorError">@color/material_personalized_color_error</item>
<item name="colorOnError">@color/material_personalized_color_on_error</item>
<item name="colorErrorContainer">@color/material_personalized_color_error_container</item>
<item name="colorOnErrorContainer">@color/material_personalized_color_on_error_container</item>

<!-- Default Framework Text Colors. -->
<!-- TODO(b/254612063): Add default framework colors when the material color utilities library provides the color values for non-Material roles.-->
<item name="android:textColorPrimary">@color/material_personalized_color_primary_text</item>
<item name="android:textColorPrimaryInverse">@color/material_personalized_color_primary_text_inverse</item>
<item name="android:textColorSecondary">@color/material_personalized_color_secondary_text</item>
<item name="android:textColorSecondaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
<item name="android:textColorTertiary">@color/material_personalized_color_secondary_text</item>
<item name="android:textColorTertiaryInverse">@color/material_personalized_color_secondary_text_inverse</item>
<item name="android:textColorPrimaryDisableOnly">@color/material_personalized_primary_text_disable_only</item>
<item name="android:textColorPrimaryInverseDisableOnly">@color/material_personalized_primary_inverse_text_disable_only</item>
<item name="android:textColorHint">@color/material_personalized_hint_foreground</item>
<item name="android:textColorHintInverse">@color/material_personalized_hint_foreground_inverse</item>
<item name="android:textColorHighlight">@color/material_personalized__highlighted_text</item>
<item name="android:textColorHighlightInverse">@color/material_personalized__highlighted_text_inverse</item>
<item name="android:textColorAlertDialogListItem">@color/material_personalized_color_primary_text</item>
<item name="android:colorControlActivated">@color/material_personalized_color_control_activated</item>
<item name="android:colorControlNormal">@color/material_personalized_color_control_normal</item>
<item name="android:colorControlHighlight">@color/material_personalized_color_control_highlight</item>
</style>

</resources>

0 comments on commit ce68ec6

Please sign in to comment.