Skip to content

Commit

Permalink
🆕 feat(Theme): add the surface-container color role
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem committed Sep 4, 2024
1 parent 2d64ba7 commit 4913fb8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/Masa.Blazor/Core/ThemeCssBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ public static string Build(Theme theme)

--m-theme-surface: {{options.Surface}};
--m-theme-on-surface: {{options.OnSurface}};
--m-theme-surface-container: {{options.SurfaceContainer}};
--m-theme-inverse-surface: {{options.InverseSurface}};
--m-theme-inverse-on-surface: {{options.InverseOnSurface}};
--m-theme-inverse-primary: {{options.InversePrimary}};

--m-theme-light-surface: {{light.Surface}};
--m-theme-light-on-surface: {{light.OnSurface}};
--m-theme-light-surface-container: {{light.SurfaceContainer}};
--m-theme-dark-surface: {{dark.Surface}};
--m-theme-dark-on-surface: {{dark.OnSurface}};
--m-theme-dark-surface-container: {{dark.SurfaceContainer}};
--m-theme-light-inverse-surface: {{light.InverseSurface}};
--m-theme-light-inverse-on-surface: {{light.InverseOnSurface}};
--m-theme-light-inverse-primary: {{light.InversePrimary}};
Expand Down
2 changes: 2 additions & 0 deletions src/Masa.Blazor/Services/MasaBlazorPreset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static class MasaBlazorPreset
OnWarning = "#FFFFFF",
Surface = "#FFFFFF",
OnSurface = "#000000DE",
SurfaceContainer = "#f5f5f5",
InverseSurface = "#121212",
InverseOnSurface = "#FFFFFF",
InversePrimary = "#2196F3"
Expand All @@ -62,6 +63,7 @@ public static class MasaBlazorPreset
OnWarning = "#FFFFFF",
Surface = "#121212",
OnSurface = "#FFFFFF",
SurfaceContainer = "#272727",
InverseSurface = "#FFFFFF",
InverseOnSurface = "#000000DE",
InversePrimary = "#1976D2"
Expand Down
2 changes: 2 additions & 0 deletions src/Masa.Blazor/Services/ThemeOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class ThemeOptions

public string? OnSurface { get; set; }

public string? SurfaceContainer { get; set; }

public string? InverseSurface { get; set; }

public string? InverseOnSurface { get; set; }
Expand Down
12 changes: 6 additions & 6 deletions src/Masa.Blazor/wwwroot/css/masa-blazor.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
}
}
.theme--light.m-app-bar.m-toolbar.m-sheet {
background-color: #f5f5f5;
background-color: var(--m-theme-light-surface-container);
}

.theme--dark.m-app-bar.m-toolbar.m-sheet {
background-color: #272727;
background-color: var(--m-theme-dark-surface-container);
}

.m-sheet.m-app-bar.m-toolbar {
Expand Down Expand Up @@ -24694,13 +24694,13 @@ html.overflow-y-hidden {
padding: 3px 0;
}
.theme--light.m-footer {
background-color: #f5f5f5;
color: rgba(0, 0, 0, 0.87);
background-color: var(--m-theme-light-surface-container);
color: var(--m-theme-light-on-surface);
}

.theme--dark.m-footer {
background-color: #272727;
color: #FFFFFF;
background-color: var(--m-theme-dark-surface-container);
color: var(--m-theme-dark-on-surface);
}

.m-sheet.m-footer {
Expand Down
4 changes: 2 additions & 2 deletions src/Masa.Blazor/wwwroot/css/masa-blazor.min.css

Large diffs are not rendered by default.

0 comments on commit 4913fb8

Please sign in to comment.