Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colors no longer overridden #798

Open
CybrZr00 opened this issue Oct 7, 2024 · 3 comments
Open

Colors no longer overridden #798

CybrZr00 opened this issue Oct 7, 2024 · 3 comments

Comments

@CybrZr00
Copy link

CybrZr00 commented Oct 7, 2024

Hi,

After updating to the latest version: 2.10.2 My colour overrides no longer work, and the default colors are shown.

My MAUI app is exclusively for Windows, so I can't comment on if the other platforms are affected.

I was able to reproduce the result in a new project as well (See attached picture
uraniumbg
).

This is how I'm overriding:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary x:Name="appColors" Source="Resources/Styles/Colors.xaml" /> <ResourceDictionary Source="Resources/Styles/Styles.xaml" /> <material:StyleResource ColorsOverride="{x:Reference appColors}" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>

Here are my colors:

`

<!--  Note: For Android please see also Platforms\Android\Resources\values\colors.xml  -->

<Color x:Key="PrimaryDarkText">#242424</Color>
<Color x:Key="SecondaryDarkText">#9880e5</Color>

<Color x:Key="White">White</Color>
<Color x:Key="Black">Black</Color>
<Color x:Key="Magenta">#D600AA</Color>
<Color x:Key="MidnightBlue">#190649</Color>
<Color x:Key="OffBlack">#1f1f1f</Color>

<Color x:Key="Gray100">#E1E1E1</Color>
<Color x:Key="Gray200">#C8C8C8</Color>
<Color x:Key="Gray300">#ACACAC</Color>
<Color x:Key="Gray400">#919191</Color>
<Color x:Key="Gray500">#6E6E6E</Color>
<Color x:Key="Gray600">#404040</Color>
<Color x:Key="Gray900">#212121</Color>
<Color x:Key="Gray950">#141414</Color>

<Color x:Key="Success">#4CAF50</Color>
<Color x:Key="SuccessDark">#1B5E20</Color>
<Color x:Key="OnSuccess">White</Color>
<Color x:Key="OnSuccessDark">#EEEEEE</Color>

<Color x:Key="Warning">#FFC107</Color>
<Color x:Key="WarningDark">#FFA000</Color>
<Color x:Key="OnWarning">#FFF8E1</Color>
<Color x:Key="OnWarningDark">#FFF3E0</Color>

<Color x:Key="Info">#2196F3</Color>
<Color x:Key="InfoDark">#1976D2</Color>
<Color x:Key="OnInfo">#E3F2FD</Color>
<Color x:Key="OnInfoDark">#BBDEFB</Color>

<Color x:Key="Danger">#F44336</Color>
<Color x:Key="DangerDark">#D32F2F</Color>
<Color x:Key="OnDanger">#FFEBEE</Color>
<Color x:Key="OnDangerDark">#EF9A9A</Color>

<Color x:Key="SemiTransparentBlack">#31000050</Color>

<Color x:Key="Primary">#B32829</Color>
<Color x:Key="PrimaryDark">#910915</Color>
<Color x:Key="PrimaryContainer">#B32829</Color>
<Color x:Key="PrimaryContainerDark">#910915</Color>

<Color x:Key="Secondary">#FF775653</Color>
<Color x:Key="SecondaryDark">#E7BDB9</Color>
<Color x:Key="SecondaryContainer">#FFDAD6</Color>
<Color x:Key="SecondaryContainerDark">#5D3F3D</Color>

<Color x:Key="Tertiary">#725B2E</Color>
<Color x:Key="TertiaryDark">#E1C28C</Color>
<Color x:Key="TertiaryContainer">#FFDEA6</Color>
<Color x:Key="TertiaryContainerDark">#584319</Color>

<Color x:Key="Surface">#FFFBFF</Color>
<Color x:Key="SurfaceDark">#1C1B1F</Color>

<Color x:Key="SurfaceVariant">#F5DDDB</Color>
<Color x:Key="SurfaceVariantDark">#534342</Color>

<Color x:Key="Background">#FFFBFF</Color>
<Color x:Key="BackgroundDark">#201A19</Color>

<Color x:Key="Error">#BA1A1A</Color>
<Color x:Key="ErrorDark">#FFB4AB</Color>
<Color x:Key="ErrorContainer">#FFDAD6</Color>
<Color x:Key="ErrorContainerDark">#93000A</Color>

<Color x:Key="OnPrimary">#FFFFFF</Color>
<Color x:Key="OnPrimaryDark">#E1E1E1</Color>
<Color x:Key="OnPrimaryContainer">#410003</Color>
<Color x:Key="OnPrimaryContainerDark">#FFDAD6</Color>

<Color x:Key="OnSecondary">#FFFFFF</Color>
<Color x:Key="OnSecondaryDark">#442927</Color>
<Color x:Key="OnSecondaryContainer">#2C1513</Color>
<Color x:Key="OnSecondaryContainerDark">#FFDAD6</Color>

<Color x:Key="OnTertiary">#FFFFFF</Color>
<Color x:Key="OnTertiaryDark">#402D04</Color>
<Color x:Key="OnTertiaryContainer">#261900</Color>
<Color x:Key="OnTertiaryContainerDark">#FFDEA6</Color>

<Color x:Key="OnSurface">#201A19</Color>
<Color x:Key="OnSurfaceDark">#EDE0DE</Color>

<Color x:Key="OnSurfaceVariant">#534342</Color>
<Color x:Key="OnSurfaceVariantDark">#D8C2BF</Color>

<Color x:Key="OnError">#FFFFFF</Color>
<Color x:Key="OnErrorDark">#690005</Color>
<Color x:Key="OnErrorContainer">#410002</Color>
<Color x:Key="OnErrorContainerDark">#FFDAD6</Color>

<Color x:Key="OnBackground">#201A19</Color>
<Color x:Key="OnBackgroundDark">#EDE0DE</Color>

<Color x:Key="Outline">#857371</Color>
<Color x:Key="OutlineDark">#A08C8A</Color>

<Color x:Key="OutlineVariant">#D8C2BF</Color>
<Color x:Key="OutlineVariantDark">#534342</Color>

<Color x:Key="Shadow">#000000</Color>
<Color x:Key="ShadowDark">#000000</Color>

<Color x:Key="SurfaceTint">#B32829</Color>
<Color x:Key="SurfaceTintDark">#FFB3AD</Color>

<Color x:Key="InverseSurface">#362F2E</Color>
<Color x:Key="InverseSurfaceDark">#EDE0DE</Color>
<Color x:Key="InverseOnSurface">#FBEEEC</Color>
<Color x:Key="InverseOnSurfaceDark">#201A19</Color>

<Color x:Key="InversePrimary">#FFB3AD</Color>
<Color x:Key="InversePrimaryDark">#B32829</Color>

<Color x:Key="Scrim">#000000</Color>
<Color x:Key="ScrimDark">#000000</Color>

<SolidColorBrush x:Key="PrimaryBrush" Color="{StaticResource Primary}" />
<SolidColorBrush x:Key="SecondaryBrush" Color="{StaticResource Secondary}" />
<SolidColorBrush x:Key="TertiaryBrush" Color="{StaticResource Tertiary}" />
<SolidColorBrush x:Key="WhiteBrush" Color="{StaticResource White}" />
<SolidColorBrush x:Key="BlackBrush" Color="{StaticResource Black}" />

<SolidColorBrush x:Key="Gray100Brush" Color="{StaticResource Gray100}" />
<SolidColorBrush x:Key="Gray200Brush" Color="{StaticResource Gray200}" />
<SolidColorBrush x:Key="Gray300Brush" Color="{StaticResource Gray300}" />
<SolidColorBrush x:Key="Gray400Brush" Color="{StaticResource Gray400}" />
<SolidColorBrush x:Key="Gray500Brush" Color="{StaticResource Gray500}" />
<SolidColorBrush x:Key="Gray600Brush" Color="{StaticResource Gray600}" />
<SolidColorBrush x:Key="Gray900Brush" Color="{StaticResource Gray900}" />
<SolidColorBrush x:Key="Gray950Brush" Color="{StaticResource Gray950}" />

`

@enisn
Copy link
Owner

enisn commented Oct 8, 2024

As a breaking-change, containers started to use Brushes instead colors, (#773)
I need to include it in the migration guide.

Can you try overriding PrimaryContainerDarkBrush and PrimaryContainerBrush according to your requirements

<!-- With Single color -->
<SolidColorBrush x:Key="PrimaryContainerBrush" Color="{StaticResource PrimaryContainer}" />
<SolidColorBrush x:Key="PrimaryContainerDarkBrush" Color="{StaticResource PrimaryContainerDark}" />


<!-- Or with gradiend brush -->
  <LinearGradientBrush x:Key="PrimaryContainerDarkBrush">
      <GradientStop Offset="0" Color="{StaticResource PrimaryContainerDark}" />
      <GradientStop Offset="1" Color="{StaticResource SecondaryContainerDark}" />
  </LinearGradientBrush>

  <LinearGradientBrush x:Key="PrimaryContainerBrush">
      <GradientStop Offset="0" Color="{StaticResource PrimaryContainer}" />
      <GradientStop Offset="1" Color="{StaticResource SecondaryContainer}" />
  </LinearGradientBrush>

@CybrZr00
Copy link
Author

CybrZr00 commented Oct 8, 2024

Ah, OK. I've updated my colors with the additional brushes and can confirm that's all it was. Thank you!

@CybrZr00 CybrZr00 closed this as completed Oct 8, 2024
@CybrZr00
Copy link
Author

CybrZr00 commented Oct 8, 2024

I jumped the gun a bit it seems. I forgot that I'd switched the elements in question over to my own styling. Those changes actually didn't change anything and I still get the default gradient brush.

Edit:
Some extra info. The SecondaryContainer styleclass doesn't seem to have been affected. It looks like it's just the primary.

@CybrZr00 CybrZr00 reopened this Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants