diff --git a/ChatTwo/Configuration.cs b/ChatTwo/Configuration.cs
index d8e0b92..726719c 100755
--- a/ChatTwo/Configuration.cs
+++ b/ChatTwo/Configuration.cs
@@ -68,6 +68,8 @@ public class Configuration : IPluginConfiguration
public bool NativeItemTooltips = true;
public bool PrettierTimestamps = true;
public bool MoreCompactPretty;
+ public bool CheckerboardRows;
+ public uint CheckerboardColor = 0xFFFFFF0A;
public bool HideSameTimestamps;
public bool ShowNoviceNetwork;
public bool SidebarTabView;
@@ -163,6 +165,8 @@ public void UpdateFrom(Configuration other, bool backToOriginal)
NativeItemTooltips = other.NativeItemTooltips;
PrettierTimestamps = other.PrettierTimestamps;
MoreCompactPretty = other.MoreCompactPretty;
+ CheckerboardRows = other.CheckerboardRows;
+ CheckerboardColor = other.CheckerboardColor;
HideSameTimestamps = other.HideSameTimestamps;
ShowNoviceNetwork = other.ShowNoviceNetwork;
SidebarTabView = other.SidebarTabView;
diff --git a/ChatTwo/Resources/Language.Designer.cs b/ChatTwo/Resources/Language.Designer.cs
index 06aab33..b3606ba 100755
--- a/ChatTwo/Resources/Language.Designer.cs
+++ b/ChatTwo/Resources/Language.Designer.cs
@@ -2184,6 +2184,33 @@ internal static string Options_ChatTabForwardKeybind_Name {
}
}
+ ///
+ /// Looks up a localized string similar to Alternate row colour.
+ ///
+ internal static string Options_CheckerboardRows_Color {
+ get {
+ return ResourceManager.GetString("Options_CheckerboardRows_Color", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Alternate the background colour of every other message to make rows easier to tell apart..
+ ///
+ internal static string Options_CheckerboardRows_Description {
+ get {
+ return ResourceManager.GetString("Options_CheckerboardRows_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Checkerboard rows.
+ ///
+ internal static string Options_CheckerboardRows_Name {
+ get {
+ return ResourceManager.GetString("Options_CheckerboardRows_Name", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Clear the message history database.
///
diff --git a/ChatTwo/Resources/Language.resx b/ChatTwo/Resources/Language.resx
index db02521..9b512a3 100644
--- a/ChatTwo/Resources/Language.resx
+++ b/ChatTwo/Resources/Language.resx
@@ -163,6 +163,15 @@
Reduce the spacing between messages.
+
+ Checkerboard rows
+
+
+ Alternate the background colour of every other message to make rows easier to tell apart.
+
+
+ Alternate row colour
+
Show Novice Network join button
diff --git a/ChatTwo/Ui/ChatLog/ChatLog.Window.cs b/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
index bda787e..7637534 100644
--- a/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
+++ b/ChatTwo/Ui/ChatLog/ChatLog.Window.cs
@@ -625,10 +625,17 @@ private void DrawLogTableStyle(Tab tab, PayloadHandler handler, bool switchedTab
var oldItemSpacing = ImGui.GetStyle().ItemSpacing;
var oldCellPadding = ImGui.GetStyle().CellPadding;
+ var checkerboard = Plugin.Config.CheckerboardRows;
+ var tableFlags = ImGuiTableFlags.PreciseWidths;
+ if (checkerboard)
+ tableFlags |= ImGuiTableFlags.RowBg;
+
+ using (ImRaii.PushColor(ImGuiCol.TableRowBg, Vector4.Zero, checkerboard))
+ using (ImRaii.PushColor(ImGuiCol.TableRowBgAlt, ColourUtil.RgbaToVector4(Plugin.Config.CheckerboardColor) ?? Vector4.Zero, checkerboard))
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
using (ImRaii.PushStyle(ImGuiStyleVar.CellPadding, oldCellPadding with { Y = 0 }, compact))
{
- using var table = ImRaii.Table("timestamp-table", 2, ImGuiTableFlags.PreciseWidths);
+ using var table = ImRaii.Table("timestamp-table", 2, tableFlags);
if (!table.Success)
return;
diff --git a/ChatTwo/Ui/SettingsTabs/Display.cs b/ChatTwo/Ui/SettingsTabs/Display.cs
index 79fc032..9e63cad 100755
--- a/ChatTwo/Ui/SettingsTabs/Display.cs
+++ b/ChatTwo/Ui/SettingsTabs/Display.cs
@@ -102,6 +102,13 @@ public void Draw(bool changed)
using var _ = ImRaii.PushIndent();
ImGuiUtil.OptionCheckbox(ref Mutable.MoreCompactPretty, Language.Options_MoreCompactPretty_Name, Language.Options_MoreCompactPretty_Description);
ImGuiUtil.OptionCheckbox(ref Mutable.HideSameTimestamps, Language.Options_HideSameTimestamps_Name, Language.Options_HideSameTimestamps_Description);
+ ImGuiUtil.OptionCheckbox(ref Mutable.CheckerboardRows, Language.Options_CheckerboardRows_Name, Language.Options_CheckerboardRows_Description);
+ if (Mutable.CheckerboardRows)
+ {
+ var checkerColour = ColourUtil.RgbaToVector4(Mutable.CheckerboardColor)!.Value;
+ if (ImGui.ColorEdit4(Language.Options_CheckerboardRows_Color, ref checkerColour, ImGuiColorEditFlags.NoInputs))
+ Mutable.CheckerboardColor = ColourUtil.Vector4ToRgba(checkerColour);
+ }
}
ImGui.Spacing();
diff --git a/ChatTwo/Util/ColourUtil.cs b/ChatTwo/Util/ColourUtil.cs
index 0dec863..f42744d 100755
--- a/ChatTwo/Util/ColourUtil.cs
+++ b/ChatTwo/Util/ColourUtil.cs
@@ -39,6 +39,14 @@ public static Vector3 RgbaToVector3(uint rgba)
public static uint Vector3ToRgba(Vector3 col)
=> ComponentsToRgba((byte)Math.Round(col.X * 255), (byte)Math.Round(col.Y * 255), (byte)Math.Round(col.Z * 255));
+ ///
+ /// Converts a Vector4 to an RGBA color value.
+ ///
+ /// The color
+ /// Color as byte representation RR GG BB AA
+ public static uint Vector4ToRgba(Vector4 col)
+ => ComponentsToRgba((byte)Math.Round(col.X * 255), (byte)Math.Round(col.Y * 255), (byte)Math.Round(col.Z * 255), (byte)Math.Round(col.W * 255));
+
///
/// Converts a Vector4 to an ABGR color value.
///