Skip to content

Commit

Permalink
Add more Insiders Flair (#221)
Browse files Browse the repository at this point in the history
* slight adjustments to user interface

+ remove `Backgrounds` namespace
+ use framework's `ScreenStack` and `Screen`
+ reorder namespacing
+ adjust settings tab
+ adjust home tab
- remove help tab

* prefer insiders colors

* add icon and prefer if building for insiders

* use same assembly name

* Disable Lint step for now

* fix broken tests

Co-authored-by: Ayane Satomi <chinodesuuu@gmail.com>
  • Loading branch information
LeNitrous and sr229 authored Jul 30, 2021
1 parent e485401 commit 2e28256
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 67 deletions.
33 changes: 18 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,24 @@ on:
- '**/*.sln'

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Lint
uses: github/super-linter@v3
env:
SUPPRESS_POSSUM: true
LINTER_RULES_PATH: /
VALIDATE_EDITORCONFIG: true
EDITORCONFIG_FILE_NAME: .editorconfig
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Disabled until the editorconfig bug can be fixed
# Reviewers will have to manually review indenting for now.
#
# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2#
#
# - name: Lint
# uses: github/super-linter@v3
# env:
# SUPPRESS_POSSUM: true
# LINTER_RULES_PATH: /
# VALIDATE_EDITORCONFIG: true
# EDITORCONFIG_FILE_NAME: .editorconfig
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

test:
name: Test
Expand Down
24 changes: 19 additions & 5 deletions Vignette.Desktop/Vignette.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,29 @@
<ProjectReference Include="..\Vignette.Game\Vignette.Game.csproj" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="vignette.ico" />
</ItemGroup>

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<OutputType>WinExe</OutputType>
<AssemblyName>Vignette</AssemblyName>
<ApplicationIcon>vignette.ico</ApplicationIcon>
</PropertyGroup>

<Choose>
<When Condition="!$(Version.Contains('insiders'))">
<PropertyGroup>
<ApplicationIcon>vignette.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="vignette.ico" />
</ItemGroup>
</When>
<When Condition="$(Version.Contains('insiders'))">
<PropertyGroup>
<ApplicationIcon>vignette-insiders.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="vignette-insiders.ico"/>
</ItemGroup>
</When>
</Choose>

</Project>
4 changes: 3 additions & 1 deletion Vignette.Desktop/VignetteGameDesktop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ public override void SetHost(GameHost host)

window.ConfineMouseMode.Value = ConfineMouseMode.Never;
window.Title = Name;
window.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "vignette.ico"));

string icon = IsInsidersBuild ? "vignette-insiders.ico" : "vignette.ico";
window.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), icon));

resizable = LocalConfig.GetBindable<bool>(VignetteSetting.WindowResizable);
resizable.BindValueChanged(e => window.Resizable = e.NewValue, true);
Expand Down
Binary file added Vignette.Desktop/vignette-insiders.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion Vignette.Game.Tests/Visual/ThemeProvidedTestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected class TestThemeSource : Container, IThemeSource
{
public event Action SourceChanged;

public readonly Bindable<Theme> Current = new Bindable<Theme>(Theme.Light);
public readonly Bindable<Theme> Current = new Bindable<Theme>(Theme.GetLightTheme(false));

public TestThemeSource()
{
Expand Down
6 changes: 3 additions & 3 deletions Vignette.Game.Tests/Visual/Themeing/TestSceneThemeing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class TestSceneThemeing : UserInterfaceTestScene
public void SetUp() => Schedule(() =>
{
Clear();
Selector.Current.Value = Theme.Light;
Selector.Current.Value = Theme.GetLightTheme(false);
});

[Test]
Expand All @@ -37,7 +37,7 @@ public void TestThemeSwitching()
}));

AddAssert("is colour white", () => themable.Target.Colour == Colour4.White);
AddStep("change theme", () => Selector.Current.Value = Theme.Dark);
AddStep("change theme", () => Selector.Current.Value = Theme.GetDarkTheme(false));
AddAssert("is colour black", () => themable.Target.Colour == Colour4.Black);
}

Expand All @@ -60,7 +60,7 @@ public void TestDrawableDetachment(bool expireTarget)
}));

AddAssert("is target white", () => target.Colour == Colour4.White);
AddStep("change theme", () => Selector.Current.Value = Theme.Dark);
AddStep("change theme", () => Selector.Current.Value = Theme.GetDarkTheme(false));
AddAssert("is target black", () => target.Colour == Colour4.Black);

string toExpire = expireTarget ? "target" : "themable";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public UserInterfaceTestScene()
Margin = new MarginPadding(20),
Items = new[]
{
Theme.Light,
Theme.Dark,
Theme.GetLightTheme(false),
Theme.GetDarkTheme(false),
}
}
});
Expand Down
91 changes: 58 additions & 33 deletions Vignette.Game/Themeing/Theme.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,38 +151,63 @@ private void addConstants()
.AddColour(ThemeSlot.AccentLighter, "f4e0f7")
.AddColour(ThemeSlot.AccentLighterAlt, "fcf7fd");

public static Theme Light = base_theme
.SetName("Light")
.AddColour(ThemeSlot.Black, "000000")
.AddColour(ThemeSlot.Gray190, "201f1e")
.AddColour(ThemeSlot.Gray160, "323130")
.AddColour(ThemeSlot.Gray150, "3b3a39")
.AddColour(ThemeSlot.Gray130, "605e5c")
.AddColour(ThemeSlot.Gray110, "8a8886")
.AddColour(ThemeSlot.Gray90, "a19f9d")
.AddColour(ThemeSlot.Gray60, "c8c6c4")
.AddColour(ThemeSlot.Gray50, "d2d0ce")
.AddColour(ThemeSlot.Gray40, "e1dfdd")
.AddColour(ThemeSlot.Gray30, "edebe9")
.AddColour(ThemeSlot.Gray20, "f3f2f1")
.AddColour(ThemeSlot.Gray10, "faf9f8")
.AddColour(ThemeSlot.White, "ffffff");

public static Theme Dark = base_theme
.SetName("Dark")
.AddColour(ThemeSlot.Black, "ffffff")
.AddColour(ThemeSlot.Gray190, "faf9f8")
.AddColour(ThemeSlot.Gray160, "f3f2f1")
.AddColour(ThemeSlot.Gray150, "edebe9")
.AddColour(ThemeSlot.Gray130, "e1dfdd")
.AddColour(ThemeSlot.Gray110, "d2d0ce")
.AddColour(ThemeSlot.Gray90, "c8c6c4")
.AddColour(ThemeSlot.Gray60, "a19f9d")
.AddColour(ThemeSlot.Gray50, "8a8886")
.AddColour(ThemeSlot.Gray40, "605e5c")
.AddColour(ThemeSlot.Gray30, "3b3a39")
.AddColour(ThemeSlot.Gray20, "323130")
.AddColour(ThemeSlot.Gray10, "201f1e")
.AddColour(ThemeSlot.White, "000000");
private static Theme base_theme_ins => new Theme()
.AddColour(ThemeSlot.AccentDarker, "31724b")
.AddColour(ThemeSlot.AccentDark, "439b66")
.AddColour(ThemeSlot.AccentDarkAlt, "4fb879")
.AddColour(ThemeSlot.AccentPrimary, "58CB86")
.AddColour(ThemeSlot.AccentSecondary, "69d293")
.AddColour(ThemeSlot.AccentTertiary, "94e0b2")
.AddColour(ThemeSlot.AccentLight, "c7f0d7")
.AddColour(ThemeSlot.AccentLighter, "e0f7e9")
.AddColour(ThemeSlot.AccentLighterAlt, "f7fdf9");

public static Theme GetLightTheme(bool useInsiderColor)
{
var theme = useInsiderColor ? base_theme_ins : base_theme;

theme
.SetName("Light")
.AddColour(ThemeSlot.Black, "000000")
.AddColour(ThemeSlot.Gray190, "201f1e")
.AddColour(ThemeSlot.Gray160, "323130")
.AddColour(ThemeSlot.Gray150, "3b3a39")
.AddColour(ThemeSlot.Gray130, "605e5c")
.AddColour(ThemeSlot.Gray110, "8a8886")
.AddColour(ThemeSlot.Gray90, "a19f9d")
.AddColour(ThemeSlot.Gray60, "c8c6c4")
.AddColour(ThemeSlot.Gray50, "d2d0ce")
.AddColour(ThemeSlot.Gray40, "e1dfdd")
.AddColour(ThemeSlot.Gray30, "edebe9")
.AddColour(ThemeSlot.Gray20, "f3f2f1")
.AddColour(ThemeSlot.Gray10, "faf9f8")
.AddColour(ThemeSlot.White, "ffffff");

return theme;
}

public static Theme GetDarkTheme(bool useInsiderColor)
{
var theme = useInsiderColor ? base_theme_ins : base_theme;

theme
.SetName("Dark")
.AddColour(ThemeSlot.Black, "ffffff")
.AddColour(ThemeSlot.Gray190, "faf9f8")
.AddColour(ThemeSlot.Gray160, "f3f2f1")
.AddColour(ThemeSlot.Gray150, "edebe9")
.AddColour(ThemeSlot.Gray130, "e1dfdd")
.AddColour(ThemeSlot.Gray110, "d2d0ce")
.AddColour(ThemeSlot.Gray90, "c8c6c4")
.AddColour(ThemeSlot.Gray60, "a19f9d")
.AddColour(ThemeSlot.Gray50, "8a8886")
.AddColour(ThemeSlot.Gray40, "605e5c")
.AddColour(ThemeSlot.Gray30, "3b3a39")
.AddColour(ThemeSlot.Gray20, "323130")
.AddColour(ThemeSlot.Gray10, "201f1e")
.AddColour(ThemeSlot.White, "000000");

return theme;
}
}
}
13 changes: 8 additions & 5 deletions Vignette.Game/Themeing/ThemeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Vignette.Game.Themeing
{
public class ThemeManager : IThemeSource
{
public readonly Bindable<Theme> Current = new Bindable<Theme>(Theme.Light);
public readonly Bindable<Theme> Current;

public readonly BindableList<Theme> UseableThemes = new BindableList<Theme>();

Expand All @@ -24,12 +24,15 @@ public class ThemeManager : IThemeSource

public event Action SourceChanged;

public ThemeManager(Scheduler scheduler, UserResources resources, VignetteConfigManager config)
public ThemeManager(Scheduler scheduler, UserResources resources, VignetteConfigManager config, bool useInsidersColours = false)
{
this.scheduler = scheduler;

UseableThemes.Add(Theme.Light);
UseableThemes.Add(Theme.Dark);
var lightTheme = Theme.GetLightTheme(useInsidersColours);
var darkTheme = Theme.GetDarkTheme(useInsidersColours);

Current = new Bindable<Theme>(lightTheme);
UseableThemes.AddRange(new[] { lightTheme, darkTheme });

store = resources.Themes;
store.FileCreated += onFileCreated;
Expand All @@ -45,7 +48,7 @@ public ThemeManager(Scheduler scheduler, UserResources resources, VignetteConfig
if (e.NewValue == Current.Value.Name)
return;
Current.Value = UseableThemes.FirstOrDefault(t => t.Name == e.NewValue) ?? Theme.Light;
Current.Value = UseableThemes.FirstOrDefault(t => t.Name == e.NewValue) ?? UseableThemes.FirstOrDefault();
SourceChanged?.Invoke();
}, true);
Expand Down
4 changes: 2 additions & 2 deletions Vignette.Game/VignetteGameBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020 - 2021 Vignette Project
// Copyright 2020 - 2021 Vignette Project
// Licensed under NPOSLv3. See LICENSE for details.

using System;
Expand Down Expand Up @@ -98,7 +98,7 @@ private void load()
UserResources = new UserResources(Host, Storage);
dependencies.CacheAs(UserResources);

var themeManager = new ThemeManager(Scheduler, UserResources, LocalConfig);
var themeManager = new ThemeManager(Scheduler, UserResources, LocalConfig, IsInsidersBuild);
dependencies.CacheAs(themeManager);
dependencies.CacheAs<IThemeSource>(themeManager);

Expand Down

0 comments on commit 2e28256

Please sign in to comment.