Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -340,3 +340,6 @@ appcast.*.xml
*.tar.gz
.vscode/
Microsoft.AI.DirectML

# VS Code extensions autogen
*.csproj.lscache
5 changes: 5 additions & 0 deletions OpenUtau/Colors/CustomTheme.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@
<Color x:Key="BlackKeyColorLeft">#FF71A3</Color>
<Color x:Key="BlackKeyColorRight">#FF347C</Color>
<Color x:Key="BlackKeyNameColor">#FFFFFF</Color>

<!--Easy Color Themes-->
<system:Boolean x:Key="IsDarkModeEasy">False</system:Boolean>
<Color x:Key="MainColorA">#4EA6EA</Color>
<Color x:Key="MainColorB">#FF347C</Color>
</ResourceDictionary>
7 changes: 6 additions & 1 deletion OpenUtau/Colors/CustomTheme.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public class ThemeYaml {

public string WhiteKeyColorLeft = "Transparent";
public string WhiteKeyColorRight = "Transparent";
public string WhiteKeyNameColor = "#FF347c";
public string WhiteKeyNameColor = "#FF347C";

public string CenterKeyColorLeft = "#FFDDE6";
public string CenterKeyColorRight = "#FFCEDC";
Expand All @@ -163,6 +163,11 @@ public class ThemeYaml {
public string BlackKeyColorLeft = "#FF71A3";
public string BlackKeyColorRight = "#FF347C";
public string BlackKeyNameColor = "#FFFFFF";

public string MainColorA = "#4EA6EA";
public string MainColorB = "#FF347C";
public bool IsDarkModeEasy = false;

}
}

2 changes: 1 addition & 1 deletion OpenUtau/Colors/LightTheme.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<!--Keyboard Background-->
<Color x:Key="WhiteKeyColorLeft">Transparent</Color>
<Color x:Key="WhiteKeyColorRight">Transparent</Color>
<Color x:Key="WhiteKeyNameColor">#FF347c</Color>
<Color x:Key="WhiteKeyNameColor">#FF347C</Color>

<Color x:Key="CenterKeyColorLeft">#FFDDE6</Color>
<Color x:Key="CenterKeyColorRight">#FFCEDC</Color>
Expand Down
41 changes: 41 additions & 0 deletions OpenUtau/Strings/Strings.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ Do you want to continue by splitting at the nearest position after current playh
<system:String x:Key="dialogs.transcribe.game.batchduration">Max Batch Duration (s)</system:String>
<system:String x:Key="dialogs.transcribe.longchunk.message">One or more audio segments are very long and may consume large amount of memory when transcribing. This usually happens when the audio contains accompaniment. Still proceed?</system:String>

<system:String x:Key="easythemeeditor.isdarkmode">Is Dark Mode</system:String>
<system:String x:Key="easythemeeditor.maincolora">Main Color A</system:String>
<system:String x:Key="easythemeeditor.maincolorb">Main Color B</system:String>
<system:String x:Key="easythemeeditor.switch">Switch to Accurate Mode</system:String>

<system:String x:Key="errors.caption">Error</system:String>
<system:String x:Key="errors.details">Error Details</system:String>
<system:String x:Key="errors.diffsinger.downloadvocoder">Error loading vocoder "{0}". Please download vocoder from {1}</system:String>
Expand Down Expand Up @@ -578,6 +583,7 @@ Warning: this option removes custom presets.</system:String>
<system:String x:Key="prefs.appearance.theme.dark">Dark</system:String>
<system:String x:Key="prefs.appearance.theme.light">Light</system:String>
<system:String x:Key="prefs.appearance.customtheme.edit.title">Edit Custom Theme</system:String>
<system:String x:Key="prefs.appearance.customtheme.easyedit.title">Edit Custom Theme Colorsets</system:String>
<system:String x:Key="prefs.appearance.customtheme.delete.title">Delete Custom Theme</system:String>
<system:String x:Key="prefs.appearance.customtheme.delete.message">Are you sure you want to delete this theme?</system:String>
<system:String x:Key="prefs.appearance.customtheme.create.title">Create Custom Theme</system:String>
Expand Down Expand Up @@ -744,7 +750,42 @@ The voicebank may not work on another OS.</system:String>
<system:String x:Key="singersetup.textfileencoding.prompt">Choose an encoding that make file contents look right.</system:String>
<system:String x:Key="singersetup.title">Singer Setup</system:String>

<system:String x:Key="themeeditor.accentcolora">Accent Color 1</system:String>
<system:String x:Key="themeeditor.accentcolorb">Accent Color 2</system:String>
<system:String x:Key="themeeditor.accentcolorc">Accent Color 3</system:String>
<system:String x:Key="themeeditor.backgroundcolor">Background Color</system:String>
<system:String x:Key="themeeditor.backgroundcolordisabled">Background Color Disabled</system:String>
<system:String x:Key="themeeditor.backgroundcolorpointerover">Background Color Pointer Over</system:String>
<system:String x:Key="themeeditor.backgroundcolorpressed">Background Color Pressed</system:String>
<system:String x:Key="themeeditor.barnumbercolor">Bar Number Color</system:String>
<system:String x:Key="themeeditor.blackkeycolorleft">Black Key Color Left</system:String>
<system:String x:Key="themeeditor.blackkeycolorright">Black Key Color Right</system:String>
<system:String x:Key="themeeditor.blackkeynamecolor">Black Key Name Color</system:String>
<system:String x:Key="themeeditor.bordercolor">Border Color</system:String>
<system:String x:Key="themeeditor.bordercolorpointerover">Border Color Pointer Over</system:String>
<system:String x:Key="themeeditor.cancel">Cancel</system:String>
<system:String x:Key="themeeditor.centerkeycolorleft">Center Key Color Left</system:String>
<system:String x:Key="themeeditor.centerkeycolorright">Center Key Color Right</system:String>
<system:String x:Key="themeeditor.centerkeynamecolor">Center Key Name Color</system:String>
<system:String x:Key="themeeditor.finalpitchcolor">Final Pitch Color</system:String>
<system:String x:Key="themeeditor.foregroundcolor">Foreground Color</system:String>
<system:String x:Key="themeeditor.foregroundcolordisabled">Foreground Color Disabled</system:String>
<system:String x:Key="themeeditor.foregroundcolorpointerover">Foreground Color Pointer Over</system:String>
<system:String x:Key="themeeditor.foregroundcolorpressed">Foreground Color Pressed</system:String>
<system:String x:Key="themeeditor.isdarkmode">Is Darkmode</system:String>
<system:String x:Key="themeeditor.neutralaccentcolor">Neutral Accent Color</system:String>
<system:String x:Key="themeeditor.neutralaccentcolorpointerover">Neutral Accent Color Pointer Over</system:String>
<system:String x:Key="themeeditor.save">Save</system:String>
<system:String x:Key="themeeditor.switch">Switch to Easy Modemer</system:String>
<system:String x:Key="themeeditor.systemaccentcolor">System Accent Color</system:String>
<system:String x:Key="themeeditor.systemaccentcolordark">System Accent Color Light</system:String>
<system:String x:Key="themeeditor.systemaccentcolorlight">System Accent Color Dark</system:String>
<system:String x:Key="themeeditor.trackbackgroundaltcolor">Track Background Alt Color</system:String>
<system:String x:Key="themeeditor.ticklinecolor">Tick Line Color</system:String>
<system:String x:Key="themeeditor.title">Theme Editor</system:String>
<system:String x:Key="themeeditor.whitekeycolorleft">White Key Color Left</system:String>
<system:String x:Key="themeeditor.whitekeycolorright">White Key Color Right</system:String>
<system:String x:Key="themeeditor.whitekeynamecolor">White Key Name Color</system:String>

<system:String x:Key="tip.aliasbox">Override Alias</system:String>
<system:String x:Key="tip.exps">Numerical,Options Type
Expand Down
140 changes: 138 additions & 2 deletions OpenUtau/ViewModels/ThemeEditorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
using System.IO;
using System.Text;
using Avalonia;
using Avalonia.Markup.Xaml.Templates;
using Avalonia.Media;
using Avalonia.Styling;
using OpenUtau.Colors;
using OpenUtau.Core;
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Serilog;
using OpenUtau.Colors;

namespace OpenUtau.App.ViewModels {
public class ThemeEditorStateChangedEvent { }
Expand Down Expand Up @@ -59,6 +60,12 @@ public class ThemeEditorViewModel : ViewModelBase {
[Reactive] public Color BlackKeyColorRight { get; set; }
[Reactive] public Color BlackKeyNameColor { get; set; }

[Reactive] public Color MainColorA { get; set; }
[Reactive] public Color MainColorB { get; set; }
[Reactive] public bool IsDarkModeEasy { get; set; }

[Reactive] public bool IsEasyMode { get; set; } = true;

public ThemeEditorViewModel(string customThemePath) {
this.customThemePath = customThemePath;

Expand Down Expand Up @@ -110,6 +117,10 @@ public ThemeEditorViewModel(string customThemePath) {
BlackKeyColorRight = Color.Parse(themeYaml.BlackKeyColorRight);
BlackKeyNameColor = Color.Parse(themeYaml.BlackKeyNameColor);

MainColorA = Color.Parse(themeYaml.MainColorA);
MainColorB = Color.Parse(themeYaml.MainColorB);
IsDarkModeEasy = themeYaml.IsDarkModeEasy;

this.WhenAnyValue(vm => vm.IsDarkMode)
.Subscribe(v => {
Application.Current!.Resources["IsDarkMode"] = v;
Expand All @@ -121,6 +132,13 @@ public ThemeEditorViewModel(string customThemePath) {
ThemeManager.LoadTheme();
});


this.WhenAnyValue(vm => vm.IsDarkModeEasy)
.Subscribe(v => {
Application.Current!.Resources["IsDarkModeEasy"] = v;
UpdateColorsByMain();
});

this.WhenAnyValue(vm => vm.BackgroundColor)
.Subscribe(v => Application.Current!.Resources["BackgroundColor"] = v);

Expand Down Expand Up @@ -221,6 +239,18 @@ public ThemeEditorViewModel(string customThemePath) {

this.WhenAnyValue(vm => vm.BlackKeyNameColor)
.Subscribe(v => Application.Current!.Resources["BlackKeyNameColor"] = v);

this.WhenAnyValue(vm => vm.MainColorA)
.Subscribe(v => {
Application.Current!.Resources["MainColorA"] = v;
UpdateColorsByMain();
});

this.WhenAnyValue(vm => vm.MainColorB)
.Subscribe(v => {
Application.Current!.Resources["MainColorB"] = v;
UpdateColorsByMain();
});
}

public void Save() {
Expand Down Expand Up @@ -265,11 +295,117 @@ public void Save() {

BlackKeyColorLeft = BlackKeyColorLeft.ToString(),
BlackKeyColorRight = BlackKeyColorRight.ToString(),
BlackKeyNameColor = BlackKeyNameColor.ToString()
BlackKeyNameColor = BlackKeyNameColor.ToString(),

MainColorA = MainColorA.ToString(),
MainColorB = MainColorB.ToString(),
IsDarkModeEasy = IsDarkModeEasy
};

File.WriteAllText(customThemePath, Yaml.DefaultSerializer.Serialize(themeYaml), Encoding.UTF8);
}

private void UpdateColorsByMain() {
if (IsDarkModeEasy) {
BackgroundColor = Color.FromUInt32(0xFF303030);
BackgroundColorPointerOver = Color.FromUInt32(0xFF505050);
BackgroundColorPressed = Color.FromUInt32(0xFF707070);
BackgroundColorDisabled = Color.FromUInt32(0xFF404040);

ForegroundColor = Color.FromUInt32(0xFFE0E0E0);
ForegroundColorPointerOver = Color.FromUInt32(0xFFFCFCFC);
ForegroundColorPressed = Color.FromUInt32(0xFFFFFFFF);
ForegroundColorDisabled = Color.FromUInt32(0xFFA0A0A0);

BorderColor = Color.FromUInt32(0xFF707070);
BorderColorPointerOver = Color.FromUInt32(0xFFB0B0B0);

SystemAccentColor = MainColorA;
SystemAccentColorLight1 = ColorShift(MainColorA, 32);
SystemAccentColorDark1 = ColorMultiply(MainColorA, 0.8f);

NeutralAccentColor = Color.FromUInt32(0xFF808080);
NeutralAccentColorPointerOver = Color.FromUInt32(0xFFA0A0A0);
AccentColor1 = MainColorA;
AccentColor2 = ColorShift(MainColorB, 32);
AccentColor3 = ColorMultiply(MainColorB, 0.8f);

TickLineColor = Color.FromUInt32(0xFF707070);
BarNumberColor = Color.FromUInt32(0xFFD0D0D0);
FinalPitchColor = Color.FromUInt32(0xFFD0D0D0);
TrackBackgroundAltColor = Color.FromUInt32(0xFF404040);

WhiteKeyColorLeft = ColorMultiply(MainColorB, 0.9f);
WhiteKeyColorRight = MainColorB;
WhiteKeyNameColor = Color.FromUInt32(0xFFFFFFFF);

CenterKeyColorLeft = ColorMultiply(ColorShift(MainColorB, 152), 0.9f);
CenterKeyColorRight = ColorShift(MainColorB, 152);
CenterKeyNameColor = MainColorB;

BlackKeyColorLeft = Color.FromUInt32(0x00000000);
BlackKeyColorRight = Color.FromUInt32(0x00000000);
BlackKeyNameColor = Color.FromUInt32(0xFFFFFFFF);
} else {
BackgroundColor = Color.FromUInt32(0xFFFFFFFF);
BackgroundColorPointerOver = Color.FromUInt32(0xFFF0F0F0);
BackgroundColorPressed = Color.FromUInt32(0xFFE0E0E0);
BackgroundColorDisabled = Color.FromUInt32(0xFFD0D0D0);

ForegroundColor = Color.FromUInt32(0xFF000000);
ForegroundColorPointerOver = Color.FromUInt32(0xFF000000);
ForegroundColorPressed = Color.FromUInt32(0xFF202020);
ForegroundColorDisabled = Color.FromUInt32(0xFF808080);

BorderColor = Color.FromUInt32(0xFF707070);
BorderColorPointerOver = Color.FromUInt32(0xFFB0B0B0);

SystemAccentColor = MainColorA;
SystemAccentColorLight1 = ColorShift(MainColorA, 32);
SystemAccentColorDark1 = ColorMultiply(MainColorA, 0.8f);

NeutralAccentColor = Color.FromUInt32(0xFFA7A7A7);
NeutralAccentColorPointerOver = Color.FromUInt32(0xFF909090);
AccentColor1 = MainColorA;
AccentColor2 = ColorShift(MainColorB, 32);
AccentColor3 = ColorMultiply(MainColorB, 0.8f);

TickLineColor = Color.FromUInt32(0xFFB0B0B0);
BarNumberColor = Color.FromUInt32(0xFFB0B0B0);
FinalPitchColor = Color.FromUInt32(0xFFC0C0C0);
TrackBackgroundAltColor = Color.FromUInt32(0xFFF0F0F0);

WhiteKeyColorLeft = Color.FromUInt32(0x00000000);
WhiteKeyColorRight = Color.FromUInt32(0x00000000);
WhiteKeyNameColor = MainColorB;

CenterKeyColorLeft = ColorShift(MainColorB, 144);
CenterKeyColorRight = ColorShift(MainColorB, 152);
CenterKeyNameColor = MainColorB;

BlackKeyColorLeft = ColorShift(MainColorB, 32);
BlackKeyColorRight = MainColorB;
BlackKeyNameColor = Color.FromUInt32(0xFFFFFFFF);
}
IsDarkMode = IsDarkModeEasy;
}

public static Color ColorMultiply(Color color, float ratio) {
return Color.FromArgb(
color.A,
(byte)((color.R * ratio) > 255 ? 255 : color.R * ratio),
(byte)((color.G * ratio) > 255 ? 255 : color.G * ratio),
(byte)((color.B * ratio) > 255 ? 255 : color.B * ratio)
);
}
public static Color ColorShift(Color color, int delta) {
return Color.FromArgb(
color.A,
(byte)((color.R + delta) > 255 ? 255 : ((color.R + delta) < 0 ? 0 : color.R + delta)),
(byte)((color.G + delta) > 255 ? 255 : ((color.G + delta) < 0 ? 0 : color.G + delta)),
(byte)((color.B + delta) > 255 ? 255 : ((color.B + delta) < 0 ? 0 : color.B + delta))
);
}

}
}
Loading