tessella.widgets.style package

Submodules

tessella.widgets.style.border_radius module

class tessella.widgets.style.border_radius.BorderRadius(top_left_radius=0, top_right_radius=0, bottom_left_radius=0, bottom_right_radius=0)[source]

Bases: object

A dataclass that allows for setting the border radius of different corners separately.

Parameters:
  • top_left_radius (int)

  • top_right_radius (int)

  • bottom_left_radius (int)

  • bottom_right_radius (int)

top_left_radius

The border radius of the top left corner, in pixels.

Type:

int

top_right_radius

The border radius of the top right corner, in pixels.

Type:

int

bottom_left_radius

The border radius of the bottom left corner, in pixels.

Type:

int

bottom_right_radius

The border radius of the bottom right corner, in pixels.

Type:

int

classmethod all(radius=0)[source]

A constructor for this class that takes a single argument representing the border radius on all corners.

Parameters:

radius (int) – The border radius of all corners, in pixels.

Returns:

A new BorderRadius instance.

Return type:

BorderRadius

tessella.widgets.style.border_style module

class tessella.widgets.style.border_style.BorderStyle(color='#343340', thickness=0, border_radius=None)[source]

Bases: object

Border styling for some widgets that support it.

Parameters:
  • color (str)

  • thickness (int)

  • border_radius (BorderRadius | None)

color

The color of the border.

Type:

str

thickness

The thickness of the border in pixels.

Type:

int

border_radius

A BorderRadius object representing the rounding on the corners of this widget.

Type:

BorderRadius

tessella.widgets.style.button_style module

class tessella.widgets.style.button_style.ButtonStyle(container_style=None, text_style=None)[source]

Bases: object

Styling object used to customize Button widgets.

Parameters:
container_style

The styling of the button’s box.

Type:

ContainerStyle

text_style

The styling of the text inside the button.

Type:

TextStyle

tessella.widgets.style.checkbox_style module

class tessella.widgets.style.checkbox_style.CheckboxStyle(thumb_color='#ECECF2', active_color='#686898', inactive_color='#3A3946', border_radius=None, thumb_padding=3)[source]

Bases: object

Styling object used to customize Checkbox widgets.

Parameters:
  • thumb_color (str)

  • active_color (str)

  • inactive_color (str)

  • border_radius (BorderRadius | None)

  • thumb_padding (int)

thumb_color

The color of the inner thumb, shown when the checkbox is checked.

Type:

str

active_color

The color of the checkbox’s box while it is being hovered.

Type:

str

inactive_color

The color of the checkbox’s box while it is not being hovered.

Type:

str

border_radius

The rounding on the corners of the box and the inner thumb.

Type:

BorderRadius

thumb_padding

The spacing between the box and the inner thumb, in pixels.

Type:

int

tessella.widgets.style.container_style module

class tessella.widgets.style.container_style.ContainerStyle(color=None, border_style=None)[source]

Bases: object

Styling for the Container widget.

Parameters:
color

The color to paint the container with, if any.

Type:

str | None

border_style

The styling of the container’s border, if any.

Type:

BorderStyle

tessella.widgets.style.dropdown_style module

class tessella.widgets.style.dropdown_style.DropdownStyle(background_color='#1E1D24', highlight_color='#2A2933', text_style=None, padding=None, border=None)[source]

Bases: object

Styling object used to customize Dropdown widgets.

Parameters:
background_color

The color of the dropdown’s box and of its entries, while not hovered.

Type:

str

highlight_color

The color of the dropdown’s box and of its entries, while hovered.

Type:

str

text_style

The styling of the selected value’s label and of the entries’ labels.

Type:

TextStyle

padding

The internal padding of the dropdown’s box and of its entries.

Type:

EdgeInsets

border

The styling of the dropdown’s box border.

Type:

BorderStyle

tessella.widgets.style.font_style module

class tessella.widgets.style.font_style.FontStyle(bold=False, italic=False, strikethrough=False, underline=False)[source]

Bases: object

Styling options for fonts.

Parameters:
  • bold (bool)

  • italic (bool)

  • strikethrough (bool)

  • underline (bool)

bold

Whether the related font should be render text as bold.

Type:

bool

italic

Whether the related font should be render text in italics.

Type:

bool

strikethrough

Whether the related font should render text with a strikethrough line.

Type:

bool

underline

Whether the related font should render text with an underline.

Type:

bool

Note that a font can have multiple styles applied to it at once.
apply_styling(font)[source]

Applies the styles to the given font object.

Parameters:

font (pygame.font.Font) – The font to apply the styles into.

Return type:

None

tessella.widgets.style.palette module

class tessella.widgets.style.palette.Palette[source]

Bases: object

Centralized color constants for Tessella’s default theme.

Every *Style class in tessella.widgets.style sources its default colors from here, so the whole widget set stays visually consistent out of the box. To re-theme the library, edit the values on this class rather than the individual style classes.

BACKGROUND

The application’s root background color.

Type:

str

SURFACE

The color of raised surfaces, such as cards, buttons and dropdown boxes.

Type:

str

SURFACE_VARIANT

A slightly different surface color, used for elements that need to stand out from a SURFACE, such as input-like boxes placed on top of cards.

Type:

str

ELEVATED

The color of a surface when hovered or highlighted, such as an active dropdown entry.

Type:

str

BORDER

The default color for borders and dividers.

Type:

str

TEXT_PRIMARY

The default color for text.

Type:

str

TEXT_SECONDARY

The color for less prominent, secondary text.

Type:

str

TEXT_MUTED

The color for the least prominent text, such as hints and captions.

Type:

str

ACCENT

The primary accent color, used to highlight interactive and active elements (buttons, active switches, checkboxes, radio buttons and sliders).

Type:

str

ACCENT_HOVER

A lighter variant of ACCENT, meant for hovered interactive elements.

Type:

str

CONTROL_INACTIVE

The color of an interactive control (switch/checkbox/radio track) while inactive.

Type:

str

CONTROL_THUMB

The color of the draggable/inner thumb of switches, checkboxes, radio buttons and sliders.

Type:

str

PLACEHOLDER

The color used by the Placeholder widget’s debug box, kept visually distinct from the rest of the palette so placeholders stand out from real content.

Type:

str

tessella.widgets.style.radio_style module

class tessella.widgets.style.radio_style.RadioStyle(thumb_color='#ECECF2', active_color='#686898', inactive_color='#3A3946', border_radius=None, thumb_padding=3)[source]

Bases: object

Styling object used to customize Radio widgets.

Parameters:
  • thumb_color (str)

  • active_color (str)

  • inactive_color (str)

  • border_radius (BorderRadius | None)

  • thumb_padding (int)

thumb_color

The color of the inner thumb, shown when this radio button is the selected one in its group.

Type:

str

active_color

The color of the radio button’s box while it is being hovered.

Type:

str

inactive_color

The color of the radio button’s box while it is not being hovered.

Type:

str

border_radius

The rounding on the corners of the box and the inner thumb.

Type:

BorderRadius

thumb_padding

The spacing between the box and the inner thumb, in pixels.

Type:

int

tessella.widgets.style.slider_style module

class tessella.widgets.style.slider_style.SliderStyle(background_color='#686898', thumb_color='#ECECF2')[source]

Bases: object

Styling object used to customize Slider widgets.

Parameters:
  • background_color (str)

  • thumb_color (str)

background_color

The color of the slider’s track.

Type:

str

thumb_color

The color of the slider’s draggable thumb.

Type:

str

tessella.widgets.style.switch_style module

class tessella.widgets.style.switch_style.SwitchStyle(thumb_color='#ECECF2', active_color='#686898', inactive_color='#3A3946', border_radius=None, thumb_padding=2)[source]

Bases: object

Styling object used to customize Switch widgets.

Parameters:
  • thumb_color (str)

  • active_color (str)

  • inactive_color (str)

  • border_radius (BorderRadius | None)

  • thumb_padding (int)

thumb_color

The color of the switch’s draggable thumb.

Type:

str

active_color

The color of the switch’s track while it is on or being hovered.

Type:

str

inactive_color

The color of the switch’s track while it is off and not being hovered.

Type:

str

border_radius

The rounding on the corners of the track and the thumb.

Type:

BorderRadius

thumb_padding

The spacing between the track and the thumb, in pixels.

Type:

int

tessella.widgets.style.text_style module

class tessella.widgets.style.text_style.TextStyle(font_size=24, font_color='#F2F2F5', font_path='/home/docs/checkouts/readthedocs.org/user_builds/tessella/checkouts/latest/src/tessella/assets/code_new_roman.otf', anti_aliasing=True, font_style=None)[source]

Bases: object

Styling for displayable texts.

Parameters:
  • font_size (int)

  • font_color (str)

  • font_path (str | None)

  • anti_aliasing (bool)

  • font_style (FontStyle | None)

font_size

The size of the font.

Type:

int

font_color

The color of the text.

Type:

str

font_path

Font file to be used. Defaults to DEFAULT_FONT_PATH (the bundled font).

Type:

str | None

anti_aliasing

Whether to use anti-aliasing when rendering the text or not.

Type:

bool

font_style

Optional variations for fonts (bold, italic, etc.)

Type:

FontStyle | None

font

Font object created with the given parameters.

Type:

pygame.font.Font

tessella.widgets.style.text_field_style module

class tessella.widgets.style.text_field_style.TextFieldStyle(container_style=None, focused_border_color='#686898', text_style=None, hint_style=None, cursor_color='#F2F2F5', selection_color='#68689880', padding=None)[source]

Bases: object

Styling object used to customize TextField widgets.

Parameters:
container_style

The styling of the field’s box, including its background color and its border while unfocused.

Type:

ContainerStyle

focused_border_color

The color of the box’s border while the field is focused.

Type:

str

text_style

The styling of the entered text.

Type:

TextStyle

hint_style

The styling of the hint text, shown while the field is empty and unfocused.

Type:

TextStyle

cursor_color

The color of the blinking text cursor.

Type:

str

selection_color

The highlight color painted behind selected text.

Type:

str

padding

The internal padding around the text.

Type:

EdgeInsets

tessella.widgets.style.text_wrap_style module

class tessella.widgets.style.text_wrap_style.TextWrapStyle(text_style=None, line_spacing=0, text_align=TextAlign.LEFT)[source]

Bases: object

Styling object used to customize TextWrap widgets.

Parameters:
text_style

The styling of the wrapped text.

Type:

TextStyle

line_spacing

The spacing between wrapped lines, in pixels.

Type:

int

text_align

The horizontal alignment of each wrapped line.

Type:

TextAlign