< Summary

Information
Class: Allyaria.Theming.Helpers.ThemeOutlineApplier
Assembly: Allyaria.Theming
File(s): /home/runner/work/allyaria/allyaria/src/Allyaria.Theming/Helpers/ThemeOutlineApplier.cs
Line coverage
100%
Covered lines: 21
Uncovered lines: 0
Coverable lines: 21
Total lines: 63
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor(...)100%11100%

File(s)

/home/runner/work/allyaria/allyaria/src/Allyaria.Theming/Helpers/ThemeOutlineApplier.cs

#LineLine coverage
 1namespace Allyaria.Theming.Helpers;
 2
 3/// <summary>
 4/// Applies outline-related styles for focusable or interactive components within the Allyaria theming system.
 5/// </summary>
 6/// <remarks>
 7///     <para>
 8///     The <see cref="ThemeOutlineApplier" /> constructs outline configurations — including color, style, width, and
 9///     offset — based on brand-defined palettes and accessibility rules.
 10///     </para>
 11///     <para>
 12///     It ensures that focus indicators meet accessibility contrast requirements and visual clarity standards, especial
 13///     in high-contrast or system accessibility modes.
 14///     </para>
 15///     <para>
 16///     Typically used within <see cref="ThemeBuilder" /> to define focus outlines for components like links, inputs, an
 17///     interactive surfaces.
 18///     </para>
 19/// </remarks>
 20internal sealed class ThemeOutlineApplier : ThemeApplierBase
 21{
 22    /// <summary>
 23    /// Initializes a new instance of the <see cref="ThemeOutlineApplier" /> class, creating a focus outline with color 
 24    /// style derived from the specified <see cref="PaletteType" />.
 25    /// </summary>
 26    /// <param name="themeMapper">The <see cref="ThemeMapper" /> instance used to retrieve brand color mappings.</param>
 27    /// <param name="isHighContrast">Specifies whether this applier should operate in high-contrast mode.</param>
 28    /// <param name="componentType">The <see cref="ComponentType" /> representing the component being styled.</param>
 29    /// <param name="paletteType">The <see cref="PaletteType" /> defining which color group to use for outlines.</param>
 30    public ThemeOutlineApplier(ThemeMapper themeMapper,
 31        bool isHighContrast,
 32        ComponentType componentType,
 33        PaletteType paletteType)
 1934        : base(themeMapper: themeMapper, isHighContrast: isHighContrast, componentType: componentType)
 35    {
 36        // Apply outline color mapping based on palette and theme variant.
 1937        AddRange(
 1938            collection: new ThemeColorApplier(
 1939                themeMapper: themeMapper,
 1940                isHighContrast: isHighContrast,
 1941                componentType: componentType,
 1942                paletteType: paletteType,
 1943                isVariant: true,
 1944                hasBackground: false,
 1945                isOutline: true
 1946            )
 1947        );
 48
 49        // Apply outline offset (distance between element and outline).
 1950        Add(item: CreateUpdater(styleType: StyleType.OutlineOffset, value: new StyleLength(value: Sizing.Size1)));
 51
 52        // Apply outline style (e.g., solid).
 1953        Add(
 1954            item: CreateUpdater(
 1955                styleType: StyleType.OutlineStyle,
 1956                value: new StyleBorderOutlineStyle(kind: StyleBorderOutlineStyle.Kind.Solid)
 1957            )
 1958        );
 59
 60        // Apply outline width (thickness of focus ring).
 1961        Add(item: CreateUpdater(styleType: StyleType.OutlineWidth, value: new StyleLength(value: Sizing.Thick)));
 1962    }
 63}