Skip to content

Commit

Permalink
Rename to CustomMaterialTheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Keboo committed Nov 26, 2024
1 parent 6c11bcd commit 9201422
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions Material.Avalonia.Demo/App.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@
</themes:MaterialTheme>

<!--
If you would prefer to use custom primary and second colors you can use the ColorTheme
If you would prefer to use custom primary and second colors you can use the CustomMaterialTheme
-->
<!--<themes:ColorTheme PrimaryColor="#4BEB59" SecondaryColor="#04C9F0" />-->
<!--<themes:CustomMaterialTheme PrimaryColor="#4BEB59" SecondaryColor="#04C9F0" />-->

<!--
If you need different colors for light and dark theme, the ColorTheme supports
If you need different colors for light and dark theme, the CustomMaterialTheme supports
individual resources for light and dark theme.
-->
<!--<themes:ColorTheme>
<themes:ColorTheme.Palettes>
<themes:ColorThemeResources x:Key="Dark"
<!--<themes:CustomMaterialTheme>
<themes:CustomMaterialTheme.Palettes>
<themes:CustomMaterialThemeResources x:Key="Dark"
PrimaryColor="#4BEB59"
SecondaryColor="#04C9F0" />
<themes:ColorThemeResources x:Key="Light"
<themes:CustomMaterialThemeResources x:Key="Light"
PrimaryColor="#29964A"
SecondaryColor="#0271A4" />
</themes:ColorTheme.Palettes>
</themes:ColorTheme>-->
</themes:CustomMaterialTheme.Palettes>
</themes:CustomMaterialTheme>-->
<avalonia:MaterialIconStyles />
<dialogHostAvalonia:DialogHostStyles />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Material.Styles.Themes;

public class ColorTheme : MaterialThemeBase, IDisposable {
public class CustomMaterialTheme : MaterialThemeBase, IDisposable {

public static readonly StyledProperty<Color?> PrimaryColorProperty =
AvaloniaProperty.Register<MaterialTheme, Color?>(nameof(PrimaryColor));
Expand All @@ -25,14 +25,14 @@ public class ColorTheme : MaterialThemeBase, IDisposable {
private IDisposable? _themeUpdateDisposable;
private bool _disposedValue;

public IDictionary<ThemeVariant, ColorThemeResources> Palettes { get; }
public IDictionary<ThemeVariant, CustomMaterialThemeResources> Palettes { get; }

/// <summary>
/// Initializes a new instance of the <see cref="MaterialTheme"/> class.
/// </summary>
/// <param name="serviceProvider">The XAML service provider.</param>
public ColorTheme(IServiceProvider serviceProvider) : base(serviceProvider) {
var palettes = new AvaloniaDictionary<ThemeVariant, ColorThemeResources>(2);
public CustomMaterialTheme(IServiceProvider serviceProvider) : base(serviceProvider) {
var palettes = new AvaloniaDictionary<ThemeVariant, CustomMaterialThemeResources>(2);
palettes.ForEachItem(
(key, x) => {
if (Owner is not null) {
Expand All @@ -41,7 +41,7 @@ public ColorTheme(IServiceProvider serviceProvider) : base(serviceProvider) {

if (key != ThemeVariant.Dark && key != ThemeVariant.Light) {
throw new InvalidOperationException(
$"{nameof(ColorTheme)}.{nameof(ColorTheme.Palettes)} only supports Light and Dark variants.");
$"{nameof(CustomMaterialTheme)}.{nameof(CustomMaterialTheme.Palettes)} only supports Light and Dark variants.");
}
},
(_, x) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Material.Styles.Themes;

public class ColorThemeResources {
public class CustomMaterialThemeResources {
public Color? PrimaryColor { get; set; }

public Color? SecondaryColor { get; set; }
Expand Down

0 comments on commit 9201422

Please sign in to comment.