From 5162403f64b511a04b541fc82d0a27c828551610 Mon Sep 17 00:00:00 2001 From: Arne Kiesewetter Date: Tue, 17 Dec 2024 19:42:11 +0100 Subject: [PATCH] Add a fix for https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/281 --- .../GammaCorrectedColorXLuminance.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 CommunityBugFixCollection/GammaCorrectedColorXLuminance.cs diff --git a/CommunityBugFixCollection/GammaCorrectedColorXLuminance.cs b/CommunityBugFixCollection/GammaCorrectedColorXLuminance.cs new file mode 100644 index 0000000..9a8d5fa --- /dev/null +++ b/CommunityBugFixCollection/GammaCorrectedColorXLuminance.cs @@ -0,0 +1,25 @@ +using Elements.Core; +using HarmonyLib; +using MonkeyLoader.Resonite; +using System; +using System.Collections.Generic; +using System.Text; + +namespace CommunityBugFixCollection +{ + [HarmonyPatchCategory(nameof(GammaCorrectedColorXLuminance))] + [HarmonyPatch(typeof(colorX), nameof(colorX.Luminance), MethodType.Getter)] + internal sealed class GammaCorrectedColorXLuminance : ResoniteMonkey + { + public override bool CanBeDisabled => true; + + private static bool Prefix(colorX __instance, out float __result) + { + __result = __instance.ConvertProfile(ColorProfile.Linear).BaseColor.Luminance; + + return false; + } + + private static bool Prepare() => Enabled; + } +} \ No newline at end of file