Factor out css color syntax into snippet.

This refactoring allows the _same_ paragraph(s) about the syntax of a color in Textual CSS to be reused throughout the docs, preventing us from repeating ourselves and allowing us to be more consistent.
This commit is contained in:
Rodrigo Girão Serrão
2022-12-15 11:55:42 +00:00
parent c3d8df7d2e
commit d5d24235fa
2 changed files with 8 additions and 7 deletions

View File

@@ -8,13 +8,7 @@ The `background` rule sets the background color of a widget with an optional tra
background: <COLOR> [<PERCENTAGE>];
```
The legal values for `<COLOR>` are dependant on the [class `Color`][textual.color.Color] and include:
- a recognised [named color](../../api/color#textual.color--named-colors) (e.g., `red`);
- a hexadecimal number representing the RGB values of the color (e.g., `#F35573`);
- a color description in the HSL system (e.g., `hsl(290,70%,80%)`)
For more details about the exact formats accepted, see [the class method `Color.parse`][textual.color.Color.parse].
--8<-- "docs/styles/snippets/color_css_syntax.md"
## Examples

View File

@@ -0,0 +1,7 @@
The legal values for `<COLOR>` are dependant on the [class `Color`][textual.color.Color] and include:
- a recognised [named color](../../api/color#textual.color--named-colors) (e.g., `red`);
- a hexadecimal number representing the RGB values of the color (e.g., `#F35573`);
- a color description in the HSL system (e.g., `hsl(290,70%,80%)`)
For more details about the exact formats accepted, see [the class method `Color.parse`][textual.color.Color.parse].