| | | 1 | | namespace Allyaria.Theming.Helpers; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Provides the core logic for constructing Allyaria themes by combining colors, typography, and layout rules into a |
| | | 5 | | /// complete <see cref="Theme" />. |
| | | 6 | | /// </summary> |
| | | 7 | | /// <remarks> |
| | | 8 | | /// <para> |
| | | 9 | | /// The <see cref="ThemeBuilder" /> orchestrates creation of default themes for light, dark, and high-contrast modes |
| | | 10 | | /// applying a series of <see cref="ThemeApplierBase" />-derived builders. |
| | | 11 | | /// </para> |
| | | 12 | | /// <para> |
| | | 13 | | /// It supports programmatic customization through <see cref="Set(ThemeUpdater)" /> and can optionally accept a |
| | | 14 | | /// <see cref="Brand" /> definition to influence default colors and fonts. |
| | | 15 | | /// </para> |
| | | 16 | | /// </remarks> |
| | | 17 | | internal sealed class ThemeBuilder |
| | | 18 | | { |
| | | 19 | | /// <summary>Indicates whether the builder has completed an initialization pass.</summary> |
| | | 20 | | private bool _isReady; |
| | | 21 | | |
| | | 22 | | /// <summary>Provides color, font, and palette mappings for the current theme context.</summary> |
| | 16 | 23 | | private ThemeMapper _mapper = new(); |
| | | 24 | | |
| | | 25 | | /// <summary>The underlying <see cref="Theme" /> being composed.</summary> |
| | 16 | 26 | | private Theme _theme = new(); |
| | | 27 | | |
| | | 28 | | /// <summary>Applies all <see cref="ThemeUpdater" /> entries from the specified applier to the current theme.</summa |
| | | 29 | | /// <param name="applier">A <see cref="ThemeApplierBase" /> instance providing theme updates.</param> |
| | | 30 | | private void ApplyTheme(ThemeApplierBase applier) |
| | | 31 | | { |
| | 12032 | 32 | | foreach (var updater in applier) |
| | | 33 | | { |
| | 5616 | 34 | | _theme.Set(updater: updater); |
| | | 35 | | } |
| | 400 | 36 | | } |
| | | 37 | | |
| | | 38 | | /// <summary>Finalizes and returns the built <see cref="Theme" />, resetting the builder for reuse.</summary> |
| | | 39 | | /// <returns>A completed <see cref="Theme" /> instance representing the composed theme.</returns> |
| | | 40 | | public Theme Build() |
| | | 41 | | { |
| | 8 | 42 | | if (!_isReady) |
| | | 43 | | { |
| | 2 | 44 | | Create(); |
| | | 45 | | } |
| | | 46 | | |
| | 8 | 47 | | var theme = _theme; |
| | | 48 | | |
| | 8 | 49 | | _mapper = new ThemeMapper(); |
| | 8 | 50 | | _theme = new Theme(); |
| | 8 | 51 | | _isReady = false; |
| | | 52 | | |
| | 8 | 53 | | return theme; |
| | | 54 | | } |
| | | 55 | | |
| | | 56 | | /// <summary>Initializes a new base theme structure using the provided <see cref="Brand" /> configuration.</summary> |
| | | 57 | | /// <param name="brand"> |
| | | 58 | | /// An optional <see cref="Brand" /> instance providing color and font defaults. If omitted, system defaults are use |
| | | 59 | | /// </param> |
| | | 60 | | /// <returns>The current <see cref="ThemeBuilder" /> instance for fluent configuration.</returns> |
| | | 61 | | public ThemeBuilder Create(Brand? brand = null) |
| | | 62 | | { |
| | 8 | 63 | | _mapper = new ThemeMapper(brand: brand); |
| | 8 | 64 | | _theme = new Theme(); |
| | | 65 | | |
| | 48 | 66 | | for (var contrast = 0; contrast < 2; contrast++) |
| | | 67 | | { |
| | 16 | 68 | | var isHighContrast = contrast is 1; |
| | | 69 | | |
| | 16 | 70 | | CreateGlobalBody(isHighContrast: isHighContrast); |
| | 16 | 71 | | CreateGlobalFocus(isHighContrast: isHighContrast); |
| | 16 | 72 | | CreateGlobalHtml(isHighContrast: isHighContrast); |
| | | 73 | | |
| | 16 | 74 | | CreateHeading1(isHighContrast: isHighContrast); |
| | 16 | 75 | | CreateHeading2(isHighContrast: isHighContrast); |
| | 16 | 76 | | CreateHeading3(isHighContrast: isHighContrast); |
| | 16 | 77 | | CreateHeading4(isHighContrast: isHighContrast); |
| | 16 | 78 | | CreateHeading5(isHighContrast: isHighContrast); |
| | 16 | 79 | | CreateHeading6(isHighContrast: isHighContrast); |
| | | 80 | | |
| | 16 | 81 | | CreateLink(isHighContrast: isHighContrast); |
| | 16 | 82 | | CreateSurface(isHighContrast: isHighContrast); |
| | 16 | 83 | | CreateText(isHighContrast: isHighContrast); |
| | | 84 | | } |
| | | 85 | | |
| | 8 | 86 | | _isReady = true; |
| | | 87 | | |
| | 8 | 88 | | return this; |
| | | 89 | | } |
| | | 90 | | |
| | | 91 | | /// <summary>Configures base body styles such as colors, fonts, layout, and overflow behavior.</summary> |
| | | 92 | | /// <param name="isHighContrast">Indicates whether high-contrast adjustments are applied.</param> |
| | | 93 | | private void CreateGlobalBody(bool isHighContrast) |
| | | 94 | | { |
| | 16 | 95 | | ApplyTheme( |
| | 16 | 96 | | applier: new ThemeColorApplier( |
| | 16 | 97 | | themeMapper: _mapper, |
| | 16 | 98 | | isHighContrast: isHighContrast, |
| | 16 | 99 | | componentType: ComponentType.GlobalBody, |
| | 16 | 100 | | paletteType: PaletteType.Surface, |
| | 16 | 101 | | isVariant: false, |
| | 16 | 102 | | hasBackground: true, |
| | 16 | 103 | | isOutline: false |
| | 16 | 104 | | ) |
| | 16 | 105 | | ); |
| | | 106 | | |
| | 16 | 107 | | ApplyTheme( |
| | 16 | 108 | | applier: new ThemeFontApplier( |
| | 16 | 109 | | themeMapper: _mapper, |
| | 16 | 110 | | isHighContrast: isHighContrast, |
| | 16 | 111 | | componentType: ComponentType.GlobalBody, |
| | 16 | 112 | | fontFace: FontFaceType.SansSerif, |
| | 16 | 113 | | fontSize: Sizing.Relative, |
| | 16 | 114 | | lineHeight: "1.5" |
| | 16 | 115 | | ) |
| | 16 | 116 | | ); |
| | | 117 | | |
| | 16 | 118 | | ApplyTheme( |
| | 16 | 119 | | applier: new ThemeApplier( |
| | 16 | 120 | | themeMapper: _mapper, |
| | 16 | 121 | | isHighContrast: isHighContrast, |
| | 16 | 122 | | componentType: ComponentType.GlobalBody, |
| | 16 | 123 | | styleType: StyleType.Margin, |
| | 16 | 124 | | value: new StyleLength(value: Sizing.Size0) |
| | 16 | 125 | | ) |
| | 16 | 126 | | ); |
| | | 127 | | |
| | 16 | 128 | | ApplyTheme( |
| | 16 | 129 | | applier: new ThemeApplier( |
| | 16 | 130 | | themeMapper: _mapper, |
| | 16 | 131 | | isHighContrast: isHighContrast, |
| | 16 | 132 | | componentType: ComponentType.GlobalBody, |
| | 16 | 133 | | styleType: StyleType.Padding, |
| | 16 | 134 | | value: new StyleLength(value: Sizing.Size0) |
| | 16 | 135 | | ) |
| | 16 | 136 | | ); |
| | | 137 | | |
| | 16 | 138 | | ApplyTheme( |
| | 16 | 139 | | applier: new ThemeApplier( |
| | 16 | 140 | | themeMapper: _mapper, |
| | 16 | 141 | | isHighContrast: isHighContrast, |
| | 16 | 142 | | componentType: ComponentType.GlobalBody, |
| | 16 | 143 | | styleType: StyleType.MinHeight, |
| | 16 | 144 | | value: new StyleLength(value: Sizing.Full) |
| | 16 | 145 | | ) |
| | 16 | 146 | | ); |
| | | 147 | | |
| | 16 | 148 | | ApplyTheme( |
| | 16 | 149 | | applier: new ThemeApplier( |
| | 16 | 150 | | themeMapper: _mapper, |
| | 16 | 151 | | isHighContrast: isHighContrast, |
| | 16 | 152 | | componentType: ComponentType.GlobalBody, |
| | 16 | 153 | | styleType: StyleType.OverflowBlock, |
| | 16 | 154 | | value: new StyleOverflow(kind: StyleOverflow.Kind.Clip) |
| | 16 | 155 | | ) |
| | 16 | 156 | | ); |
| | 16 | 157 | | } |
| | | 158 | | |
| | | 159 | | /// <summary>Configures global focus outline behavior.</summary> |
| | | 160 | | /// <param name="isHighContrast">Indicates whether high-contrast adjustments are applied.</param> |
| | | 161 | | private void CreateGlobalFocus(bool isHighContrast) |
| | 16 | 162 | | => ApplyTheme( |
| | 16 | 163 | | applier: new ThemeOutlineApplier( |
| | 16 | 164 | | themeMapper: _mapper, |
| | 16 | 165 | | isHighContrast: isHighContrast, |
| | 16 | 166 | | componentType: ComponentType.GlobalFocus, |
| | 16 | 167 | | paletteType: PaletteType.Surface |
| | 16 | 168 | | ) |
| | 16 | 169 | | ); |
| | | 170 | | |
| | | 171 | | /// <summary>Configures root HTML-level styles including sizing, box model, and scrolling behavior.</summary> |
| | | 172 | | /// <param name="isHighContrast">Indicates whether high-contrast adjustments are applied.</param> |
| | | 173 | | private void CreateGlobalHtml(bool isHighContrast) |
| | | 174 | | { |
| | 16 | 175 | | ApplyTheme( |
| | 16 | 176 | | applier: new ThemeFontApplier( |
| | 16 | 177 | | themeMapper: _mapper, |
| | 16 | 178 | | isHighContrast: isHighContrast, |
| | 16 | 179 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 180 | | fontSize: Sizing.Size3, |
| | 16 | 181 | | lineHeight: "1.5" |
| | 16 | 182 | | ) |
| | 16 | 183 | | ); |
| | | 184 | | |
| | 16 | 185 | | ApplyTheme( |
| | 16 | 186 | | applier: new ThemeApplier( |
| | 16 | 187 | | themeMapper: _mapper, |
| | 16 | 188 | | isHighContrast: isHighContrast, |
| | 16 | 189 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 190 | | styleType: StyleType.Margin, |
| | 16 | 191 | | value: new StyleLength(value: Sizing.Size0) |
| | 16 | 192 | | ) |
| | 16 | 193 | | ); |
| | | 194 | | |
| | 16 | 195 | | ApplyTheme( |
| | 16 | 196 | | applier: new ThemeApplier( |
| | 16 | 197 | | themeMapper: _mapper, |
| | 16 | 198 | | isHighContrast: isHighContrast, |
| | 16 | 199 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 200 | | styleType: StyleType.Padding, |
| | 16 | 201 | | value: new StyleLength(value: Sizing.Size0) |
| | 16 | 202 | | ) |
| | 16 | 203 | | ); |
| | | 204 | | |
| | 16 | 205 | | ApplyTheme( |
| | 16 | 206 | | applier: new ThemeApplier( |
| | 16 | 207 | | themeMapper: _mapper, |
| | 16 | 208 | | isHighContrast: isHighContrast, |
| | 16 | 209 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 210 | | styleType: StyleType.BoxSizing, |
| | 16 | 211 | | value: new StyleBoxSizing(kind: StyleBoxSizing.Kind.BorderBox) |
| | 16 | 212 | | ) |
| | 16 | 213 | | ); |
| | | 214 | | |
| | 16 | 215 | | ApplyTheme( |
| | 16 | 216 | | applier: new ThemeApplier( |
| | 16 | 217 | | themeMapper: _mapper, |
| | 16 | 218 | | isHighContrast: isHighContrast, |
| | 16 | 219 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 220 | | styleType: StyleType.MinHeight, |
| | 16 | 221 | | value: new StyleLength(value: Sizing.Full) |
| | 16 | 222 | | ) |
| | 16 | 223 | | ); |
| | | 224 | | |
| | 16 | 225 | | ApplyTheme( |
| | 16 | 226 | | applier: new ThemeApplier( |
| | 16 | 227 | | themeMapper: _mapper, |
| | 16 | 228 | | isHighContrast: isHighContrast, |
| | 16 | 229 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 230 | | styleType: StyleType.ScrollBehavior, |
| | 16 | 231 | | value: new StyleScrollBehavior(kind: StyleScrollBehavior.Kind.Smooth) |
| | 16 | 232 | | ) |
| | 16 | 233 | | ); |
| | | 234 | | |
| | 16 | 235 | | ApplyTheme( |
| | 16 | 236 | | applier: new ThemeApplier( |
| | 16 | 237 | | themeMapper: _mapper, |
| | 16 | 238 | | isHighContrast: isHighContrast, |
| | 16 | 239 | | componentType: ComponentType.GlobalHtml, |
| | 16 | 240 | | styleType: StyleType.TextSizeAdjust, |
| | 16 | 241 | | value: new StyleLength(value: Sizing.Full) |
| | 16 | 242 | | ) |
| | 16 | 243 | | ); |
| | 16 | 244 | | } |
| | | 245 | | |
| | | 246 | | /// <summary>Creates typographic rules for <h1> headings.</summary> |
| | | 247 | | private void CreateHeading1(bool isHighContrast) |
| | 16 | 248 | | => ApplyTheme( |
| | 16 | 249 | | applier: new ThemeFontApplier( |
| | 16 | 250 | | themeMapper: _mapper, |
| | 16 | 251 | | isHighContrast: isHighContrast, |
| | 16 | 252 | | componentType: ComponentType.Heading1, |
| | 16 | 253 | | fontSize: Sizing.RelativeLarge4, |
| | 16 | 254 | | fontWeight: StyleFontWeight.Kind.Weight700, |
| | 16 | 255 | | lineHeight: "1.2", |
| | 16 | 256 | | marginBottom: Sizing.RelativeLarge1 |
| | 16 | 257 | | ) |
| | 16 | 258 | | ); |
| | | 259 | | |
| | | 260 | | /// <summary>Creates typographic rules for <h2> headings.</summary> |
| | | 261 | | private void CreateHeading2(bool isHighContrast) |
| | 16 | 262 | | => ApplyTheme( |
| | 16 | 263 | | applier: new ThemeFontApplier( |
| | 16 | 264 | | themeMapper: _mapper, |
| | 16 | 265 | | isHighContrast: isHighContrast, |
| | 16 | 266 | | componentType: ComponentType.Heading2, |
| | 16 | 267 | | fontSize: Sizing.RelativeLarge3, |
| | 16 | 268 | | fontWeight: StyleFontWeight.Kind.Weight700, |
| | 16 | 269 | | lineHeight: "1.25", |
| | 16 | 270 | | marginBottom: Sizing.Relative |
| | 16 | 271 | | ) |
| | 16 | 272 | | ); |
| | | 273 | | |
| | | 274 | | /// <summary>Creates typographic rules for <h3> headings.</summary> |
| | | 275 | | private void CreateHeading3(bool isHighContrast) |
| | 16 | 276 | | => ApplyTheme( |
| | 16 | 277 | | applier: new ThemeFontApplier( |
| | 16 | 278 | | themeMapper: _mapper, |
| | 16 | 279 | | isHighContrast: isHighContrast, |
| | 16 | 280 | | componentType: ComponentType.Heading3, |
| | 16 | 281 | | fontSize: Sizing.RelativeLarge2, |
| | 16 | 282 | | fontWeight: StyleFontWeight.Kind.Weight600, |
| | 16 | 283 | | lineHeight: "1.3", |
| | 16 | 284 | | marginBottom: Sizing.RelativeSmall2 |
| | 16 | 285 | | ) |
| | 16 | 286 | | ); |
| | | 287 | | |
| | | 288 | | /// <summary>Creates typographic rules for <h4> headings.</summary> |
| | | 289 | | private void CreateHeading4(bool isHighContrast) |
| | 16 | 290 | | => ApplyTheme( |
| | 16 | 291 | | applier: new ThemeFontApplier( |
| | 16 | 292 | | themeMapper: _mapper, |
| | 16 | 293 | | isHighContrast: isHighContrast, |
| | 16 | 294 | | componentType: ComponentType.Heading4, |
| | 16 | 295 | | fontSize: Sizing.RelativeLarge1, |
| | 16 | 296 | | fontWeight: StyleFontWeight.Kind.Weight600, |
| | 16 | 297 | | lineHeight: "1.4", |
| | 16 | 298 | | marginBottom: Sizing.RelativeSmall3 |
| | 16 | 299 | | ) |
| | 16 | 300 | | ); |
| | | 301 | | |
| | | 302 | | /// <summary>Creates typographic rules for <h5> headings.</summary> |
| | | 303 | | private void CreateHeading5(bool isHighContrast) |
| | 16 | 304 | | => ApplyTheme( |
| | 16 | 305 | | applier: new ThemeFontApplier( |
| | 16 | 306 | | themeMapper: _mapper, |
| | 16 | 307 | | isHighContrast: isHighContrast, |
| | 16 | 308 | | componentType: ComponentType.Heading5, |
| | 16 | 309 | | fontSize: Sizing.Relative, |
| | 16 | 310 | | fontWeight: StyleFontWeight.Kind.Weight600, |
| | 16 | 311 | | lineHeight: "1.5", |
| | 16 | 312 | | marginBottom: Sizing.RelativeSmall4 |
| | 16 | 313 | | ) |
| | 16 | 314 | | ); |
| | | 315 | | |
| | | 316 | | /// <summary>Creates typographic rules for <h6> headings.</summary> |
| | | 317 | | private void CreateHeading6(bool isHighContrast) |
| | 16 | 318 | | => ApplyTheme( |
| | 16 | 319 | | applier: new ThemeFontApplier( |
| | 16 | 320 | | themeMapper: _mapper, |
| | 16 | 321 | | isHighContrast: isHighContrast, |
| | 16 | 322 | | componentType: ComponentType.Heading6, |
| | 16 | 323 | | fontSize: Sizing.RelativeSmall1, |
| | 16 | 324 | | fontWeight: StyleFontWeight.Kind.Weight500, |
| | 16 | 325 | | lineHeight: "1.5", |
| | 16 | 326 | | marginBottom: Sizing.RelativeSmall4 |
| | 16 | 327 | | ) |
| | 16 | 328 | | ); |
| | | 329 | | |
| | | 330 | | /// <summary>Creates link styles, including color, text decoration, and thickness.</summary> |
| | | 331 | | private void CreateLink(bool isHighContrast) |
| | 16 | 332 | | => ApplyTheme( |
| | 16 | 333 | | applier: new ThemeFontApplier( |
| | 16 | 334 | | themeMapper: _mapper, |
| | 16 | 335 | | isHighContrast: isHighContrast, |
| | 16 | 336 | | componentType: ComponentType.Link, |
| | 16 | 337 | | paletteType: PaletteType.Primary, |
| | 16 | 338 | | textDecorationLine: StyleTextDecorationLine.Kind.Underline, |
| | 16 | 339 | | textDecorationStyle: StyleTextDecorationStyle.Kind.Solid, |
| | 16 | 340 | | textDecorationThickness: Sizing.Thin |
| | 16 | 341 | | ) |
| | 16 | 342 | | ); |
| | | 343 | | |
| | | 344 | | /// <summary>Configures background and spacing for surface containers.</summary> |
| | | 345 | | private void CreateSurface(bool isHighContrast) |
| | | 346 | | { |
| | 16 | 347 | | ApplyTheme( |
| | 16 | 348 | | applier: new ThemeColorApplier( |
| | 16 | 349 | | themeMapper: _mapper, |
| | 16 | 350 | | isHighContrast: isHighContrast, |
| | 16 | 351 | | componentType: ComponentType.Surface, |
| | 16 | 352 | | paletteType: PaletteType.Elevation1, |
| | 16 | 353 | | isVariant: false, |
| | 16 | 354 | | hasBackground: true, |
| | 16 | 355 | | isOutline: false |
| | 16 | 356 | | ) |
| | 16 | 357 | | ); |
| | | 358 | | |
| | 16 | 359 | | ApplyTheme( |
| | 16 | 360 | | applier: new ThemeApplier( |
| | 16 | 361 | | themeMapper: _mapper, |
| | 16 | 362 | | isHighContrast: isHighContrast, |
| | 16 | 363 | | componentType: ComponentType.Surface, |
| | 16 | 364 | | styleType: StyleType.Margin, |
| | 16 | 365 | | value: new StyleLength(value: Sizing.Size2) |
| | 16 | 366 | | ) |
| | 16 | 367 | | ); |
| | | 368 | | |
| | 16 | 369 | | ApplyTheme( |
| | 16 | 370 | | applier: new ThemeApplier( |
| | 16 | 371 | | themeMapper: _mapper, |
| | 16 | 372 | | isHighContrast: isHighContrast, |
| | 16 | 373 | | componentType: ComponentType.Surface, |
| | 16 | 374 | | styleType: StyleType.Padding, |
| | 16 | 375 | | value: new StyleLength(value: Sizing.Size3) |
| | 16 | 376 | | ) |
| | 16 | 377 | | ); |
| | 16 | 378 | | } |
| | | 379 | | |
| | | 380 | | /// <summary>Creates typography settings for general text content.</summary> |
| | | 381 | | private void CreateText(bool isHighContrast) |
| | 16 | 382 | | => ApplyTheme( |
| | 16 | 383 | | applier: new ThemeFontApplier( |
| | 16 | 384 | | themeMapper: _mapper, |
| | 16 | 385 | | isHighContrast: isHighContrast, |
| | 16 | 386 | | componentType: ComponentType.Text, |
| | 16 | 387 | | fontSize: Sizing.Relative, |
| | 16 | 388 | | lineHeight: "1.5", |
| | 16 | 389 | | marginBottom: Sizing.Relative |
| | 16 | 390 | | ) |
| | 16 | 391 | | ); |
| | | 392 | | |
| | | 393 | | /// <summary>Applies a <see cref="ThemeUpdater" /> to modify an existing theme definition.</summary> |
| | | 394 | | /// <param name="updater">The <see cref="ThemeUpdater" /> containing the desired updates.</param> |
| | | 395 | | /// <returns>The same <see cref="ThemeBuilder" /> instance for fluent chaining.</returns> |
| | | 396 | | /// <exception cref="AryArgumentException"> |
| | | 397 | | /// Thrown when an invalid update is attempted, such as modifying system or high-contrast themes, or restricted comp |
| | | 398 | | /// states. |
| | | 399 | | /// </exception> |
| | | 400 | | public ThemeBuilder Set(ThemeUpdater updater) |
| | | 401 | | { |
| | 10 | 402 | | if (updater.Navigator.ThemeTypes.Contains(value: ThemeType.System)) |
| | | 403 | | { |
| | 1 | 404 | | throw new AryArgumentException( |
| | 1 | 405 | | message: "System theme cannot be set directly.", argName: nameof(updater.Value) |
| | 1 | 406 | | ); |
| | | 407 | | } |
| | | 408 | | |
| | 9 | 409 | | if (updater.Navigator.ComponentStates.Contains(value: ComponentState.Hidden) || |
| | 9 | 410 | | updater.Navigator.ComponentStates.Contains(value: ComponentState.ReadOnly)) |
| | | 411 | | { |
| | 2 | 412 | | throw new AryArgumentException( |
| | 2 | 413 | | message: "Hidden and read-only states cannot be set directly.", argName: nameof(updater.Value) |
| | 2 | 414 | | ); |
| | | 415 | | } |
| | | 416 | | |
| | 7 | 417 | | if (updater.Navigator.ThemeTypes.Contains(value: ThemeType.HighContrastDark) || |
| | 7 | 418 | | updater.Navigator.ThemeTypes.Contains(value: ThemeType.HighContrastLight)) |
| | | 419 | | { |
| | 2 | 420 | | throw new AryArgumentException( |
| | 2 | 421 | | message: "Cannot alter High Contrast themes.", argName: nameof(updater.Value) |
| | 2 | 422 | | ); |
| | | 423 | | } |
| | | 424 | | |
| | 5 | 425 | | if (updater.Navigator.ComponentStates.Contains(value: ComponentState.Focused) && |
| | 5 | 426 | | (updater.Navigator.StyleTypes.Contains(value: StyleType.OutlineOffset) || |
| | 5 | 427 | | updater.Navigator.StyleTypes.Contains(value: StyleType.OutlineStyle) || |
| | 5 | 428 | | updater.Navigator.StyleTypes.Contains(value: StyleType.OutlineWidth))) |
| | | 429 | | { |
| | 3 | 430 | | throw new AryArgumentException( |
| | 3 | 431 | | message: "Cannot change focused outline offset, style or width.", argName: nameof(updater.Value) |
| | 3 | 432 | | ); |
| | | 433 | | } |
| | | 434 | | |
| | 2 | 435 | | _theme = _theme.Set(updater: updater); |
| | | 436 | | |
| | 2 | 437 | | return this; |
| | | 438 | | } |
| | | 439 | | } |