Farbpalette vorladen lassen

Bootstraper läd jetzt die farbeinstellung sofort und nicht nachträglich

cleanup and rework

PDF switch to HTML

export fix

Colorsystem

Farben für knöpfe hinzugefügt als anpassung

button color

button color primary and secondary change
This commit is contained in:
2026-03-23 22:42:52 +01:00
parent d5649dc189
commit d85f2e0fb3
84 changed files with 4216 additions and 1814 deletions
+37
View File
@@ -0,0 +1,37 @@
namespace cfs_tracker.Helpers;
public static class AppearanceDefaults
{
public static IReadOnlyDictionary<string, string> All { get; } = new Dictionary<string, string>
{
[AppearanceKeys.AppBackground] = "#0B1A2A",
[AppearanceKeys.SurfaceBackground] = "#132235",
[AppearanceKeys.SurfaceBackgroundAlt] = "#1A2B40",
[AppearanceKeys.Border] = "#2A3E55",
[AppearanceKeys.TextPrimary] = "#DCE7F3",
[AppearanceKeys.TextMuted] = "#8FA6BC",
[AppearanceKeys.StateGreen] = "#4E8B69",
[AppearanceKeys.StateYellow] = "#B89A42",
[AppearanceKeys.StateRed] = "#A85C5C",
[AppearanceKeys.StateGray] = "#1F242B",
[AppearanceKeys.StatusGreenText] = "Grün",
[AppearanceKeys.StatusYellowText] = "Gelb",
[AppearanceKeys.StatusRedText] = "Rot",
[AppearanceKeys.StatusGrayText] = "Schwarz",
[AppearanceKeys.ButtonPrimaryBackground] = "#355066",
[AppearanceKeys.ButtonPrimaryText] = "#FFFFFF",
[AppearanceKeys.ButtonSecondaryBackground] = "#355055",
[AppearanceKeys.ButtonSecondaryText] = "#DCE7F3",
[AppearanceKeys.ShellBackground] = "#10293F",
[AppearanceKeys.ShellForeground] = "#DCE7F3",
[AppearanceKeys.ShellTitle] = "#FFFFFF",
[AppearanceKeys.ShellUnselected] = "#8FA6BC",
[AppearanceKeys.TabBarBackground] = "#10293F",
[AppearanceKeys.TabBarForeground] = "#DCE7F3",
[AppearanceKeys.TabBarTitle] = "#FFFFFF",
[AppearanceKeys.TabBarUnselected] = "#8FA6BC",
};
}
+36
View File
@@ -0,0 +1,36 @@
namespace cfs_tracker.Helpers;
public static class AppearanceKeys
{
public const string AppBackground = nameof(AppBackground);
public const string SurfaceBackground = nameof(SurfaceBackground);
public const string SurfaceBackgroundAlt = nameof(SurfaceBackgroundAlt);
public const string Border = nameof(Border);
public const string TextPrimary = nameof(TextPrimary);
public const string TextMuted = nameof(TextMuted);
public const string StateGreen = nameof(StateGreen);
public const string StateYellow = nameof(StateYellow);
public const string StateRed = nameof(StateRed);
public const string StateGray = nameof(StateGray);
public const string StatusGreenText = nameof(StatusGreenText);
public const string StatusYellowText = nameof(StatusYellowText);
public const string StatusRedText = nameof(StatusRedText);
public const string StatusGrayText = nameof(StatusGrayText);
public const string ButtonPrimaryBackground = "ButtonPrimaryBackground";
public const string ButtonPrimaryText = "ButtonPrimaryText";
public const string ButtonSecondaryBackground = "ButtonSecondaryBackground";
public const string ButtonSecondaryText = "ButtonSecondaryText";
public const string ShellBackground = "ShellBackground";
public const string ShellForeground = "ShellForeground";
public const string ShellTitle = "ShellTitle";
public const string ShellUnselected = "ShellUnselected";
public const string TabBarBackground = "TabBarBackground";
public const string TabBarForeground = "TabBarForeground";
public const string TabBarTitle = "TabBarTitle";
public const string TabBarUnselected = "TabBarUnselected";
}
+46
View File
@@ -0,0 +1,46 @@
using Microsoft.Maui.Graphics;
namespace cfs_tracker.Helpers;
public static class ColorUtility
{
public static bool IsHexColor(string? value)
{
if (string.IsNullOrWhiteSpace(value))
return false;
try
{
_ = Color.FromArgb(NormalizeHex(value));
return true;
}
catch
{
return false;
}
}
public static Color ParseColor(string? value, string fallbackHex)
{
try
{
return Color.FromArgb(NormalizeHex(value));
}
catch
{
return Color.FromArgb(NormalizeHex(fallbackHex));
}
}
public static string NormalizeHex(string? value)
{
var text = (value ?? string.Empty).Trim();
if (string.IsNullOrWhiteSpace(text))
return "#000000";
if (!text.StartsWith('#'))
text = "#" + text;
return text.ToUpperInvariant();
}
}
+27
View File
@@ -0,0 +1,27 @@
using System.Globalization;
namespace cfs_tracker.Helpers;
public static class DateHelper
{
public static readonly CultureInfo GermanCulture = new("de-DE");
public static DateTime StartOfWeekMonday(DateTime date)
{
var normalized = date.Date;
var diff = (7 + (normalized.DayOfWeek - DayOfWeek.Monday)) % 7;
return normalized.AddDays(-diff);
}
public static string ToGermanDateText(DateTime date) =>
date.ToString("dddd, dd. MMMM yyyy", GermanCulture);
public static string ToGermanShortDay(DateTime date) =>
date.ToString("ddd dd.MM.", GermanCulture);
public static string ToGermanMonthYear(DateTime date) =>
date.ToString("MMMM yyyy", GermanCulture);
public static string ToGermanYear(DateTime date) =>
date.ToString("yyyy", GermanCulture);
}
+42
View File
@@ -0,0 +1,42 @@
using cfs_tracker.Models;
namespace cfs_tracker.Helpers;
public static class HealthStateExtensions
{
public static string ToAppearanceColorKey(this HealthState state) => state switch
{
HealthState.Green => AppearanceKeys.StateGreen,
HealthState.Yellow => AppearanceKeys.StateYellow,
HealthState.Red => AppearanceKeys.StateRed,
HealthState.Gray => AppearanceKeys.StateGray,
_ => AppearanceKeys.StateGray
};
public static string ToAppearanceTextKey(this HealthState state) => state switch
{
HealthState.Green => AppearanceKeys.StatusGreenText,
HealthState.Yellow => AppearanceKeys.StatusYellowText,
HealthState.Red => AppearanceKeys.StatusRedText,
HealthState.Gray => AppearanceKeys.StatusGrayText,
_ => AppearanceKeys.StatusGrayText
};
public static string ToFallbackText(this HealthState state) => state switch
{
HealthState.Green => "Grün",
HealthState.Yellow => "Gelb",
HealthState.Red => "Rot",
HealthState.Gray => "Schwarz",
_ => "Schwarz"
};
public static int ToScore(this HealthState state) => state switch
{
HealthState.Green => 3,
HealthState.Yellow => 2,
HealthState.Red => 1,
HealthState.Gray => 0,
_ => 0
};
}
-21
View File
@@ -1,21 +0,0 @@
namespace cfs_tracker.Helpers;
public static class ThemeKeys
{
public const string AppBackground = "AppBackground";
public const string PanelBackground = "PanelBackground";
public const string PanelBackground2 = "PanelBackground2";
public const string PanelBorder = "PanelBorder";
public const string TextPrimary = "TextPrimary";
public const string TextMuted = "TextMuted";
public const string StateGreen = "StateGreen";
public const string StateYellow = "StateYellow";
public const string StateRed = "StateRed";
public const string StateGray = "StateGray";
public const string StatusGreenText = "StatusGreenText";
public const string StatusYellowText = "StatusYellowText";
public const string StatusRedText = "StatusRedText";
public const string StatusGrayText = "StatusGrayText";
}
-23
View File
@@ -1,23 +0,0 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Graphics;
namespace cfs_tracker.Helpers;
public static class ThemeResourceHelper
{
public static Color GetColor(string key, string fallbackHex = "#FFFFFF")
{
if (Application.Current?.Resources.TryGetValue(key, out var value) == true && value is Color color)
return color;
return Color.FromArgb(fallbackHex);
}
public static string GetString(string key, string fallback = "")
{
if (Application.Current?.Resources.TryGetValue(key, out var value) == true && value is string text)
return text;
return fallback;
}
}