style.text
style.text(color=None, font=None, size=None, align=None, v_align=None, style=None, weight=None, stretch=None, decorate=None, transform=None, whitespace=None)
A style specification for cell text.
The style.text()
class is to be used with the tab_style()
method, which itself allows for the setting of custom styles to one or more cells. With it, you can specify the color of the text, the font family, the font size, and the horizontal and vertical alignment of the text and more.
Parameters
Name | Type | Description | Default |
---|---|---|---|
color |
str | ColumnExpr | None |
The text color can be modified through the color argument. |
None |
font |
str | ColumnExpr | None |
The font or collection of fonts (subsequent font names are) used as fallbacks. | None |
size |
str | ColumnExpr | None |
The size of the font. Can be provided as a number that is assumed to represent px values (or could be wrapped in the px() helper function). We can also use one of the following absolute size keywords: "xx-small" , "x-small" , "small" , "medium" , "large" , "x-large" , or "xx-large" . |
None |
align |
Literal [‘center’, ‘left’, ‘right’, ‘justify’] | ColumnExpr | None |
The text in a cell can be horizontally aligned though one of the following options: "center" , "left" , "right" , or "justify" . |
None |
v_align |
Literal [‘middle’, ‘top’, ‘bottom’] | ColumnExpr | None |
The vertical alignment of the text in the cell can be modified through the options "middle" , "top" , or "bottom" . |
None |
style |
Literal [‘normal’, ‘italic’, ‘oblique’] | ColumnExpr | None |
Can be one of either "normal" , "italic" , or "oblique" . |
None |
weight |
Literal [‘normal’, ‘bold’, ‘bolder’, ‘lighter’] | ColumnExpr | None |
The weight of the font can be modified thorough a text-based option such as "normal" , "bold" , "lighter" , "bolder" , or, a numeric value between 1 and 1000 , inclusive. Note that only variable fonts may support the numeric mapping of weight. |
None |
stretch |
Literal [‘normal’, ‘condensed’, ‘ultra-condensed’, ‘extra-condensed’, ‘semi-condensed’, ‘semi-expanded’, ‘expanded’, ‘extra-expanded’, ‘ultra-expanded’] | ColumnExpr | None |
Allows for text to either be condensed or expanded. We can use one of the following text-based keywords to describe the degree of condensation/expansion: "ultra-condensed" , "extra-condensed" , "condensed" , "semi-condensed" , "normal" , "semi-expanded" , "expanded" , "extra-expanded" , or "ultra-expanded" . Alternatively, we can supply percentage values from 0% to 200% , inclusive. Negative percentage values are not allowed. |
None |
decorate |
Literal [‘overline’, ‘line-through’, ‘underline’, ‘underline overline’] | ColumnExpr | None |
Allows for text decoration effect to be applied. Here, we can use "overline" , "line-through" , or "underline" . |
None |
transform |
Literal [‘uppercase’, ‘lowercase’, ‘capitalize’] | ColumnExpr | None |
Allows for the transformation of text. Options are "uppercase" , "lowercase" , or "capitalize" . |
None |
whitespace |
Literal [‘normal’, ‘nowrap’, ‘pre’, ‘pre-wrap’, ‘pre-line’, ‘break-spaces’] | ColumnExpr | None |
A white-space preservation option. By default, runs of white-space will be collapsed into single spaces but several options exist to govern how white-space is collapsed and how lines might wrap at soft-wrap opportunities. The options are "normal" , "nowrap" , "pre" , "pre-wrap" , "pre-line" , and "break-spaces" . |
None |
Returns
Type | Description |
---|---|
CellStyleText | A CellStyleText object, which is used for a styles argument if specifying any cell text properties. |
Examples
See GT.tab_style()
.