1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.systemui.theme 18 19 import android.util.Pair 20 import com.google.ux.material.libmonet.dynamiccolor.DynamicColor 21 import com.google.ux.material.libmonet.dynamiccolor.MaterialDynamicColors 22 23 class DynamicColors { 24 companion object { 25 @JvmStatic 26 fun allDynamicColorsMapped(isExtendedFidelity: Boolean): List<Pair<String, DynamicColor>> { 27 val mdc = MaterialDynamicColors(isExtendedFidelity) 28 return arrayListOf( 29 Pair.create("primary_container", mdc.primaryContainer()), 30 Pair.create("on_primary_container", mdc.onPrimaryContainer()), 31 Pair.create("primary", mdc.primary()), 32 Pair.create("on_primary", mdc.onPrimary()), 33 Pair.create("secondary_container", mdc.secondaryContainer()), 34 Pair.create("on_secondary_container", mdc.onSecondaryContainer()), 35 Pair.create("secondary", mdc.secondary()), 36 Pair.create("on_secondary", mdc.onSecondary()), 37 Pair.create("tertiary_container", mdc.tertiaryContainer()), 38 Pair.create("on_tertiary_container", mdc.onTertiaryContainer()), 39 Pair.create("tertiary", mdc.tertiary()), 40 Pair.create("on_tertiary", mdc.onTertiary()), 41 Pair.create("background", mdc.background()), 42 Pair.create("on_background", mdc.onBackground()), 43 Pair.create("surface", mdc.surface()), 44 Pair.create("on_surface", mdc.onSurface()), 45 Pair.create("surface_container_low", mdc.surfaceContainerLow()), 46 Pair.create("surface_container_lowest", mdc.surfaceContainerLowest()), 47 Pair.create("surface_container", mdc.surfaceContainer()), 48 Pair.create("surface_container_high", mdc.surfaceContainerHigh()), 49 Pair.create("surface_container_highest", mdc.surfaceContainerHighest()), 50 Pair.create("surface_bright", mdc.surfaceBright()), 51 Pair.create("surface_dim", mdc.surfaceDim()), 52 Pair.create("surface_variant", mdc.surfaceVariant()), 53 Pair.create("on_surface_variant", mdc.onSurfaceVariant()), 54 Pair.create("outline", mdc.outline()), 55 Pair.create("outline_variant", mdc.outlineVariant()), 56 Pair.create("error", mdc.error()), 57 Pair.create("on_error", mdc.onError()), 58 Pair.create("error_container", mdc.errorContainer()), 59 Pair.create("on_error_container", mdc.onErrorContainer()), 60 Pair.create("control_activated", mdc.controlActivated()), 61 Pair.create("control_normal", mdc.controlNormal()), 62 Pair.create("control_highlight", mdc.controlHighlight()), 63 Pair.create("text_primary_inverse", mdc.textPrimaryInverse()), 64 Pair.create( 65 "text_secondary_and_tertiary_inverse", 66 mdc.textSecondaryAndTertiaryInverse() 67 ), 68 Pair.create( 69 "text_primary_inverse_disable_only", 70 mdc.textPrimaryInverseDisableOnly() 71 ), 72 Pair.create( 73 "text_secondary_and_tertiary_inverse_disabled", 74 mdc.textSecondaryAndTertiaryInverseDisabled() 75 ), 76 Pair.create("text_hint_inverse", mdc.textHintInverse()), 77 Pair.create("palette_key_color_primary", mdc.primaryPaletteKeyColor()), 78 Pair.create("palette_key_color_secondary", mdc.secondaryPaletteKeyColor()), 79 Pair.create("palette_key_color_tertiary", mdc.tertiaryPaletteKeyColor()), 80 Pair.create("palette_key_color_neutral", mdc.neutralPaletteKeyColor()), 81 Pair.create( 82 "palette_key_color_neutral_variant", 83 mdc.neutralVariantPaletteKeyColor() 84 ), 85 ) 86 } 87 88 @JvmStatic 89 fun getFixedColorsMapped(isExtendedFidelity: Boolean): List<Pair<String, DynamicColor>> { 90 val mdc = MaterialDynamicColors(isExtendedFidelity) 91 return arrayListOf( 92 Pair.create("primary_fixed", mdc.primaryFixed()), 93 Pair.create("primary_fixed_dim", mdc.primaryFixedDim()), 94 Pair.create("on_primary_fixed", mdc.onPrimaryFixed()), 95 Pair.create("on_primary_fixed_variant", mdc.onPrimaryFixedVariant()), 96 Pair.create("secondary_fixed", mdc.secondaryFixed()), 97 Pair.create("secondary_fixed_dim", mdc.secondaryFixedDim()), 98 Pair.create("on_secondary_fixed", mdc.onSecondaryFixed()), 99 Pair.create("on_secondary_fixed_variant", mdc.onSecondaryFixedVariant()), 100 Pair.create("tertiary_fixed", mdc.tertiaryFixed()), 101 Pair.create("tertiary_fixed_dim", mdc.tertiaryFixedDim()), 102 Pair.create("on_tertiary_fixed", mdc.onTertiaryFixed()), 103 Pair.create("on_tertiary_fixed_variant", mdc.onTertiaryFixedVariant()), 104 ) 105 } 106 } 107 } 108