diff --git a/src/textual/css/_style_properties.py b/src/textual/css/_style_properties.py index 92589c23b..6fba80edd 100644 --- a/src/textual/css/_style_properties.py +++ b/src/textual/css/_style_properties.py @@ -775,7 +775,7 @@ class TransitionsProperty: obj.set_rule("transitions", transitions.copy()) -class PercentageProperty: +class FractionalProperty: """Property that can be set either as a float (e.g. 0.1) or a string percentage (e.g. '10%'). Values will be clamped to the range (0, 1). """ diff --git a/src/textual/css/styles.py b/src/textual/css/styles.py index 6d218cd76..7516b7971 100644 --- a/src/textual/css/styles.py +++ b/src/textual/css/styles.py @@ -28,7 +28,7 @@ from ._style_properties import ( StyleFlagsProperty, StyleProperty, TransitionsProperty, - PercentageProperty, + FractionalProperty, ) from .constants import VALID_DISPLAY, VALID_VISIBILITY from .scalar import Scalar, ScalarOffset, Unit @@ -124,7 +124,7 @@ class StylesBase(ABC): text_background = ColorProperty() text_style = StyleFlagsProperty() - opacity = PercentageProperty() + opacity = FractionalProperty() padding = SpacingProperty() margin = SpacingProperty() diff --git a/tests/css/test_style_properties.py b/tests/css/test_style_properties.py new file mode 100644 index 000000000..e69de29bb