File size: 1,016 Bytes
5b76e0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Text-opacity

The `text-opacity` blends the color of the content of a widget with the color of the background.

## Syntax

```
text-opacity: <FRACTIONAL>;
```

### Values

As a fractional property, `text-opacity` can be set to either a float (between 0 and 1),
or a percentage, e.g. `45%`.
Float values will be clamped between 0 and 1.
Percentage values will be clamped between 0% and 100%.

## Example

This example shows, from top to bottom, increasing text-opacity values.

=== "text_opacity.py"

    ```python
    --8<-- "docs/examples/styles/text_opacity.py"
    ```

=== "text_opacity.css"

    ```css
    --8<-- "docs/examples/styles/text_opacity.css"
    ```

=== "Output"

    ```{.textual path="docs/examples/styles/text_opacity.py"}
    ```

## CSS

```sass
/* Set the text to be "half-faded" against the background of the widget */
Widget {
    text-opacity: 50%;
}
```

## Python

```python
# Set the text to be "half-faded" against the background of the widget
widget.styles.text_opacity = "50%"
```