Skip to content
Merged
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
1 change: 1 addition & 0 deletions Questionable/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ internal sealed class GeneralConfiguration
public Job GatheringJob { get; set; } = Job.MIN;
public EGearsetUpdateSource GearsetUpdateSource { get; set; } = EGearsetUpdateSource.Vanilla;
public bool HideInAllInstances { get; set; } = true;
public bool UseQuestionableTheme { get; set; } = true;
public bool UseEscToCancelQuesting { get; set; } = true;
public bool ShowIncompleteSeasonalEvents { get; set; } = true;
public bool SkipLowPriorityDuties { get; set; }
Expand Down
1 change: 1 addition & 0 deletions Questionable/QuestionablePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public QuestionablePlugin(IDalamudPluginInterface pluginInterface,

serviceCollection.AddSingleton(configuration);
Questionable.Utils.LocalizeShortcut.Initialize(configuration);
Windows.Common.Ui.QstTheme.Initialize(configuration);

AddBasicFunctionsAndData(serviceCollection);
AddTaskFactories(serviceCollection);
Expand Down
50 changes: 44 additions & 6 deletions Questionable/Windows/Common/Ui/QstTheme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,67 @@ namespace Questionable.Windows.Common.Ui;

internal static class QstTheme
{
private static Configuration? _configuration;

internal static void Initialize(Configuration configuration) => _configuration = configuration;

public static bool Enabled => _configuration?.General.UseQuestionableTheme ?? true;

public static readonly Vector4 Accent = Rgb(255, 148, 68);
public static readonly Vector4 AccentActive = Rgb(255, 167, 94);
public static readonly Vector4 Danger = Rgb(255, 81, 110);
public static readonly Vector4 Amber = Rgb(255, 176, 102);
public static readonly Vector4 Success = Rgb(126, 212, 145);
public static readonly Vector4 Info = Rgb(111, 174, 230);
public static readonly Vector4 Special = Rgb(181, 144, 232);
public static readonly Vector4 Text = Rgb(224, 224, 224);
public static readonly Vector4 TextMuted = Rgb(156, 163, 175);

private static readonly Vector4 ThemeText = Rgb(224, 224, 224);
private static readonly Vector4 ThemeTextMuted = Rgb(156, 163, 175);
private static readonly Vector4 ThemeInputBg = Rgb(19, 19, 19);
private static readonly Vector4 ThemeEdge = Rgb(64, 64, 64);

public static Vector4 Text => Enabled ? ThemeText : StyleColor(ImGuiCol.Text, ThemeText);

public static Vector4 TextMuted => Enabled ? ThemeTextMuted : StyleColor(ImGuiCol.TextDisabled, ThemeTextMuted);

public static Vector4 InputBg => Enabled ? ThemeInputBg : StyleColor(ImGuiCol.FrameBg, ThemeInputBg);

public static Vector4 Edge
{
get
{
if (Enabled)
return ThemeEdge;

Vector4 separator = StyleColor(ImGuiCol.Separator, ThemeEdge);
if (separator.W < 0.05f)
return WithAlpha(StyleColor(ImGuiCol.Text, ThemeText), 0.25f);
return separator;
}
}

public static readonly Vector4 TextFaint = Rgb(117, 123, 134);

public static readonly Vector4 PanelBg = Rgba(21, 21, 21, 0.96f);
public static readonly Vector4 PanelDark = Rgb(14, 14, 14);
public static readonly Vector4 InputBg = Rgb(19, 19, 19);
public static readonly Vector4 Raised = Rgb(56, 56, 56);
public static readonly Vector4 RaisedHovered = Rgb(72, 72, 72);
public static readonly Vector4 RaisedActive = Rgb(88, 88, 88);
public static readonly Vector4 Edge = Rgb(64, 64, 64);

public static Vector4 WithAlpha(Vector4 color, float alpha) => color with { W = alpha };

public static uint ToU32(Vector4 color) => ImGui.ColorConvertFloat4ToU32(color);

public static WindowStyleScope PushWindowStyle() => new();
public static WindowStyleScope? PushWindowStyle() => Enabled ? new() : null;

private static Vector4 StyleColor(ImGuiCol color, Vector4 fallback)
{
unsafe
{
Vector4* ptr = ImGui.GetStyleColorVec4(color);
return ptr != null ? *ptr : fallback;
}
}

internal sealed class WindowStyleScope : IDisposable
{
Expand Down Expand Up @@ -80,7 +117,8 @@ internal WindowStyleScope()
.Push(ImGuiStyleVar.WindowBorderSize, 1f)
.Push(ImGuiStyleVar.WindowPadding, new Vector2(10, 9))
.Push(ImGuiStyleVar.FramePadding, new Vector2(6, 4))
.Push(ImGuiStyleVar.ItemSpacing, new Vector2(7, 5));
.Push(ImGuiStyleVar.ItemSpacing, new Vector2(7, 5))
.Push(ImGuiStyleVar.CellPadding, new Vector2(4, 4));
}

public void Dispose()
Expand Down
15 changes: 15 additions & 0 deletions Questionable/Windows/ConfigComponents/GeneralConfigComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,21 @@ public override void DrawTab()
{
using (ImRaii.PushIndent())
{
bool useQuestionableTheme = Configuration.General.UseQuestionableTheme;
if (ImGui.Checkbox(_L("Use Questionable theme"), ref useQuestionableTheme))
{
Configuration.General.UseQuestionableTheme = useQuestionableTheme;
Save();
}

if (ImGui.IsItemHovered())
{
using (ImRaii.Tooltip())
{
ImGui.Text(_L("When disabled, Questionable's windows use your Dalamud style/theme instead."));
}
}

bool hideInAllInstances = Configuration.General.HideInAllInstances;
if (ImGui.Checkbox(_L("Hide quest window in all instanced duties"), ref hideInAllInstances))
{
Expand Down
Loading