refactor stringnames to constants

This commit is contained in:
Matt Parker
2025-11-29 13:45:10 +10:00
parent 934f0bcdde
commit 01ff6706be
2 changed files with 11 additions and 6 deletions

View File

@@ -119,14 +119,14 @@ public partial class ProblemsPanel : Control
} }
// Get font and prepare text // Get font and prepare text
var font = _tree.GetThemeFont("font"); var font = _tree.GetThemeFont(ThemeStringNames.Font);
var fontSize = _tree.GetThemeFontSize("font_size"); var fontSize = _tree.GetThemeFontSize(ThemeStringNames.FontSize);
var textColor = (isSelected, hovered) switch var textColor = (isSelected, hovered) switch
{ {
(true, true) => _tree.GetThemeColor("font_hovered_selected_color"), (true, true) => _tree.GetThemeColor(ThemeStringNames.FontHoveredSelectedColor),
(true, false) => _tree.GetThemeColor("font_selected_color"), (true, false) => _tree.GetThemeColor(ThemeStringNames.FontSelectedColor),
(false, true) => _tree.GetThemeColor("font_hovered_color"), (false, true) => _tree.GetThemeColor(ThemeStringNames.FontHoveredColor),
(false, false) => _tree.GetThemeColor("font_color") (false, false) => _tree.GetThemeColor(ThemeStringNames.FontColor)
}; };
var textYPos = currentY + (rect.Size.Y + fontSize) / 2 - 2; var textYPos = currentY + (rect.Size.Y + fontSize) / 2 - 2;

View File

@@ -15,5 +15,10 @@ public static class InputStringNames
public static class ThemeStringNames public static class ThemeStringNames
{ {
public static readonly StringName Font = "font";
public static readonly StringName FontColor = "font_color"; public static readonly StringName FontColor = "font_color";
public static readonly StringName FontSize = "font_size";
public static readonly StringName FontSelectedColor = "font_selected_color";
public static readonly StringName FontHoveredColor = "font_hovered_color";
public static readonly StringName FontHoveredSelectedColor = "font_hovered_selected_color";
} }