mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
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.
This commit is contained in:
parent
ee9af871b7
commit
d44a99885e
1 changed files with 7 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import copy
|
||||||
import time
|
import time
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import TYPE_CHECKING, Generator, Sequence, Union
|
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]:
|
def adjusted_bg_color(color: dict[str, str]) -> dict[str, str]:
|
||||||
if color:
|
if color:
|
||||||
color["light"] = QColor(color["light"]).lighter(150).name()
|
adjusted_color = copy.copy(color)
|
||||||
color["dark"] = QColor(color["dark"]).darker(150).name()
|
light = QColor(color["light"]).lighter(150)
|
||||||
return color
|
adjusted_color["light"] = light.name()
|
||||||
|
dark = QColor(color["dark"]).darker(150)
|
||||||
|
adjusted_color["dark"] = dark.name()
|
||||||
|
return adjusted_color
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue