mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-07 00:20:07 +00:00
Shift node color's brightness for light mode (#123)
* Shift node color's brightness for light mode * nit * Fix test
This commit is contained in:
@@ -20,6 +20,7 @@ import {
|
||||
parseComfyWorkflow,
|
||||
} from "../types/comfyWorkflow";
|
||||
import { ComfyNodeDef } from "@/types/apiTypes";
|
||||
import { lightenColor } from "@/utils/colorUtil";
|
||||
import { ComfyAppMenu } from "./ui/menu/index";
|
||||
import { getStorageValue } from "./utils";
|
||||
import { ComfyWorkflowManager, ComfyWorkflow } from "./workflows";
|
||||
@@ -1538,7 +1539,8 @@ export class ComfyApp {
|
||||
// @ts-ignore
|
||||
LGraphCanvas.prototype.drawNode = function (node, ctx) {
|
||||
var editor_alpha = this.editor_alpha;
|
||||
var old_color = node.bgcolor;
|
||||
var old_color = node.color;
|
||||
var old_bgcolor = node.bgcolor;
|
||||
|
||||
if (node.mode === 2) {
|
||||
// never
|
||||
@@ -1551,10 +1553,19 @@ export class ComfyApp {
|
||||
// this.editor_alpha = 0.2;
|
||||
// }
|
||||
|
||||
const adjustColor = (color?: string) => {
|
||||
return color ? lightenColor(color, 0.5) : color;
|
||||
};
|
||||
if (app.ui.settings.getSettingValue("Comfy.ColorPalette") === "light") {
|
||||
node.bgcolor = adjustColor(node.bgcolor);
|
||||
node.color = adjustColor(node.color);
|
||||
}
|
||||
|
||||
const res = origDrawNode.apply(this, arguments);
|
||||
|
||||
this.editor_alpha = editor_alpha;
|
||||
node.bgcolor = old_color;
|
||||
node.color = old_color;
|
||||
node.bgcolor = old_bgcolor;
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user