From d44a99885e3f9e2a50165181b3b285f249d188ef Mon Sep 17 00:00:00 2001 From: Matthias Metelka <62722460+kleinerpirat@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:25:36 +0100 Subject: [PATCH] Use shallow copy to isolate browser row color adjustments (#2158) This stops flag and card state colors from getting increasingly lighter/darker and also makes the effect exclusive to the cell rows. --- qt/aqt/browser/table/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/qt/aqt/browser/table/__init__.py b/qt/aqt/browser/table/__init__.py index 434d7cc26..a51e96533 100644 --- a/qt/aqt/browser/table/__init__.py +++ b/qt/aqt/browser/table/__init__.py @@ -2,6 +2,7 @@ # License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html from __future__ import annotations +import copy import time from dataclasses import dataclass from typing import TYPE_CHECKING, Generator, Sequence, Union @@ -103,9 +104,12 @@ def backend_color_to_aqt_color(color: BrowserRow.Color.V) -> dict[str, str] | No def adjusted_bg_color(color: dict[str, str]) -> dict[str, str]: if color: - color["light"] = QColor(color["light"]).lighter(150).name() - color["dark"] = QColor(color["dark"]).darker(150).name() - return color + adjusted_color = copy.copy(color) + light = QColor(color["light"]).lighter(150) + adjusted_color["light"] = light.name() + dark = QColor(color["dark"]).darker(150) + adjusted_color["dark"] = dark.name() + return adjusted_color else: return None