Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ChatTwo/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
27 changes: 27 additions & 0 deletions ChatTwo/Resources/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions ChatTwo/Resources/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@
<data name="Options_MoreCompactPretty_Description">
<value>Reduce the spacing between messages.</value>
</data>
<data name="Options_CheckerboardRows_Name">
<value>Checkerboard rows</value>
</data>
<data name="Options_CheckerboardRows_Description">
<value>Alternate the background colour of every other message to make rows easier to tell apart.</value>
</data>
<data name="Options_CheckerboardRows_Color">
<value>Alternate row colour</value>
</data>
<data name="Options_ShowNoviceNetwork_Name">
<value>Show Novice Network join button</value>
</data>
Expand Down
9 changes: 8 additions & 1 deletion ChatTwo/Ui/ChatLog/ChatLog.Window.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
7 changes: 7 additions & 0 deletions ChatTwo/Ui/SettingsTabs/Display.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
8 changes: 8 additions & 0 deletions ChatTwo/Util/ColourUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

/// <summary>
/// Converts a Vector4 to an RGBA color value.
/// </summary>
/// <param name="col">The color</param>
/// <returns>Color as byte representation RR GG BB AA</returns>
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));

/// <summary>
/// Converts a Vector4 to an ABGR color value.
/// </summary>
Expand Down