diff --git a/src/Artemis.Core/DefaultTypes/DataBindings/Modifiers/Colors/SKColorRotateHueModifierType.cs b/src/Artemis.Core/DefaultTypes/DataBindings/Modifiers/Colors/SKColorRotateHueModifierType.cs new file mode 100644 index 000000000..3591efacc --- /dev/null +++ b/src/Artemis.Core/DefaultTypes/DataBindings/Modifiers/Colors/SKColorRotateHueModifierType.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using SkiaSharp; + +namespace Artemis.Core.DefaultTypes +{ + internal class SKColorRotateHueModifierType : DataBindingModifierType + { + public override IReadOnlyCollection CompatibleTypes => new List {typeof(SKColor)}; + public override Type ParameterType => typeof(float); + + public override string Name => "Rotate Hue by"; + public override string Icon => "RotateRight"; + public override string Description => "Rotates the hue of the color by the amount in degrees"; + + public override object Apply(object currentValue, object parameterValue) + { + ((SKColor) currentValue).ToHsl(out float h, out float s, out float l); + + h += (float)parameterValue; + + return SKColor.FromHsl(h % 360, s, l); + } + } +} \ No newline at end of file diff --git a/src/Artemis.Core/Services/Registration/DataBindingService.cs b/src/Artemis.Core/Services/Registration/DataBindingService.cs index f3e9fa623..9b39cd61b 100644 --- a/src/Artemis.Core/Services/Registration/DataBindingService.cs +++ b/src/Artemis.Core/Services/Registration/DataBindingService.cs @@ -74,6 +74,7 @@ namespace Artemis.Core.Services RegisterModifierType(Constants.CorePluginInfo, new SKColorSumModifierType()); RegisterModifierType(Constants.CorePluginInfo, new SKColorBrightenModifierType()); RegisterModifierType(Constants.CorePluginInfo, new SKColorDarkenModifierType()); + RegisterModifierType(Constants.CorePluginInfo, new SKColorRotateHueModifierType()); } } } \ No newline at end of file