Skip to content

Commit

Permalink
Add Green and Orange themes
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobsen9026 committed Feb 18, 2024
1 parent 0951505 commit d12730e
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 114 deletions.
27 changes: 14 additions & 13 deletions BLAZAM/App.razor
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

@inject IHttpContextAccessor context
@inject IHttpContextAccessor context
@inject IApplicationUserStateService userStateService
@inject ICurrentUserStateService currentUser
@inject ICurrentUserStateService currentUser
<CascadingAuthenticationState>



<ErrorBoundary>

<ChildContent>
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
Expand Down Expand Up @@ -73,21 +72,23 @@
try
{
var userTheme = currentUser.State?.Preferences?.Theme;
switch (userTheme)
if (userTheme != null)
{
case "Blue":
default:
var matchingTheme = ApplicationTheme.Themes.FirstOrDefault(at => at.Name == userTheme);
if (matchingTheme != null)
{
activeTheme = matchingTheme;
}
else
{
activeTheme = new BlueTheme();
break;
case "Red":
activeTheme = new RedTheme();
break;


}

}
darkMode = currentUser.State?.Preferences?.DarkMode == true;
}
catch(Exception ex)
catch (Exception ex)
{
Loggers.SystemLogger.Error("Error while fetching user theme: {@Error}", ex);
}
Expand Down
50 changes: 42 additions & 8 deletions BLAZAMThemes/ApplicationTheme.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,53 @@

using BLAZAM.Helpers;
using MudBlazor;
using System.Drawing;


namespace BLAZAM.Themes
{

{
public class ApplicationTheme
{
public static List<ApplicationTheme> Themes = new List<ApplicationTheme> { new BlueTheme(), new RedTheme() };
protected Palette pallete { get; set; }
protected PaletteDark darkPallete { get; set; }
public static List<ApplicationTheme> Themes = new List<ApplicationTheme> { new BlueTheme(), new RedTheme(),new GreenTheme(),new OrangeTheme() };
protected PaletteLight lightPalette { get; set; }
protected PaletteDark darkPalette { get; set; }
protected string _name;

public ApplicationTheme()
{
lightPalette = new()
{
TextPrimary = "#050505",
TextSecondary = System.Drawing.Color.SlateGray.ToHex(),
HoverOpacity = 0,
Surface = System.Drawing.Color.WhiteSmoke.ToHex(),
DarkContrastText = System.Drawing.Color.WhiteSmoke.ToHex(),
DrawerText = System.Drawing.Color.WhiteSmoke.ToHex(),
Background = "#efefef",
Info = "#46a9ef",
Success = System.Drawing.Color.ForestGreen.ToHex(),
Warning = "#ff9900",
Error = System.Drawing.Color.Red.ToHex(),
TextDisabled = System.Drawing.Color.DarkGray.ToHex(),
White = System.Drawing.Color.White.ToHex()
};


darkPalette = new()
{
TextPrimary = "#c7c7c7",
DarkContrastText = "#383b40",
Surface = "#545960",
Background = "#383b40",
DrawerText = "#c7c7c7",
Info = "#1b8f7e",
Success = "#5fad00",
Warning = "#ffc270",
Error = "#f60066",
TextDisabled = System.Drawing.Color.DarkGray.ToHex(),
White = System.Drawing.Color.WhiteSmoke.ToHex(),
HoverOpacity = 0.25,
};
}

public string Name { get => _name; }

Expand All @@ -23,8 +57,8 @@ public MudTheme Theme
{
return new MudTheme
{
Palette = pallete,
PaletteDark = darkPallete,
Palette = lightPalette,
PaletteDark = darkPalette,

};
}
Expand Down
68 changes: 20 additions & 48 deletions BLAZAMThemes/BlueTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,55 +13,27 @@ public BlueTheme()
_name = "Blue";


pallete = new()
{
TextPrimary = "#050505",
TextSecondary = Color.SlateGray.ToHex(),
ActionDefault = "#9aafc3",
HoverOpacity = 0,
Surface = Color.WhiteSmoke.ToHex(),
DarkContrastText = Color.WhiteSmoke.ToHex(),
AppbarBackground = "#2261d3",
DrawerBackground = "#001529",
DrawerText = Color.WhiteSmoke.ToHex(),
Background = "#efefef",
//_textDark = "#001529",
Dark = "#001529",
Primary = "#2261d3",
Secondary = "#0c13a7",
Info = "#46a9ef",
Success = Color.ForestGreen.ToHex(),
Warning = "#ff9900",
Error = Color.Red.ToHex(),
//_body = Color.LightGray.ToHex(),
TextDisabled = Color.DarkGray.ToHex(),
White = Color.White.ToHex(),
};
lightPalette.ActionDefault = "#9aafc3";

lightPalette.AppbarBackground = "#2261d3";
lightPalette.DrawerBackground = "#001529";

lightPalette.Dark = "#001529";
lightPalette.Primary = "#2261d3";
lightPalette.Secondary = "#0c13a7";



darkPalette.TextSecondary = "#7e95a7";
darkPalette.ActionDefault = "#7b9ab1";
darkPalette.Dark = "#0f141e";
darkPalette.Primary = "#132a40";
darkPalette.AppbarBackground = "#132a40";
darkPalette.DrawerBackground = "#0f141e";
darkPalette.DrawerText = "#c7c7c7";
darkPalette.Secondary = "#2b5676";


darkPallete = new()
{
TextPrimary = "#c7c7c7",
TextSecondary = "#7e95a7",
ActionDefault = "#7b9ab1",
DarkContrastText = "#383b40",
Surface = "#545960",
Background = "#383b40",
// _textDark = "#202226",
Dark = "#0f141e",
Primary = "#132a40",
AppbarBackground = "#132a40",
DrawerBackground = "#0f141e",
DrawerText = "#c7c7c7",
Secondary = "#2b5676",
Info = "#1b8f7e",
Success = "#5fad00",
Warning = "#ffc270",
Error = "#f60066",
//_body = _light,
TextDisabled = Color.DarkGray.ToHex(),
White = Color.WhiteSmoke.ToHex(),
HoverOpacity = 0.25,
};

}
}
Expand Down
41 changes: 41 additions & 0 deletions BLAZAMThemes/GreenTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using BLAZAM.Helpers;
using System.Drawing;

namespace BLAZAM.Themes
{
public class GreenTheme : ApplicationTheme
{
public GreenTheme()
{



_name = "Green";


lightPalette.ActionDefault = "#9AC3A1";

lightPalette.AppbarBackground = "#22D340";
lightPalette.DrawerBackground = "#00290F"; ;

lightPalette.Dark = "#002902";
lightPalette.Primary = "#22D340";
lightPalette.Secondary = "#0CA726";



darkPalette.TextSecondary = "#7EA782";
darkPalette.ActionDefault = "#7BB18B";

darkPalette.Dark = "#0F1E12";
darkPalette.Primary = "#13401B";
darkPalette.AppbarBackground = "#134018";
darkPalette.DrawerBackground = "#0F1E12";
darkPalette.DrawerText = "#c7c7c7";
darkPalette.Secondary = "#2b5676";



}
}
}
41 changes: 41 additions & 0 deletions BLAZAMThemes/OrangeTheme.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using BLAZAM.Helpers;
using System.Drawing;

namespace BLAZAM.Themes
{
public class OrangeTheme : ApplicationTheme
{
public OrangeTheme()
{



_name = "Orange";


lightPalette.ActionDefault = "#C3AF9A";

lightPalette.AppbarBackground = "#D39E22";
lightPalette.DrawerBackground = "#291F00"; ;

lightPalette.Dark = "#291D00";
lightPalette.Primary = "#D39322";
lightPalette.Secondary = "#A76F0C";



darkPalette.TextSecondary = "#A7967E";
darkPalette.ActionDefault = "#B19A7B";

darkPalette.Dark = "#1E180F";
darkPalette.Primary = "#402D13";
darkPalette.AppbarBackground = "#403313";
darkPalette.DrawerBackground = "#1E1A0F";
darkPalette.DrawerText = "#c7c7c7";
darkPalette.Secondary = "#765B2B";



}
}
}
61 changes: 16 additions & 45 deletions BLAZAMThemes/RedTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,51 +11,22 @@ public RedTheme()
_name = "Red";


pallete = new()
{
TextPrimary = "#050505",
TextSecondary = Color.SlateGray.ToHex(),
ActionDefault = "#C39A9A",
HoverOpacity = 0,
Surface = Color.WhiteSmoke.ToHex(),
DarkContrastText = Color.WhiteSmoke.ToHex(),
AppbarBackground = "#D32222",
DrawerBackground = "#290300",
DrawerText = Color.WhiteSmoke.ToHex(),
Background = "#efefef",
Dark = "#001529",
Primary = "#D32222",
Secondary = "#A7A00C",
Info = "#46A9EF",
Success = Color.ForestGreen.ToHex(),
Warning = Color.Gold.ToHex(),
Error = Color.Red.ToHex(),
TextDisabled = Color.DarkGray.ToHex(),
White = Color.White.ToHex(),
};

darkPallete = new()
{
TextPrimary = "#c7c7c7",
TextSecondary = "#A77E86",
ActionDefault = "#B17B7E",
DarkContrastText = "#383b40",
Surface = "#545960",
Background = "#383b40",
Dark = "#0f141e",
Primary = "#401313",
AppbarBackground = "#401313",
DrawerBackground = "#1E0F0F",
DrawerText = "#c7c7c7",
Secondary = "#421818",
Info = "#1b8f7e",
Success = "#5fad00",
Warning = "#ffc270",
Error = "#f60066",
TextDisabled = Color.DarkGray.ToHex(),
White = Color.WhiteSmoke.ToHex(),
HoverOpacity = 0.25,
};
lightPalette.ActionDefault = "#C39A9A";
lightPalette.AppbarBackground = "#D32222";
lightPalette.DrawerBackground = "#290300";
lightPalette.Dark = "#290500";
lightPalette.Primary = "#D32222";
lightPalette.Secondary = "#A7A00C";


darkPalette.TextSecondary = "#A77E86";
darkPalette.ActionDefault = "#B17B7E";
darkPalette.Dark = "#1E110F";
darkPalette.Primary = "#401313";
darkPalette.AppbarBackground = "#401313";
darkPalette.DrawerBackground = "#1E0F0F";
darkPalette.Secondary = "#421818";


}
}
Expand Down

0 comments on commit d12730e

Please sign in to comment.