sugar4.graphics.style
The style module defines constants for spacing and sizing, as well as classes for Colors and Fonts. Text rendering is handled by Pango and colors are inputted by their HTML code (e.g. #FFFFFF)
All the constants are expressed in pixels. They are defined for the XO screen and are usually adapted to different resolution by applying a zoom factor.
Attributes
Classes
A font defines the style of how the text should be rendered. |
|
A Color object defines a specific color with RGBA values. |
Functions
|
Returns size of units pixels at current zoom level. |
|
Apply CSS styling to a widget. |
Module Contents
- class sugar4.graphics.style.Font(desc: str)[source]
A font defines the style of how the text should be rendered.
This implementation provides integration with Pango font descriptions and CSS styling.
- Parameters:
desc (str) – A description of the Font object in Pango format
- class sugar4.graphics.style.Color(color: str, alpha: float = 1.0)[source]
A Color object defines a specific color with RGBA values.
This implementation provides integration with modern color handling and CSS styling.
- Parameters:
- get_rgba() Tuple[float, float, float, float][source]
Returns 4-tuple of red, green, blue, and alpha levels in range 0-1.
- get_gdk_rgba()[source]
Returns GDK RGBA color object for GTK4. This replaces the deprecated get_gdk_color method.
- get_gdk_color()[source]
Returns GDK standard color (deprecated in GTK4). Maintained for compatibility.
- sugar4.graphics.style.zoom(units: float) int[source]
Returns size of units pixels at current zoom level.