@@ -794,9 +794,8 @@ def __set__(self, obj: StylesBase, names: str | tuple[str] | None = None):
794794class ColorProperty :
795795 """Descriptor for getting and setting color properties."""
796796
797- def __init__ (self , default_color : Color | str , background : bool = False ) -> None :
797+ def __init__ (self , default_color : Color | str ) -> None :
798798 self ._default_color = Color .parse (default_color )
799- self ._is_background = background
800799
801800 def __set_name__ (self , owner : StylesBase , name : str ) -> None :
802801 self .name = name
@@ -830,11 +829,10 @@ def __set__(self, obj: StylesBase, color: Color | str | None):
830829 _rich_traceback_omit = True
831830 if color is None :
832831 if obj .clear_rule (self .name ):
833- obj .refresh (children = self . _is_background )
832+ obj .refresh (children = True )
834833 elif isinstance (color , Color ):
835834 if obj .set_rule (self .name , color ):
836- obj .refresh (children = self ._is_background )
837-
835+ obj .refresh (children = True )
838836 elif isinstance (color , str ):
839837 alpha = 1.0
840838 parsed_color = Color (255 , 255 , 255 )
@@ -855,8 +853,9 @@ def __set__(self, obj: StylesBase, color: Color | str | None):
855853 ),
856854 )
857855 parsed_color = parsed_color .with_alpha (alpha )
856+
858857 if obj .set_rule (self .name , parsed_color ):
859- obj .refresh (children = self . _is_background )
858+ obj .refresh (children = True )
860859 else :
861860 raise StyleValueError (f"Invalid color value { color } " )
862861
0 commit comments