[GH-PR-76] [CLOSED] re-integrated ratio colors by percentage #84

Closed
opened 2025-11-21 16:56:07 -05:00 by cj · 0 comments
Owner

Mirrored from GitHub Pull Request #76

Original author: @Carve

Created at: 2024-10-03T17:19:02Z

Status: CLOSED

Merged: NO (closed at 2024-10-03T17:19:26Z)

Source branch: Carve:71-issues-with-qbittorrent-v500

Target branch: Carve:stable

Commits (1)

  • 71046d5 re-integrated ratio colors by percentage - Carve

Changes

Files changed: 1
Lines added: +19
Lines removed: -0

Modified files:

  • modified: private/scripts/dynamicTable.js (+19/-0)

Diff for private/scripts/dynamicTable.js:

@@ -1226,6 +1226,25 @@ window.qBittorrent.DynamicTable ??= (() => {
                 const string = (ratio === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(ratio, 2);
                 td.textContent = string;
                 td.title = string;
+                // ratio colors by percentage
+                td.classList.add('ratio');
+                if (string === 0 || string === "0.00" || string <= "0.09") {
+                    td.classList.add('highlight-darkred');
+                } else if (string >= "0.10" && string <= "0.19") {
+                    td.classList.add('highlight-red');
+                } else if (string >= "0.20" && string <= "0.39") {
+                    td.classList.add('highlight-orange');
+                } else if (string >= "0.40" && string <= "0.59") {
+                    td.classList.add('highlight-yellow');
+                } else if (string >= "0.60" && string <= "0.89") {
+                    td.classList.add('highlight-green');
+                } else if (string >= "0.90" && string <= "0.99") {
+                    td.classList.add('highlight-brightgreen');
+                } else if (string >= "1.0" && string <= "1.5") {
+                    td.classList.add('highlight-blue');
+                } else if (string >= "1.5") {
+                    td.classList.add('highlight-purple');
+                }
             };
 
             // popularity
*Mirrored from GitHub Pull Request [#76](https://github.com/Carve/qbittorrent-webui-cjratliff.com/pull/76)* **Original author: @Carve** **Created at: 2024-10-03T17:19:02Z** **Status: CLOSED** **Merged: NO (closed at 2024-10-03T17:19:26Z)** **Source branch: Carve:71-issues-with-qbittorrent-v500** **Target branch: Carve:stable** ## Commits (1) * [`71046d5`](https://github.com/Carve/qbittorrent-webui-cjratliff.com/pull/76/commits/71046d51d7bbdb2a8693f93003a2fb652a9b3252) re-integrated ratio colors by percentage - Carve ## Changes **Files changed:** 1 **Lines added:** +19 **Lines removed:** -0 **Modified files:** * modified: `private/scripts/dynamicTable.js` (+19/-0) **Diff for `private/scripts/dynamicTable.js`:** ```diff @@ -1226,6 +1226,25 @@ window.qBittorrent.DynamicTable ??= (() => { const string = (ratio === -1) ? "∞" : window.qBittorrent.Misc.toFixedPointString(ratio, 2); td.textContent = string; td.title = string; + // ratio colors by percentage + td.classList.add('ratio'); + if (string === 0 || string === "0.00" || string <= "0.09") { + td.classList.add('highlight-darkred'); + } else if (string >= "0.10" && string <= "0.19") { + td.classList.add('highlight-red'); + } else if (string >= "0.20" && string <= "0.39") { + td.classList.add('highlight-orange'); + } else if (string >= "0.40" && string <= "0.59") { + td.classList.add('highlight-yellow'); + } else if (string >= "0.60" && string <= "0.89") { + td.classList.add('highlight-green'); + } else if (string >= "0.90" && string <= "0.99") { + td.classList.add('highlight-brightgreen'); + } else if (string >= "1.0" && string <= "1.5") { + td.classList.add('highlight-blue'); + } else if (string >= "1.5") { + td.classList.add('highlight-purple'); + } }; // popularity ```
cj closed this issue 2025-11-21 16:56:07 -05:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cj/qbittorrent-webui-cjratliff.com#84
No description provided.