@@ -19,7 +19,8 @@ def setTitle(self, text):
1919 super (_NodeGroupBox , self ).setTitle (text )
2020
2121 def setTitleAlign (self , align = 'center' ):
22- text_color = self .palette ().text ().color ().getRgb ()
22+ text_color = tuple (map (lambda i , j : i - j , (255 , 255 , 255 ),
23+ ViewerEnum .BACKGROUND_COLOR .value ))
2324 style_dict = {
2425 'QGroupBox' : {
2526 'background-color' : 'rgba(0, 0, 0, 0)' ,
@@ -322,10 +323,10 @@ class NodeLineEdit(NodeBaseWidget):
322323
323324 def __init__ (self , parent = None , name = '' , label = '' , text = '' ):
324325 super (NodeLineEdit , self ).__init__ (parent , name , label )
325- plt = self . palette ()
326- bg_color = plt . alternateBase (). color (). getRgb ()
327- text_color = plt . text (). color (). getRgb ( )
328- text_sel_color = plt . highlightedText (). color (). getRgb ()
326+ bg_color = ViewerEnum . BACKGROUND_COLOR . value
327+ text_color = tuple ( map ( lambda i , j : i - j , ( 255 , 255 , 255 ),
328+ bg_color ) )
329+ text_sel_color = text_color
329330 style_dict = {
330331 'QLineEdit' : {
331332 'background' : 'rgba({0},{1},{2},20)' .format (* bg_color ),
@@ -392,9 +393,23 @@ class NodeCheckBox(NodeBaseWidget):
392393 def __init__ (self , parent = None , name = '' , label = '' , text = '' , state = False ):
393394 super (NodeCheckBox , self ).__init__ (parent , name , label )
394395 _cbox = QtWidgets .QCheckBox (text )
396+ text_color = tuple (map (lambda i , j : i - j , (255 , 255 , 255 ),
397+ ViewerEnum .BACKGROUND_COLOR .value ))
398+ style_dict = {
399+ 'QCheckBox' : {
400+ 'color' : 'rgba({0},{1},{2},150)' .format (* text_color ),
401+ }
402+ }
403+ stylesheet = ''
404+ for css_class , css in style_dict .items ():
405+ style = '{} {{\n ' .format (css_class )
406+ for elm_name , elm_val in css .items ():
407+ style += ' {}:{};\n ' .format (elm_name , elm_val )
408+ style += '}\n '
409+ stylesheet += style
410+ _cbox .setStyleSheet (stylesheet )
395411 _cbox .setChecked (state )
396412 _cbox .setMinimumWidth (80 )
397-
398413 font = _cbox .font ()
399414 font .setPointSize (11 )
400415 _cbox .setFont (font )
0 commit comments