For #27715: Allow FirefoxColors.copy to override some values
This helps to reduce theme color duplication, making it easier to see which parameters differ. This also brings FirefoxColors closer to the upstream Compose Material Colors class.
This commit is contained in:
parent
f814c7c0f3
commit
df2458002b
|
@ -87,72 +87,6 @@ object FirefoxTheme {
|
||||||
get() = defaultTypography
|
get() = defaultTypography
|
||||||
}
|
}
|
||||||
|
|
||||||
private val privateColorPalette = FirefoxColors(
|
|
||||||
layer1 = PhotonColors.Ink50,
|
|
||||||
layer2 = PhotonColors.Ink50,
|
|
||||||
layer3 = PhotonColors.Ink50,
|
|
||||||
layer4Start = PhotonColors.Purple70,
|
|
||||||
layer4Center = PhotonColors.Violet80,
|
|
||||||
layer4End = PhotonColors.Ink05,
|
|
||||||
layerAccent = PhotonColors.Violet40,
|
|
||||||
layerAccentNonOpaque = PhotonColors.Violet50A32,
|
|
||||||
layerAccentOpaque = Color(0xFF423262),
|
|
||||||
scrim = PhotonColors.DarkGrey90A95,
|
|
||||||
gradientStart = PhotonColors.Violet70,
|
|
||||||
gradientEnd = PhotonColors.Violet40,
|
|
||||||
actionPrimary = PhotonColors.Violet60,
|
|
||||||
actionSecondary = PhotonColors.LightGrey30,
|
|
||||||
actionTertiary = PhotonColors.DarkGrey10,
|
|
||||||
actionQuarternary = PhotonColors.DarkGrey80,
|
|
||||||
formDefault = PhotonColors.LightGrey05,
|
|
||||||
formSelected = PhotonColors.Violet40,
|
|
||||||
formSurface = PhotonColors.DarkGrey05,
|
|
||||||
formDisabled = PhotonColors.DarkGrey05,
|
|
||||||
formOn = PhotonColors.Violet40,
|
|
||||||
formOff = PhotonColors.LightGrey05,
|
|
||||||
indicatorActive = PhotonColors.LightGrey90,
|
|
||||||
indicatorInactive = PhotonColors.DarkGrey05,
|
|
||||||
textPrimary = PhotonColors.LightGrey05,
|
|
||||||
textSecondary = PhotonColors.LightGrey40,
|
|
||||||
textDisabled = PhotonColors.LightGrey05A40,
|
|
||||||
textWarning = PhotonColors.Red20,
|
|
||||||
textWarningButton = PhotonColors.Red70,
|
|
||||||
textAccent = PhotonColors.Violet20,
|
|
||||||
textAccentDisabled = PhotonColors.Violet20A60,
|
|
||||||
textOnColorPrimary = PhotonColors.LightGrey05,
|
|
||||||
textOnColorSecondary = PhotonColors.LightGrey40,
|
|
||||||
textActionPrimary = PhotonColors.LightGrey05,
|
|
||||||
textActionSecondary = PhotonColors.DarkGrey90,
|
|
||||||
textActionTertiary = PhotonColors.LightGrey05,
|
|
||||||
textActionTertiaryActive = PhotonColors.LightGrey05,
|
|
||||||
iconPrimary = PhotonColors.LightGrey05,
|
|
||||||
iconPrimaryInactive = PhotonColors.LightGrey05A60,
|
|
||||||
iconSecondary = PhotonColors.LightGrey40,
|
|
||||||
iconActive = PhotonColors.Violet40,
|
|
||||||
iconDisabled = PhotonColors.LightGrey05A40,
|
|
||||||
iconOnColor = PhotonColors.LightGrey05,
|
|
||||||
iconNotice = PhotonColors.Blue30,
|
|
||||||
iconButton = PhotonColors.LightGrey05,
|
|
||||||
iconWarning = PhotonColors.Red20,
|
|
||||||
iconWarningButton = PhotonColors.Red70,
|
|
||||||
iconAccentViolet = PhotonColors.Violet20,
|
|
||||||
iconAccentBlue = PhotonColors.Blue20,
|
|
||||||
iconAccentPink = PhotonColors.Pink20,
|
|
||||||
iconAccentGreen = PhotonColors.Green20,
|
|
||||||
iconAccentYellow = PhotonColors.Yellow20,
|
|
||||||
iconActionPrimary = PhotonColors.LightGrey05,
|
|
||||||
iconActionSecondary = PhotonColors.DarkGrey90,
|
|
||||||
iconActionTertiary = PhotonColors.LightGrey05,
|
|
||||||
iconGradientStart = PhotonColors.Violet20,
|
|
||||||
iconGradientEnd = PhotonColors.Blue20,
|
|
||||||
borderPrimary = PhotonColors.DarkGrey05,
|
|
||||||
borderInverted = PhotonColors.LightGrey30,
|
|
||||||
borderFormDefault = PhotonColors.LightGrey05,
|
|
||||||
borderAccent = PhotonColors.Violet40,
|
|
||||||
borderDisabled = PhotonColors.LightGrey05A40,
|
|
||||||
borderWarning = PhotonColors.Red40,
|
|
||||||
)
|
|
||||||
|
|
||||||
private val darkColorPalette = FirefoxColors(
|
private val darkColorPalette = FirefoxColors(
|
||||||
layer1 = PhotonColors.DarkGrey60,
|
layer1 = PhotonColors.DarkGrey60,
|
||||||
layer2 = PhotonColors.DarkGrey30,
|
layer2 = PhotonColors.DarkGrey30,
|
||||||
|
@ -285,6 +219,12 @@ private val lightColorPalette = FirefoxColors(
|
||||||
borderWarning = PhotonColors.Red70,
|
borderWarning = PhotonColors.Red70,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
private val privateColorPalette = darkColorPalette.copy(
|
||||||
|
layer1 = PhotonColors.Ink50,
|
||||||
|
layer2 = PhotonColors.Ink50,
|
||||||
|
layer3 = PhotonColors.Ink50,
|
||||||
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom Color Palette for Mozilla Firefox for Android (Fenix).
|
* A custom Color Palette for Mozilla Firefox for Android (Fenix).
|
||||||
*/
|
*/
|
||||||
|
@ -669,7 +609,74 @@ class FirefoxColors(
|
||||||
borderWarning = other.borderWarning
|
borderWarning = other.borderWarning
|
||||||
}
|
}
|
||||||
|
|
||||||
fun copy(): FirefoxColors = FirefoxColors(
|
/**
|
||||||
|
* Return a copy of this [FirefoxColors] and optionally overriding any of the provided values.
|
||||||
|
*/
|
||||||
|
fun copy(
|
||||||
|
layer1: Color = this.layer1,
|
||||||
|
layer2: Color = this.layer2,
|
||||||
|
layer3: Color = this.layer3,
|
||||||
|
layer4Start: Color = this.layer4Start,
|
||||||
|
layer4Center: Color = this.layer4Center,
|
||||||
|
layer4End: Color = this.layer4End,
|
||||||
|
layerAccent: Color = this.layerAccent,
|
||||||
|
layerAccentNonOpaque: Color = this.layerAccentNonOpaque,
|
||||||
|
layerAccentOpaque: Color = this.layerAccentOpaque,
|
||||||
|
scrim: Color = this.scrim,
|
||||||
|
gradientStart: Color = this.gradientStart,
|
||||||
|
gradientEnd: Color = this.gradientEnd,
|
||||||
|
actionPrimary: Color = this.actionPrimary,
|
||||||
|
actionSecondary: Color = this.actionSecondary,
|
||||||
|
actionTertiary: Color = this.actionTertiary,
|
||||||
|
actionQuarternary: Color = this.actionQuarternary,
|
||||||
|
formDefault: Color = this.formDefault,
|
||||||
|
formSelected: Color = this.formSelected,
|
||||||
|
formSurface: Color = this.formSurface,
|
||||||
|
formDisabled: Color = this.formDisabled,
|
||||||
|
formOn: Color = this.formOn,
|
||||||
|
formOff: Color = this.formOff,
|
||||||
|
indicatorActive: Color = this.indicatorActive,
|
||||||
|
indicatorInactive: Color = this.indicatorInactive,
|
||||||
|
textPrimary: Color = this.textPrimary,
|
||||||
|
textSecondary: Color = this.textSecondary,
|
||||||
|
textDisabled: Color = this.textDisabled,
|
||||||
|
textWarning: Color = this.textWarning,
|
||||||
|
textWarningButton: Color = this.textWarningButton,
|
||||||
|
textAccent: Color = this.textAccent,
|
||||||
|
textAccentDisabled: Color = this.textAccentDisabled,
|
||||||
|
textOnColorPrimary: Color = this.textOnColorPrimary,
|
||||||
|
textOnColorSecondary: Color = this.textOnColorSecondary,
|
||||||
|
textActionPrimary: Color = this.textActionPrimary,
|
||||||
|
textActionSecondary: Color = this.textActionSecondary,
|
||||||
|
textActionTertiary: Color = this.textActionTertiary,
|
||||||
|
textActionTertiaryActive: Color = this.textActionTertiaryActive,
|
||||||
|
iconPrimary: Color = this.iconPrimary,
|
||||||
|
iconPrimaryInactive: Color = this.iconPrimaryInactive,
|
||||||
|
iconSecondary: Color = this.iconSecondary,
|
||||||
|
iconActive: Color = this.iconActive,
|
||||||
|
iconDisabled: Color = this.iconDisabled,
|
||||||
|
iconOnColor: Color = this.iconOnColor,
|
||||||
|
iconNotice: Color = this.iconNotice,
|
||||||
|
iconButton: Color = this.iconButton,
|
||||||
|
iconWarning: Color = this.iconWarning,
|
||||||
|
iconWarningButton: Color = this.iconWarningButton,
|
||||||
|
iconAccentViolet: Color = this.iconAccentViolet,
|
||||||
|
iconAccentBlue: Color = this.iconAccentBlue,
|
||||||
|
iconAccentPink: Color = this.iconAccentPink,
|
||||||
|
iconAccentGreen: Color = this.iconAccentGreen,
|
||||||
|
iconAccentYellow: Color = this.iconAccentYellow,
|
||||||
|
iconActionPrimary: Color = this.iconActionPrimary,
|
||||||
|
iconActionSecondary: Color = this.iconActionSecondary,
|
||||||
|
iconActionTertiary: Color = this.iconActionTertiary,
|
||||||
|
iconGradientStart: Color = this.iconGradientStart,
|
||||||
|
iconGradientEnd: Color = this.iconGradientEnd,
|
||||||
|
borderPrimary: Color = this.borderPrimary,
|
||||||
|
borderInverted: Color = this.borderInverted,
|
||||||
|
borderFormDefault: Color = this.borderFormDefault,
|
||||||
|
borderAccent: Color = this.borderAccent,
|
||||||
|
borderDisabled: Color = this.borderDisabled,
|
||||||
|
borderWarning: Color = this.borderWarning,
|
||||||
|
): FirefoxColors = FirefoxColors(
|
||||||
layer1 = layer1,
|
layer1 = layer1,
|
||||||
layer2 = layer2,
|
layer2 = layer2,
|
||||||
layer3 = layer3,
|
layer3 = layer3,
|
||||||
|
|
|
@ -664,7 +664,6 @@
|
||||||
<ID>UndocumentedPublicFunction:FenixSnackbar.kt$FenixSnackbar$fun setLength(duration: Int)</ID>
|
<ID>UndocumentedPublicFunction:FenixSnackbar.kt$FenixSnackbar$fun setLength(duration: Int)</ID>
|
||||||
<ID>UndocumentedPublicFunction:FenixSnackbar.kt$FenixSnackbar$fun setText(text: String)</ID>
|
<ID>UndocumentedPublicFunction:FenixSnackbar.kt$FenixSnackbar$fun setText(text: String)</ID>
|
||||||
<ID>UndocumentedPublicFunction:FirefoxTheme.kt$@Composable fun ProvideFirefoxColors( colors: FirefoxColors, content: @Composable () -> Unit, )</ID>
|
<ID>UndocumentedPublicFunction:FirefoxTheme.kt$@Composable fun ProvideFirefoxColors( colors: FirefoxColors, content: @Composable () -> Unit, )</ID>
|
||||||
<ID>UndocumentedPublicFunction:FirefoxTheme.kt$FirefoxColors$fun copy(): FirefoxColors</ID>
|
|
||||||
<ID>UndocumentedPublicFunction:FirefoxTheme.kt$FirefoxColors$fun update(other: FirefoxColors)</ID>
|
<ID>UndocumentedPublicFunction:FirefoxTheme.kt$FirefoxColors$fun update(other: FirefoxColors)</ID>
|
||||||
<ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.breadcrumb( message: String, data: Map<String, String> = emptyMap(), )</ID>
|
<ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.breadcrumb( message: String, data: Map<String, String> = emptyMap(), )</ID>
|
||||||
<ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.getPreferenceKey(@StringRes resourceId: Int): String</ID>
|
<ID>UndocumentedPublicFunction:Fragment.kt$fun Fragment.getPreferenceKey(@StringRes resourceId: Int): String</ID>
|
||||||
|
|
Loading…
Reference in New Issue