diff --git a/Dalamud/Interface/Colors/ColorDemoWindow.cs b/Dalamud/Interface/Colors/ColorDemoWindow.cs
new file mode 100644
index 000000000..4dc4e30c9
--- /dev/null
+++ b/Dalamud/Interface/Colors/ColorDemoWindow.cs
@@ -0,0 +1,61 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Numerics;
+
+using Dalamud.Interface.Windowing;
+using ImGuiNET;
+
+namespace Dalamud.Interface.Colors
+{
+ ///
+ /// color Demo Window to view custom ImGui colors.
+ ///
+ internal class ColorDemoWindow : Window
+ {
+ private readonly List> colors;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public ColorDemoWindow()
+ : base("Dalamud Colors Demo")
+ {
+ this.Size = new Vector2(600, 500);
+ this.SizeCondition = ImGuiCond.FirstUseEver;
+ this.colors = new List>
+ {
+ Demo("White", ImGuiColors.White),
+ Demo("DalamudRed", ImGuiColors.DalamudRed),
+ Demo("DalamudGrey", ImGuiColors.DalamudGrey),
+ Demo("DalamudGrey2", ImGuiColors.DalamudGrey2),
+ Demo("DalamudGrey3", ImGuiColors.DalamudGrey3),
+ Demo("DalamudWhite", ImGuiColors.DalamudWhite),
+ Demo("DalamudWhite2", ImGuiColors.DalamudWhite2),
+ Demo("DalamudOrange", ImGuiColors.DalamudOrange),
+ Demo("TankBlue", ImGuiColors.TankBlue),
+ Demo("HealerGreen", ImGuiColors.HealerGreen),
+ Demo("DPSRed", ImGuiColors.DPSRed),
+ };
+ this.colors = this.colors.OrderBy(colorDemo => colorDemo.Key).ToList();
+ }
+
+ ///
+ public override void Draw()
+ {
+ ImGui.BeginChild("color_scrolling", new Vector2(0, 0), false, ImGuiWindowFlags.AlwaysVerticalScrollbar | ImGuiWindowFlags.HorizontalScrollbar);
+ ImGui.Text("This is a collection of UI colors you can use in your plugin.");
+ ImGui.Separator();
+ foreach (var color in this.colors)
+ {
+ ImGui.TextColored(color.Value, color.Key);
+ }
+
+ ImGui.EndChild();
+ }
+
+ private static KeyValuePair Demo(string name, Vector4 color)
+ {
+ return new KeyValuePair(name, color);
+ }
+ }
+}
diff --git a/Dalamud/Interface/Colors/ImGuiColors.cs b/Dalamud/Interface/Colors/ImGuiColors.cs
new file mode 100644
index 000000000..3613e8e49
--- /dev/null
+++ b/Dalamud/Interface/Colors/ImGuiColors.cs
@@ -0,0 +1,65 @@
+using System.Numerics;
+
+namespace Dalamud.Interface.Colors
+{
+ ///
+ /// Class containing frequently used colors for easier reference.
+ ///
+ public static class ImGuiColors
+ {
+ ///
+ /// Gets white color.
+ ///
+ public static Vector4 White { get; } = new Vector4(255, 255, 255, 1);
+
+ ///
+ /// Gets red used in dalamud.
+ ///
+ public static Vector4 DalamudRed { get; } = new Vector4(1f, 0f, 0f, 1f);
+
+ ///
+ /// Gets grey used in dalamud.
+ ///
+ public static Vector4 DalamudGrey { get; } = new Vector4(0.70f, 0.70f, 0.70f, 1.00f);
+
+ ///
+ /// Gets grey used in dalamud.
+ ///
+ public static Vector4 DalamudGrey2 { get; } = new Vector4(0.7f, 0.7f, 0.7f, 1.0f);
+
+ ///
+ /// Gets grey used in dalamud.
+ ///
+ public static Vector4 DalamudGrey3 { get; } = new Vector4(0.5f, 0.5f, 0.5f, 1.0f);
+
+ ///
+ /// Gets white used in dalamud.
+ ///
+ public static Vector4 DalamudWhite { get; } = new Vector4(1f, 1f, 1f, 1f);
+
+ ///
+ /// Gets white used in dalamud.
+ ///
+ public static Vector4 DalamudWhite2 { get; } = new Vector4(0.878f, 0.878f, 0.878f, 1f);
+
+ ///
+ /// Gets orange used in dalamud.
+ ///
+ public static Vector4 DalamudOrange { get; } = new Vector4(1f, 0.709f, 0f, 1f);
+
+ ///
+ /// Gets tank blue (UIColor37).
+ ///
+ public static Vector4 TankBlue { get; } = new Vector4(0, 0.6f, 1, 1);
+
+ ///
+ /// Gets healer green (UIColor504).
+ ///
+ public static Vector4 HealerGreen { get; } = new Vector4(0, 0.8f, 0.1333333f, 1);
+
+ ///
+ /// Gets dps red (UIColor545).
+ ///
+ public static Vector4 DPSRed { get; } = new Vector4(0.7058824f, 0, 0, 1);
+ }
+}
diff --git a/Dalamud/Interface/DalamudInterface.cs b/Dalamud/Interface/DalamudInterface.cs
index f9870e8ff..13543d017 100644
--- a/Dalamud/Interface/DalamudInterface.cs
+++ b/Dalamud/Interface/DalamudInterface.cs
@@ -7,6 +7,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CheapLoc;
+using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Windowing;
using Dalamud.Plugin;
@@ -31,6 +32,7 @@ namespace Dalamud.Interface
private readonly DalamudPluginStatWindow pluginStatWindow;
private readonly DalamudChangelogWindow changelogWindow;
private readonly ComponentDemoWindow componentDemoWindow;
+ private readonly ColorDemoWindow colorDemoWindow;
private readonly WindowSystem windowSystem = new WindowSystem("DalamudCore");
@@ -100,6 +102,12 @@ namespace Dalamud.Interface
};
this.windowSystem.AddWindow(this.componentDemoWindow);
+ this.colorDemoWindow = new ColorDemoWindow()
+ {
+ IsOpen = false,
+ };
+ this.windowSystem.AddWindow(this.colorDemoWindow);
+
Log.Information("[DUI] Windows added");
if (dalamud.Configuration.LogOpenAtStartup)
@@ -208,6 +216,11 @@ namespace Dalamud.Interface
this.OpenComponentDemo();
}
+ if (ImGui.MenuItem("Open Colors Demo"))
+ {
+ this.OpenColorsDemo();
+ }
+
ImGui.MenuItem("Draw ImGui demo", string.Empty, ref this.isImguiDrawDemoWindow);
ImGui.Separator();
@@ -420,6 +433,14 @@ namespace Dalamud.Interface
this.componentDemoWindow.IsOpen = true;
}
+ ///
+ /// Open the colors test window.
+ ///
+ internal void OpenColorsDemo()
+ {
+ this.colorDemoWindow.IsOpen = true;
+ }
+
///
/// Toggle the Plugin Installer window.
///
diff --git a/Dalamud/Interface/DalamudLogWindow.cs b/Dalamud/Interface/DalamudLogWindow.cs
index 3a3c11ad1..5504f1028 100644
--- a/Dalamud/Interface/DalamudLogWindow.cs
+++ b/Dalamud/Interface/DalamudLogWindow.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using Dalamud.Configuration;
using Dalamud.Game.Command;
+using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using ImGuiNET;
using Serilog;
@@ -46,13 +47,13 @@ namespace Dalamud.Interface
{
var color = logEvent.level switch
{
- LogEventLevel.Error => new Vector4(1f, 0f, 0f, 1f),
- LogEventLevel.Verbose => new Vector4(1f, 1f, 1f, 1f),
- LogEventLevel.Debug => new Vector4(0.878f, 0.878f, 0.878f, 1f),
- LogEventLevel.Information => new Vector4(1f, 1f, 1f, 1f),
- LogEventLevel.Warning => new Vector4(1f, 0.709f, 0f, 1f),
- LogEventLevel.Fatal => new Vector4(1f, 0f, 0f, 1f),
- _ => throw new ArgumentOutOfRangeException()
+ LogEventLevel.Error => ImGuiColors.DalamudRed,
+ LogEventLevel.Verbose => ImGuiColors.DalamudWhite,
+ LogEventLevel.Debug => ImGuiColors.DalamudWhite2,
+ LogEventLevel.Information => ImGuiColors.DalamudWhite,
+ LogEventLevel.Warning => ImGuiColors.DalamudOrange,
+ LogEventLevel.Fatal => ImGuiColors.DalamudRed,
+ _ => throw new ArgumentOutOfRangeException(),
};
AddLog(logEvent.line, color);
diff --git a/Dalamud/Interface/DalamudSettingsWindow.cs b/Dalamud/Interface/DalamudSettingsWindow.cs
index ab9ba9b83..d0b467e32 100644
--- a/Dalamud/Interface/DalamudSettingsWindow.cs
+++ b/Dalamud/Interface/DalamudSettingsWindow.cs
@@ -8,6 +8,7 @@ using System.Windows.Forms.VisualStyles;
using CheapLoc;
using Dalamud.Configuration;
using Dalamud.Game.Text;
+using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using ImGuiNET;
using Serilog;
@@ -114,8 +115,8 @@ namespace Dalamud.Interface
private string[] locLanguages;
private int langIndex;
- private Vector4 hintTextColor = new Vector4(0.70f, 0.70f, 0.70f, 1.00f);
- private Vector4 warnTextColor = new Vector4(1.0f, 0.0f, 0.0f, 1.00f);
+ private Vector4 hintTextColor = ImGuiColors.DalamudGrey;
+ private Vector4 warnTextColor = ImGuiColors.DalamudRed;
private XivChatType dalamudMessagesChatType;
diff --git a/Dalamud/Plugin/PluginInstallerWindow.cs b/Dalamud/Plugin/PluginInstallerWindow.cs
index 497acdb37..702958c58 100644
--- a/Dalamud/Plugin/PluginInstallerWindow.cs
+++ b/Dalamud/Plugin/PluginInstallerWindow.cs
@@ -7,6 +7,7 @@ using System.Threading.Tasks;
using CheapLoc;
using Dalamud.Interface;
+using Dalamud.Interface.Colors;
using Dalamud.Interface.Windowing;
using ImGuiNET;
using Serilog;
@@ -19,7 +20,6 @@ namespace Dalamud.Plugin
internal class PluginInstallerWindow : Window
{
private readonly Dalamud dalamud;
- private readonly Vector4 colorGrey = new Vector4(0.70f, 0.70f, 0.70f, 1.00f);
private string gameVersion;
@@ -326,7 +326,7 @@ namespace Dalamud.Plugin
ImGui.SetCursorPosY(ImGui.GetCursorPosY() - 5);
if (statusText != null)
- ImGui.TextColored(this.colorGrey, statusText);
+ ImGui.TextColored(ImGuiColors.DalamudGrey, statusText);
else
this.DrawPluginList(installed ? this.pluginListInstalled : this.pluginListAvailable, installed);
@@ -422,7 +422,7 @@ namespace Dalamud.Plugin
: ", download count unavailable";
if (pluginDefinition.RepoNumber != 0)
info += $", from custom plugin repository #{pluginDefinition.RepoNumber}";
- ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f), info);
+ ImGui.TextColored(ImGuiColors.DalamudGrey3, info);
if (!string.IsNullOrWhiteSpace(pluginDefinition.Description))
ImGui.TextWrapped(pluginDefinition.Description);
@@ -526,13 +526,13 @@ namespace Dalamud.Plugin
}
ImGui.SameLine();
- ImGui.TextColored(new Vector4(0.5f, 0.5f, 0.5f, 1.0f), $" v{installedPlugin.Definition.AssemblyVersion}");
+ ImGui.TextColored(ImGuiColors.DalamudGrey3, $" v{installedPlugin.Definition.AssemblyVersion}");
if (installedPlugin.IsRaw)
{
ImGui.SameLine();
ImGui.TextColored(
- new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
+ ImGuiColors.DalamudRed,
this.dalamud.PluginRepository.PluginMaster.Any(x => x.InternalName == installedPlugin.Definition.InternalName)
? " This plugin is available in one of your repos, please remove it from the devPlugins folder."
: " To disable this plugin, please remove it from the devPlugins folder.");
@@ -557,7 +557,7 @@ namespace Dalamud.Plugin
if (installed)
{
ImGui.TextColored(
- this.colorGrey,
+ ImGuiColors.DalamudGrey,
Loc.Localize(
"InstallerNoInstalled",
"No plugins are currently installed. You can install them from the Available Plugins tab."));
@@ -565,7 +565,7 @@ namespace Dalamud.Plugin
else
{
ImGui.TextColored(
- this.colorGrey,
+ ImGuiColors.DalamudGrey,
Loc.Localize(
"InstallerNoCompatible",
"No compatible plugins were found :( Please restart your game and try again."));
@@ -574,7 +574,7 @@ namespace Dalamud.Plugin
else if (!didAnyWithSearch)
{
ImGui.TextColored(
- new Vector4(0.7f, 0.7f, 0.7f, 1.0f),
+ ImGuiColors.DalamudGrey2,
Loc.Localize("InstallNoMatching", "No plugins were found matching your search."));
}
}