File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,29 +7,29 @@ class ColorToRGBInt(io.ComfyNode):
77 def define_schema (cls ) -> io .Schema :
88 return io .Schema (
99 node_id = "ColorToRGBInt" ,
10- display_name = "Color to RGB Int " ,
10+ display_name = "Color Picker " ,
1111 category = "utilities" ,
12- description = "Convert a color to a RGB integer value." ,
12+ description = "Return a color RGB integer value and hexadecimal representation ." ,
1313 inputs = [
1414 io .Color .Input ("color" ),
1515 ],
1616 outputs = [
1717 io .Int .Output (display_name = "rgb_int" ),
18+ io .Color .Output (display_name = "hex" )
1819 ],
1920 )
2021
2122 @classmethod
22- def execute (
23- cls ,
24- color : str ,
25- ) -> io .NodeOutput :
23+ def execute (cls , color : str ) -> io .NodeOutput :
2624 # expect format #RRGGBB
2725 if len (color ) != 7 or color [0 ] != "#" :
2826 raise ValueError ("Color must be in format #RRGGBB" )
2927 r = int (color [1 :3 ], 16 )
3028 g = int (color [3 :5 ], 16 )
3129 b = int (color [5 :7 ], 16 )
32- return io .NodeOutput (r * 256 * 256 + g * 256 + b )
30+
31+ rgb_int = r * 256 * 256 + g * 256 + b
32+ return io .NodeOutput (rgb_int , color )
3333
3434
3535class ColorExtension (ComfyExtension ):
You can’t perform that action at this time.
0 commit comments