@@ -23,16 +23,16 @@ const getContrastTextColor = (hexColor) => {
2323} ;
2424
2525const AILabColorWidget = {
26- COLOR : ( key , val ) => {
26+ COLORCODE : ( key , val ) => {
2727 const widget = { } ;
2828 widget . y = 0 ;
2929 widget . name = key ;
30- widget . type = 'COLOR ' ;
30+ widget . type = 'COLORCODE ' ;
3131 widget . options = { default : '#222222' } ;
32- widget . value = typeof val === 'string' ? val : '#222222' ; // validate incoming value
32+ widget . value = typeof val === 'string' ? val : '#222222' ;
3333
3434 widget . draw = function ( ctx , node , widgetWidth , widgetY , height ) {
35- const hide = this . type !== 'COLOR ' && app . canvas . ds . scale > 0.5 ;
35+ const hide = this . type !== 'COLORCODE ' && app . canvas . ds . scale > 0.5 ;
3636 if ( hide ) {
3737 return ;
3838 }
@@ -66,7 +66,7 @@ const AILabColorWidget = {
6666 ctx . font = '12px sans-serif' ;
6767 ctx . textAlign = 'center' ;
6868
69- const text = `background_color (${ this . value } )` ;
69+ const text = `${ this . name } (${ this . value } )` ;
7070 ctx . fillText ( text , widgetWidth * 0.5 , widgetY + height * 0.65 ) ;
7171 } ;
7272
@@ -112,15 +112,15 @@ app.registerExtension({
112112
113113 getCustomWidgets ( ) {
114114 return {
115- COLOR : ( node , inputName , inputData ) => {
115+ COLORCODE : ( node , inputName , inputData ) => {
116116 return {
117117 widget : node . addCustomWidget (
118- AILabColorWidget . COLOR ( inputName , inputData ?. [ 1 ] ?. default || '#222222' )
118+ AILabColorWidget . COLORCODE ( inputName , inputData ?. [ 1 ] ?. default || '#222222' )
119119 ) ,
120120 minWidth : 150 ,
121121 minHeight : 32 ,
122122 } ;
123123 }
124124 } ;
125125 }
126- } ) ;
126+ } ) ;
0 commit comments