diff --git a/Structurizr.Core/View/ViewConfiguration.cs b/Structurizr.Core/View/ViewConfiguration.cs index 48a149a..5e9d0ec 100644 --- a/Structurizr.Core/View/ViewConfiguration.cs +++ b/Structurizr.Core/View/ViewConfiguration.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Runtime.Serialization; using Structurizr.Core.View; using Structurizr.Util; @@ -23,19 +24,29 @@ internal ViewConfiguration() [DataMember(Name = "styles", EmitDefaultValue = false)] public Styles Styles { get; internal set; } - private String _theme; + private string[] _themes; - [DataMember(Name = "theme", EmitDefaultValue = false)] public string Theme { - get { return _theme; } + get + { + if (_themes != null && _themes.Length > 0) + { + return _themes[0]; + } + else + { + return null; + } + } + set { if (value != null && value.Trim().Length > 0) { if (Url.IsUrl(value)) { - _theme = value.Trim(); + _themes = new string[]{ value.Trim() }; } else { throw new ArgumentException(value + " is not a valid URL."); @@ -44,6 +55,34 @@ public string Theme } } + [DataMember(Name = "themes", EmitDefaultValue = false)] + public string[] Themes + { + get { return _themes; } + set + { + List list = new List(); + if (value != null) + { + foreach (string theme in value) + { + if (value != null && theme.Trim().Length > 0) + { + if (Url.IsUrl(theme)) + { + list.Add(theme.Trim()); + } + else { + throw new ArgumentException(value + " is not a valid URL."); + } + } + } + } + + _themes = list.ToArray(); + } + } + [DataMember(Name = "branding", EmitDefaultValue = false)] public Branding Branding { get; internal set; } diff --git a/docs/changelog.md b/docs/changelog.md index 99d4276..bab2b37 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,6 +10,7 @@ - Components from any container can now be added to a component view. - Added the ability to customize the symbols used when rendering metadata. - Adds support for curved relationship routing. +- Adds support for multiple themes. ## 0.9.6 (29th February 2020)