Add node opacity setting (#909)

* Add node opacity setting

* Add colorUtil unit test

* Add playwright test

* Update test expectations [skip ci]

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
bymyself
2024-09-21 23:18:38 -07:00
committed by GitHub
parent ea0f74a9f6
commit 326e0748c0
10 changed files with 161 additions and 1 deletions

View File

@@ -2,6 +2,8 @@ import { app } from '../../scripts/app'
import { $el } from '../../scripts/ui'
import type { ColorPalettes, Palette } from '@/types/colorPalette'
import { LGraphCanvas, LiteGraph } from '@comfyorg/litegraph'
import { applyOpacity } from '@/utils/colorUtil'
import { useSettingStore } from '@/stores/settingStore'
// Manage color palettes
@@ -682,7 +684,13 @@ app.registerExtension({
colorPalette.colors.litegraph_base.hasOwnProperty(key) &&
LiteGraph.hasOwnProperty(key)
) {
LiteGraph[key] = colorPalette.colors.litegraph_base[key]
LiteGraph[key] =
key === 'NODE_DEFAULT_BGCOLOR'
? applyOpacity(
colorPalette.colors.litegraph_base[key],
useSettingStore().get('Comfy.Node.Opacity')
)
: colorPalette.colors.litegraph_base[key]
}
}
}