Skip to content

Commit 0694967

Browse files
Copilotjongalloway
andauthored
Clarify ResolveEffectivePalette XML docs: desiredCount contract and exceptions
Agent-Logs-Url: https://github.com/jongalloway/DiagramForge/sessions/0bc8aea5-ed48-4f4c-963a-7b5bd06c180e Co-authored-by: jongalloway <68539+jongalloway@users.noreply.github.com>
1 parent 3fdae25 commit 0694967

1 file changed

Lines changed: 37 additions & 2 deletions

File tree

src/DiagramForge/Models/ThemePaletteResolver.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,45 @@ public static IReadOnlyList<string> ResolveEffectivePalette(Theme theme) =>
4646
ResolveEffectivePalette(theme, DefaultPaletteSize);
4747

4848
/// <summary>
49-
/// Returns a chromatic palette sized for the caller's repeated-element needs.
49+
/// Returns a palette suitable for direct node-fill use, regardless of whether
50+
/// the theme's <see cref="Theme.NodePalette"/> is chromatic.
5051
/// </summary>
52+
/// <remarks>
53+
/// <para>
54+
/// If <see cref="Theme.NodePalette"/> is non-empty and
55+
/// <see cref="ColorUtils.IsPaletteMonochrome"/> returns <see langword="false"/>,
56+
/// the existing palette is returned unchanged — <paramref name="desiredCount"/>
57+
/// does <em>not</em> resize or pad a chromatic palette.
58+
/// </para>
59+
/// <para>
60+
/// <paramref name="desiredCount"/> controls only the number of entries produced
61+
/// when a fallback palette must be synthesized (i.e., when the theme's
62+
/// <see cref="Theme.NodePalette"/> is absent, monochrome, or matches the background):
63+
/// <list type="number">
64+
/// <item>
65+
/// If <see cref="Theme.UseBorderGradients"/> is <see langword="true"/> and
66+
/// <see cref="Theme.BorderGradientStops"/> contains more than one stop, the stops
67+
/// are linearly interpolated to produce <paramref name="desiredCount"/> entries.
68+
/// </item>
69+
/// <item>
70+
/// Otherwise, <paramref name="desiredCount"/> hue-rotated colors are derived from
71+
/// <see cref="Theme.AccentColor"/> and <see cref="Theme.SecondaryColor"/>.
72+
/// </item>
73+
/// </list>
74+
/// </para>
75+
/// <para>This is a pure function of the <see cref="Theme"/> — no side effects.</para>
76+
/// </remarks>
5177
/// <param name="theme">Source theme.</param>
52-
/// <param name="desiredCount">Number of entries to produce for fallback palettes.</param>
78+
/// <param name="desiredCount">
79+
/// Minimum number of entries to generate when a fallback palette is synthesized.
80+
/// Has no effect when the theme's <see cref="Theme.NodePalette"/> is already chromatic.
81+
/// Must be at least 1.
82+
/// </param>
83+
/// <returns>
84+
/// A <see cref="IReadOnlyList{T}"/> of hex color strings suitable for node fills.
85+
/// </returns>
86+
/// <exception cref="ArgumentNullException"><paramref name="theme"/> is <see langword="null"/>.</exception>
87+
/// <exception cref="ArgumentOutOfRangeException"><paramref name="desiredCount"/> is less than 1.</exception>
5388
public static IReadOnlyList<string> ResolveEffectivePalette(Theme theme, int desiredCount)
5489
{
5590
ArgumentNullException.ThrowIfNull(theme);

0 commit comments

Comments
 (0)