ExactCalculator: Rework color system using dynamic colors

* Remove all colors from styles
* Simplify button styles to just Normal, Image, Text
* Introduce Material3 themes for all buttons
* Drop the color mapping schenanigans

Change-Id: If3fb5e6cd44dad254d770f10f03161826e43e0bd
diff --git a/res/drawable/ic_del.xml b/res/drawable/ic_del.xml
index fbd0aa2..299bce0 100644
--- a/res/drawable/ic_del.xml
+++ b/res/drawable/ic_del.xml
@@ -22,6 +22,6 @@
     android:viewportHeight="960"
     android:autoMirrored="true">
   <path
-      android:fillColor="@color/pad_button_text_color"
+      android:fillColor="@android:color/white"
       android:pathData="M360,760Q338,760 320,748.5Q302,737 289,719L144,515Q133,499 133,480Q133,461 144,445L289,241Q302,223 320,211.5Q338,200 360,200L780,200Q805,200 822.5,217.5Q840,235 840,260L840,700Q840,725 822.5,742.5Q805,760 780,760L360,760ZM560,522L651,613Q660,622 672,622Q684,622 693,613Q702,604 702,591.5Q702,579 693,570L602,480L692,390Q701,381 701,369Q701,357 692,348Q683,339 670.5,339Q658,339 649,348L560,438L469,347Q460,338 448,338Q436,338 427,347Q418,356 418,368.5Q418,381 427,390L518,480L427,570Q418,579 418,591Q418,603 427,612Q436,621 448.5,621Q461,621 470,612L560,522Z"/>
 </vector>
diff --git a/res/layout/pad_advanced_3x4.xml b/res/layout/pad_advanced_3x4.xml
index b5fa979..85c42bc 100644
--- a/res/layout/pad_advanced_3x4.xml
+++ b/res/layout/pad_advanced_3x4.xml
@@ -20,22 +20,22 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_advanced"
     style="@style/PadLayoutStyle.Advanced"
-    android:background="@color/pad_advanced_background_color"
     app:rowCount="4"
     app:columnCount="3">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/toggle_mode"
         style="@style/PadButtonStyle.SmallCaps"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_switch_deg"
         android:text="@string/mode_deg"
-        android:background="@color/pad_advanced_background_color"
         app:layout_row="0"
         app:layout_column="0" />
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sqrt"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_sqrt"
         android:text="@string/op_sqrt"
         app:layout_row="0"
@@ -43,7 +43,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sqr"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_sqr"
         android:fontFamily="sans-serif-medium"
         android:text="@string/op_sqr"
@@ -53,7 +54,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/const_pi"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_const_pi"
         android:text="@string/const_pi"
         app:layout_row="0"
@@ -62,6 +64,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/toggle_inv"
         style="@style/PadButtonStyle.SmallCaps"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_inv_off"
         android:text="@string/inv"
         app:layout_row="1"
@@ -69,7 +72,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_pow"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_pow"
         android:text="@string/op_pow"
         app:layout_row="1"
@@ -77,7 +81,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_fact"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_fact"
         android:text="@string/op_fact"
         app:layout_row="1"
@@ -85,7 +90,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_sin"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_sin"
         android:text="@string/fun_sin"
         app:layout_row="2"
@@ -93,7 +99,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arcsin"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arcsin"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arcsin"
@@ -103,7 +110,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_cos"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_cos"
         android:text="@string/fun_cos"
         app:layout_row="2"
@@ -111,7 +119,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arccos"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arccos"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arccos"
@@ -121,7 +130,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_tan"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_tan"
         android:text="@string/fun_tan"
         app:layout_row="2"
@@ -129,7 +139,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arctan"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arctan"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arctan"
@@ -139,7 +150,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/const_e"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_const_e"
         android:text="@string/const_e"
         app:layout_row="3"
@@ -147,7 +159,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_ln"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_ln"
         android:text="@string/fun_ln"
         app:layout_row="3"
@@ -155,7 +168,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_exp"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_exp"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_exp"
@@ -165,7 +179,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_log"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_log"
         android:text="@string/fun_log"
         app:layout_row="3"
@@ -173,7 +188,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_10pow"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_10pow"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_10pow"
diff --git a/res/layout/pad_advanced_4x3.xml b/res/layout/pad_advanced_4x3.xml
index 305353e..44861e1 100644
--- a/res/layout/pad_advanced_4x3.xml
+++ b/res/layout/pad_advanced_4x3.xml
@@ -20,13 +20,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_advanced"
     style="@style/PadLayoutStyle.Advanced"
-    android:background="@color/pad_advanced_background_color"
     app:rowCount="3"
     app:columnCount="4">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sqrt"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_sqrt"
         android:text="@string/op_sqrt"
         app:layout_row="0"
@@ -34,7 +34,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sqr"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_sqr"
         android:fontFamily="sans-serif-medium"
         android:text="@string/op_sqr"
@@ -44,7 +45,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/const_pi"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_const_pi"
         android:text="@string/const_pi"
         app:layout_row="0"
@@ -52,7 +54,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_pow"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_pow"
         android:text="@string/op_pow"
         app:layout_row="0"
@@ -60,7 +63,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_fact"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_op_fact"
         android:text="@string/op_fact"
         app:layout_row="0"
@@ -69,6 +73,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/toggle_mode"
         style="@style/PadButtonStyle.SmallCaps"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_switch_deg"
         android:text="@string/mode_deg"
         app:layout_row="1"
@@ -76,7 +81,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_sin"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_sin"
         android:text="@string/fun_sin"
         app:layout_row="1"
@@ -84,7 +90,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arcsin"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arcsin"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arcsin"
@@ -94,7 +101,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_cos"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_cos"
         android:text="@string/fun_cos"
         app:layout_row="1"
@@ -102,7 +110,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arccos"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arccos"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arccos"
@@ -112,7 +121,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_tan"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_tan"
         android:text="@string/fun_tan"
         app:layout_row="1"
@@ -120,7 +130,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_arctan"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_arctan"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_arctan"
@@ -131,6 +142,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/toggle_inv"
         style="@style/PadButtonStyle.SmallCaps"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_inv_off"
         android:text="@string/inv"
         app:layout_row="2"
@@ -138,7 +150,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/const_e"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_const_e"
         android:text="@string/const_e"
         app:layout_row="2"
@@ -146,7 +159,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_ln"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_ln"
         android:text="@string/fun_ln"
         app:layout_row="2"
@@ -154,7 +168,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_exp"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_exp"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_exp"
@@ -164,7 +179,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_log"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_log"
         android:text="@string/fun_log"
         app:layout_row="2"
@@ -172,7 +188,8 @@
 
     <com.android.calculator2.HapticButton
         android:id="@+id/fun_10pow"
-        style="@style/PadButtonStyle.SmallText.Background"
+        style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Advanced"
         android:contentDescription="@string/desc_fun_10pow"
         android:fontFamily="sans-serif-medium"
         android:text="@string/fun_10pow"
diff --git a/res/layout/pad_numeric.xml b/res/layout/pad_numeric.xml
index 27f293f..35206ac 100644
--- a/res/layout/pad_numeric.xml
+++ b/res/layout/pad_numeric.xml
@@ -20,13 +20,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_numeric"
     style="@style/PadLayoutStyle.Numeric"
-    android:background="@color/pad_numeric_background_color"
     app:rowCount="4"
     app:columnCount="3">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_7"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_7"
         app:layout_row="0"
         app:layout_column="0" />
@@ -34,6 +34,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_8"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_8"
         app:layout_row="0"
         app:layout_column="1" />
@@ -41,6 +42,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_9"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_9"
         app:layout_row="0"
         app:layout_column="2" />
@@ -48,6 +50,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_4"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_4"
         app:layout_row="1"
         app:layout_column="0" />
@@ -55,6 +58,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_5"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_5"
         app:layout_row="1"
         app:layout_column="1" />
@@ -62,6 +66,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_6"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_6"
         app:layout_row="1"
         app:layout_column="2" />
@@ -69,6 +74,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_1"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_1"
         app:layout_row="2"
         app:layout_column="0" />
@@ -76,6 +82,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_2"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_2"
         app:layout_row="2"
         app:layout_column="1" />
@@ -83,6 +90,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_3"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_3"
         app:layout_row="2"
         app:layout_column="2" />
@@ -90,6 +98,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/dec_point"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:contentDescription="@string/desc_dec_point"
         app:layout_row="3"
         app:layout_column="0" />
@@ -97,6 +106,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/digit_0"
         style="@style/PadButtonStyle"
+        android:theme="@style/Theme.Button.Numeric"
         android:text="@string/digit_0"
         app:layout_row="3"
         app:layout_column="1" />
@@ -104,6 +114,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/del"
         style="@style/PadButtonStyle.Image"
+        android:theme="@style/Theme.Button.Numeric"
         android:contentDescription="@string/desc_del"
         app:icon="@drawable/ic_del"
         app:layout_row="3"
diff --git a/res/layout/pad_operator_one_col.xml b/res/layout/pad_operator_one_col.xml
index 5999936..334290c 100644
--- a/res/layout/pad_operator_one_col.xml
+++ b/res/layout/pad_operator_one_col.xml
@@ -20,13 +20,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_operator"
     style="@style/PadLayoutStyle.Operator"
-    android:background="@color/pad_operator_background_color"
     app:rowCount="4"
     app:columnCount="1">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_mul"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_mul"
         android:text="@string/op_mul"
         app:layout_row="0"
@@ -35,6 +35,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sub"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_sub"
         android:text="@string/op_sub"
         app:layout_row="1"
@@ -43,6 +44,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_add"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_add"
         android:text="@string/op_add"
         app:layout_row="2"
@@ -51,6 +53,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/eq"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_eq"
         android:text="@string/eq"
         app:layout_row="3"
diff --git a/res/layout/pad_operator_one_col_aux.xml b/res/layout/pad_operator_one_col_aux.xml
index 6b92cc9..a5a550c 100644
--- a/res/layout/pad_operator_one_col_aux.xml
+++ b/res/layout/pad_operator_one_col_aux.xml
@@ -8,13 +8,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_operator_aux"
     style="@style/PadLayoutStyle.OperatorAux"
-    android:background="@color/pad_operator_background_color"
     app:rowCount="1"
     app:columnCount="4">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/clr"
         style="@style/PadButtonStyle.Caps"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_clr"
         android:text="@string/clr"
         app:layout_row="0"
@@ -23,6 +23,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/paren"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_paren"
         android:text="@string/paren"
         app:layout_row="0"
@@ -31,6 +32,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/lparen"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_lparen"
         android:text="@string/lparen"
         android:visibility="gone"
@@ -40,6 +42,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/rparen"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_rparen"
         android:text="@string/rparen"
         android:visibility="gone"
@@ -49,6 +52,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_pct"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_pct"
         android:text="@string/op_pct"
         app:layout_row="0"
@@ -57,6 +61,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_div"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_div"
         android:text="@string/op_div"
         app:layout_row="0"
diff --git a/res/layout/pad_operator_two_col.xml b/res/layout/pad_operator_two_col.xml
index 96ff6ed..13a7054 100644
--- a/res/layout/pad_operator_two_col.xml
+++ b/res/layout/pad_operator_two_col.xml
@@ -20,13 +20,13 @@
     xmlns:app="http://schemas.android.com/apk/res-auto"
     android:id="@+id/pad_operator"
     style="@style/PadLayoutStyle.Operator"
-    android:background="@color/pad_operator_background_color"
     app:rowCount="4"
     app:columnCount="2">
 
     <com.android.calculator2.HapticButton
         android:id="@+id/op_div"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_div"
         android:text="@string/op_div"
         app:layout_row="0"
@@ -35,6 +35,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/clr"
         style="@style/PadButtonStyle.Caps"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_clr"
         android:text="@string/clr"
         app:layout_row="0"
@@ -43,6 +44,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_mul"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/op_mul"
         android:text="@string/op_mul"
         app:layout_row="1"
@@ -51,6 +53,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/paren"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_paren"
         android:text="@string/paren"
         app:layout_row="1"
@@ -59,6 +62,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/lparen"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_lparen"
         android:text="@string/lparen"
         android:visibility="gone"
@@ -68,6 +72,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/rparen"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_rparen"
         android:text="@string/rparen"
         android:visibility="gone"
@@ -77,6 +82,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_sub"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_sub"
         android:text="@string/op_sub"
         app:layout_row="2"
@@ -85,6 +91,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_pct"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_pct"
         android:text="@string/op_pct"
         app:layout_row="2"
@@ -93,6 +100,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/op_add"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_op_add"
         android:text="@string/op_add"
         app:layout_row="3"
@@ -101,6 +109,7 @@
     <com.android.calculator2.HapticButton
         android:id="@+id/eq"
         style="@style/PadButtonStyle.SmallText"
+        android:theme="@style/Theme.Button.Operator"
         android:contentDescription="@string/desc_eq"
         android:text="@string/eq"
         app:layout_row="3"
diff --git a/res/values-night/color.xml b/res/values-night/color.xml
new file mode 100644
index 0000000..27f2d5f
--- /dev/null
+++ b/res/values-night/color.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+    SPDX-FileCopyrightText: 2023 The LineageOS Project
+    SPDX-License-Identifier: Apache-2.0
+-->
+<resources>
+
+    <!-- Display background -->
+    <color name="empty_history_color">@color/material_dynamic_neutral_variant20</color>
+    <color name="display_background_color">@color/material_dynamic_neutral20</color>
+
+    <!-- Display text -->
+    <color name="display_formula_text_color">@color/material_dynamic_neutral90</color>
+    <color name="display_result_text_color">@color/material_dynamic_neutral70</color>
+    <color name="display_result_exponent_text_color">@color/material_dynamic_secondary60</color>
+
+</resources>
diff --git a/res/values/color.xml b/res/values/color.xml
index 41a58b2..39d3178 100644
--- a/res/values/color.xml
+++ b/res/values/color.xml
@@ -17,52 +17,13 @@
 
 <resources>
 
-    <!-- Default accent color. -->
-    <color name="calculator_accent_color">#167c80</color>
+    <!-- Display background -->
+    <color name="empty_history_color">@color/material_dynamic_neutral90</color>
+    <color name="display_background_color">@color/material_dynamic_neutral90</color>
 
-    <!-- Primary color (Color for the toolbars). -->
-    <color name="calculator_primary_color">#fafafa</color>
-
-    <!-- Status bar color. -->
-    <color name="calculator_statusbar_color">#f0f0f0</color>
-
-    <!-- Color to indicate an error has occured. -->
-    <color name="calculator_error_color">#d0422d</color>
-
-    <!-- Background color of the calculator display. -->
-    <color name="display_background_color">@color/calculator_primary_color</color>
-
-    <!-- Text color for the formula in the calculator display. -->
-    <color name="display_formula_text_color">#000000</color>
-
-    <!-- Text color for the result in the calculator display. -->
-    <color name="display_result_text_color">#6C000000</color>
-
-    <!-- Lighter color for exponent while scrolling. -->
-    <color name="display_result_exponent_text_color">#40000000</color>
-
-    <!-- Background color for the numeric pad. -->
-    <color name="pad_numeric_background_color">@color/calculator_primary_color</color>
-
-    <!-- Background color for the operator pad. -->
-    <color name="pad_operator_background_color">@color/calculator_statusbar_color</color>
-
-    <!-- Background color for the advanced pad. -->
-    <color name="pad_advanced_background_color">@color/calculator_accent_color</color>
-
-    <!-- Text color for a button in a pad. -->
-    <color name="pad_button_text_color">#333</color>
-
-    <!-- Text color for a button in the advanced pad. -->
-    <color name="pad_button_advanced_text_color">@android:color/white</color>
-
-    <!-- Ripple color when a button is pressed in a pad. -->
-    <color name="pad_button_ripple_color">#33000000</color>
-
-    <!-- Ripple color when a button is pressed in a pad. -->
-    <color name="pad_button_advanced_ripple_color">#1A000000</color>
-
-    <!-- Background color for empty history view. -->
-    <color name="empty_history_color">@color/calculator_primary_color</color>
+    <!-- Display text -->
+    <color name="display_formula_text_color">@color/material_dynamic_neutral20</color>
+    <color name="display_result_text_color">@color/material_dynamic_neutral40</color>
+    <color name="display_result_exponent_text_color">@color/material_dynamic_neutral40</color>
 
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index c611b37..208ac6f 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -77,7 +77,6 @@
     </style>
 
     <style name="PadButtonStyle.Image">
-        <item name="iconTint">@color/pad_button_text_color</item>
         <item name="iconGravity">textStart</item>
         <item name="iconPadding">0dp</item>
         <item name="iconSize">32dp</item>
@@ -92,10 +91,6 @@
         <item name="android:textSize">22dip</item>
     </style>
 
-    <style name="PadButtonStyle.SmallText.Background">
-        <item name="android:textColor">@color/pad_button_advanced_text_color</item>
-    </style>
-
     <style name="PadLayoutStyle">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 2588d1c..b09d717 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -18,10 +18,10 @@
 <resources>
 
     <style name="Theme" parent="Theme.Material3.DayNight">
-        <item name="android:statusBarColor">@color/calculator_statusbar_color</item>
+        <item name="android:statusBarColor">@color/display_background_color</item>
         <item name="android:windowLightStatusBar">?isLightTheme</item>
         <item name="android:windowSoftInputMode">stateAlwaysHidden</item>
-        <item name="android:navigationBarColor">@color/navigationBar_color</item>
+        <item name="android:navigationBarColor">?colorSurface</item>
         <item name="android:windowLightNavigationBar">?isLightTheme</item>
     </style>
 
@@ -36,4 +36,22 @@
         <item name="title">@string/menu_licenses</item>
     </style>
 
+    <style name="Theme.Button" parent="ThemeOverlay.Material3.Button.TextButton">
+    </style>
+
+    <style name="Theme.Button.Advanced">
+        <item name="colorContainer">?colorSurface</item>
+        <item name="colorOnContainer">?colorOnSurface</item>
+    </style>
+
+    <style name="Theme.Button.Numeric">
+        <item name="colorContainer">?colorSurfaceContainer</item>
+        <item name="colorOnContainer">?colorOnSurface</item>
+    </style>
+
+    <style name="Theme.Button.Operator">
+        <item name="colorContainer">?colorSecondaryContainer</item>
+        <item name="colorOnContainer">?colorOnSecondaryContainer</item>
+    </style>
+
 </resources>
diff --git a/src/com/android/calculator2/Calculator.java b/src/com/android/calculator2/Calculator.java
index 0c980d1..a348481 100644
--- a/src/com/android/calculator2/Calculator.java
+++ b/src/com/android/calculator2/Calculator.java
@@ -489,8 +489,8 @@
             }
 
             if (mCurrentState == CalculatorState.ERROR) {
-                final int errorColor =
-                        ContextCompat.getColor(this, R.color.calculator_error_color);
+                final int errorColor = ContextCompat.getColor(this,
+                        com.google.android.material.R.color.design_default_color_error);
                 mFormulaText.setTextColor(errorColor);
                 mResultText.setTextColor(errorColor);
             } else if (mCurrentState != CalculatorState.RESULT) {