Skip to content

Commit

Permalink
Adds support for multiple themes.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Jun 2, 2020
1 parent d7b0325 commit 5b2a3f0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
47 changes: 43 additions & 4 deletions Structurizr.Core/View/ViewConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Structurizr.Core.View;
using Structurizr.Util;
Expand All @@ -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.");
Expand All @@ -44,6 +55,34 @@ public string Theme
}
}

[DataMember(Name = "themes", EmitDefaultValue = false)]
public string[] Themes
{
get { return _themes; }
set
{
List<string> list = new List<string>();
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; }

Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 5b2a3f0

Please sign in to comment.