Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
ComfyUI
Commits
19ce3df8
Commit
19ce3df8
authored
Apr 11, 2023
by
EllangoK
Browse files
simplify setting color of root, fixes fg and bg
parent
eae159eb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
15 deletions
+8
-15
web/extensions/core/colorPalette.js
web/extensions/core/colorPalette.js
+8
-15
No files found.
web/extensions/core/colorPalette.js
View file @
19ce3df8
...
...
@@ -46,8 +46,8 @@ const colorPalettes = {
"
CONNECTING_LINK_COLOR
"
:
"
#AFA
"
,
},
"
comfy_base
"
:
{
"
fg-color
"
:
"
#
000
"
,
"
bg-color
"
:
"
#
fff
"
,
"
fg-color
"
:
"
#
fff
"
,
"
bg-color
"
:
"
#
202020
"
,
"
comfy-menu-bg
"
:
"
#353535
"
,
"
comfy-input-bg
"
:
"
#222
"
,
"
input-text
"
:
"
#ddd
"
,
...
...
@@ -311,10 +311,12 @@ app.registerExtension({
const
loadColorPalette
=
async
(
colorPalette
)
=>
{
colorPalette
=
await
completeColorPalette
(
colorPalette
);
if
(
colorPalette
.
colors
)
{
// Sets the colors of node slots and links
if
(
colorPalette
.
colors
.
node_slot
)
{
Object
.
assign
(
app
.
canvas
.
default_connection_color_byType
,
colorPalette
.
colors
.
node_slot
);
Object
.
assign
(
LGraphCanvas
.
link_type_colors
,
colorPalette
.
colors
.
node_slot
);
}
// Sets the colors of the LiteGraph objects
if
(
colorPalette
.
colors
.
litegraph_base
)
{
// Everything updates correctly in the loop, except the Node Title and Link Color for some reason
app
.
canvas
.
node_title_color
=
colorPalette
.
colors
.
litegraph_base
.
NODE_TITLE_COLOR
;
...
...
@@ -326,20 +328,11 @@ app.registerExtension({
}
}
}
// Sets the color of ComfyUI elements
if
(
colorPalette
.
colors
.
comfy_base
)
{
const
stylesheet
=
document
.
styleSheets
[
1
];
for
(
let
i
=
0
;
i
<
stylesheet
.
cssRules
.
length
;
i
++
)
{
const
rule
=
stylesheet
.
cssRules
[
i
];
const
selectorText
=
rule
.
selectorText
;
if
(
selectorText
&&
selectorText
===
"
:root
"
)
{
console
.
log
(
"
Found :root rule
"
);
const
rootStyle
=
document
.
documentElement
.
style
;
for
(
const
key
in
colorPalette
.
colors
.
comfy_base
)
{
rule
.
style
.
setProperty
(
'
--
'
+
key
,
colorPalette
.
colors
.
comfy_base
[
key
]);
}
break
;
}
rootStyle
.
setProperty
(
'
--
'
+
key
,
colorPalette
.
colors
.
comfy_base
[
key
]);
}
}
app
.
canvas
.
draw
(
true
,
true
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment