Skip to content

Styles

API

counterweight.styles.Style

layout class-attribute instance-attribute

layout: Flex = Field(default=Flex())

span class-attribute instance-attribute

span: Span = Field(default=Span())

margin class-attribute instance-attribute

margin: Margin = Field(default=Margin())

border class-attribute instance-attribute

border: Border | None = Field(default=None)

padding class-attribute instance-attribute

padding: Padding = Field(default=Padding())

content class-attribute instance-attribute

content: Content = Field(default=Content())

typography class-attribute instance-attribute

typography: Typography = Field(default=Typography())

counterweight.styles.Flex

type class-attribute instance-attribute

type: Literal['flex'] = 'flex'

direction class-attribute instance-attribute

direction: Literal['row', 'column'] = 'row'

position class-attribute instance-attribute

position: Relative | Absolute | Fixed = Field(
    default=Relative(), discriminator="type"
)

weight class-attribute instance-attribute

weight: PositiveInt | None = 1

z class-attribute instance-attribute

z: int = 0

align_self class-attribute instance-attribute

align_self: Literal[
    "none", "start", "center", "end", "stretch"
] = "none"

justify_children class-attribute instance-attribute

justify_children: Literal[
    "start",
    "center",
    "end",
    "space-between",
    "space-around",
    "space-evenly",
] = "start"

align_children class-attribute instance-attribute

align_children: Literal[
    "start", "center", "end", "stretch"
] = "start"

gap_children class-attribute instance-attribute

gap_children: NonNegativeInt = 0

counterweight.styles.Span

width class-attribute instance-attribute

width: int | Literal['auto'] = Field(default='auto')

height class-attribute instance-attribute

height: int | Literal['auto'] = Field(default='auto')

counterweight.styles.Margin

top class-attribute instance-attribute

top: int = Field(default=0)

bottom class-attribute instance-attribute

bottom: int = Field(default=0)

left class-attribute instance-attribute

left: int = Field(default=0)

right class-attribute instance-attribute

right: int = Field(default=0)

color class-attribute instance-attribute

color: Color = Field(default=from_name('black'))

counterweight.styles.Border

kind class-attribute instance-attribute

kind: BorderKind = Field(default=Light)

style class-attribute instance-attribute

style: CellStyle = Field(default=CellStyle())

edges class-attribute instance-attribute

edges: frozenset[BorderEdge] = frozenset(
    {Top, Bottom, Left, Right}
)

contract class-attribute instance-attribute

contract: int = Field(default=0)

counterweight.styles.Padding

top class-attribute instance-attribute

top: int = Field(default=0)

bottom class-attribute instance-attribute

bottom: int = Field(default=0)

left class-attribute instance-attribute

left: int = Field(default=0)

right class-attribute instance-attribute

right: int = Field(default=0)

color class-attribute instance-attribute

color: Color = Field(default=from_name('black'))

counterweight.styles.Typography

style class-attribute instance-attribute

style: CellStyle = Field(default=CellStyle())

justify class-attribute instance-attribute

justify: Literal['left', 'center', 'right'] = 'left'

wrap class-attribute instance-attribute

wrap: Literal['none', 'paragraphs'] = 'none'

counterweight.styles.Color

red instance-attribute

red: int

green instance-attribute

green: int

blue instance-attribute

blue: int

hex property

hex: str

from_name classmethod

from_name(name: str) -> Color

from_hex cached classmethod

from_hex(hex: str) -> Color

blend

blend(other: Color, alpha: float) -> Color

counterweight.styles.CellStyle

foreground class-attribute instance-attribute

foreground: Color = Field(default=from_name('white'))

background class-attribute instance-attribute

background: Color = Field(default=from_name('black'))

bold class-attribute instance-attribute

bold: bool = False

dim class-attribute instance-attribute

dim: bool = False

italic class-attribute instance-attribute

italic: bool = False

underline class-attribute instance-attribute

underline: bool = False

strikethrough class-attribute instance-attribute

strikethrough: bool = False