Skip to content

[Repo Assist] refactor: remove unused imports and extract duplicate color lerp helper #149

Closed as not planned

Description

@github-actions

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Two small code-clarity improvements with no behaviour changes:

1. Remove unused VS template imports (App.xaml.cs)

System.Configuration and System.Data were added by the Visual Studio project template but are never used in this WPF app. Removing them keeps the using-directive list honest.

2. Extract duplicate color-temperature lerp helper (MainWindow.xaml.cs)

The identical color-lerp boilerplate (local Lerp function + cool/warm color definitions) was duplicated verbatim in both SetColorTemperature() and UpdateAdditionalMonitorWindows(). Extracted to:

  • _coolColor / _warmColor — static readonly fields (computed once, not on every call)
  • GetColorForTemperature(double t) — private static helper that replaces both copies

The two call-sites are now one-liners:

var midColor = GetColorForTemperature(_colorTemperature);

Trade-offs

None. Behaviour is identical; only duplication is removed.

Test Status

✅ Built successfully (dotnet build -p:EnableWindowsTargeting=true) — 0 warnings, 0 errors.
i️ No automated tests exist in this repository.

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

  • #144 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

Generated by Repo Assist · ● 4.2M · ◷

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

Note

This was originally intended as a pull request, but GitHub Actions is not permitted to create or approve pull requests in this repository.
The changes have been pushed to branch repo-assist/improve-code-clarity-2026-07-30-9496dab1bd9611d8.

Click here to create the pull request

To fix the permissions issue, go to Settings → Actions → General and enable Allow GitHub Actions to create and approve pull requests. See also: gh-aw FAQ

Show patch preview (121 of 121 lines)
From f196b979819a4919eb6b2880d63643fa331ffdf5 Mon Sep 17 00:00:00 2001
From: "github-actions[bot]" <github-actions[bot]@users.noreply.github.com>
Date: Thu, 30 Jul 2026 13:23:43 +0000
Subject: [PATCH] refactor: remove unused imports and extract duplicate color
 lerp helper

- App.xaml.cs: remove System.Configuration and System.Data (VS
  template leftovers, unused in this project)

- MainWindow.xaml.cs: extract GetColorForTemperature() static helper
  and _coolColor/_warmColor static readonly fields to eliminate the
  identical Lerp/cool/warm boilerplate duplicated in both
  SetColorTemperature() and UpdateAdditionalMonitorWindows()

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
 WindowsEdgeLight/App.xaml.cs        |  4 +--
 WindowsEdgeLight/MainWindow.xaml.cs | 50 +++++++++--------------------
 2 files changed, 16 insertions(+), 38 deletions(-)

diff --git a/WindowsEdgeLight/App.xaml.cs b/WindowsEdgeLight/App.xaml.cs
index c2093ca..b3f4ca0 100644
--- a/WindowsEdgeLight/App.xaml.cs
+++ b/WindowsEdgeLight/App.xaml.cs
@@ -1,6 +1,4 @@
-using System.Configuration;
-using System.Data;
-using System.Windows;
+using System.Windows;
 using Updatum;
 using MessageBox = System.Windows.MessageBox;
 
diff --git a/WindowsEdgeLight/MainWindow.xaml.cs b/WindowsEdgeLight/MainWindow.xaml.cs
index 3644301..d34de75 100644
--- a/WindowsEdgeLight/MainWindow.xaml.cs
+++ b/WindowsEdgeLight/MainWindow.xaml.cs
@@ -846,6 +846,19 @@ Version {version}";
         }
     }
 
+    // Cool (blue-white) and warm (amber) endpoint colors for the temperature gradient
+    private static readonly System.Windows.Media.Color _coolColor = System.Windows.Media.Color.FromRgb(220, 235, 255);
+    private static readonly System.Windows.Media.Color _warmColor = System.Windows.Media.Color.FromRgb(255, 220, 180);
+
+    private static System.Windows.Media.Color GetColorForTemperature(double t)
+    {
+        byte LerpByte(byte x, byte y, double tt) => (byte)(x + (y - x) * tt);
+    
... (truncated)

Activity

  1. shanselman commented on Aug 8, 2026

    @shanselman
    Owner

    Refactor-only churn does not meet the significance bar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions