sugar3.graphics.style module

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. #FFFFFFFF)

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.

sugar3.graphics.style.COLOR_BLACK = <sugar3.graphics.style.Color object>

Black

sugar3.graphics.style.COLOR_BUTTON_GREY = <sugar3.graphics.style.Color object>

Color of buttons

sugar3.graphics.style.COLOR_HIGHLIGHT = <sugar3.graphics.style.Color object>

Color of highlighted text

sugar3.graphics.style.COLOR_INACTIVE_FILL = <sugar3.graphics.style.Color object>

Fill colour of an inactive button

sugar3.graphics.style.COLOR_INACTIVE_STROKE = <sugar3.graphics.style.Color object>

Stroke colour of an inactive button

sugar3.graphics.style.COLOR_PANEL_GREY = <sugar3.graphics.style.Color object>

Default background color of a window

sugar3.graphics.style.COLOR_SELECTION_GREY = <sugar3.graphics.style.Color object>

Background color of selected entry

sugar3.graphics.style.COLOR_TEXT_FIELD_GREY = <sugar3.graphics.style.Color object>

Background color of entry

sugar3.graphics.style.COLOR_TOOLBAR_GREY = <sugar3.graphics.style.Color object>

Color of toolbars

sugar3.graphics.style.COLOR_TRANSPARENT = <sugar3.graphics.style.Color object>

Fully transparent color

sugar3.graphics.style.COLOR_WHITE = <sugar3.graphics.style.Color object>

White

class sugar3.graphics.style.Color(color, alpha=1.0)

Bases: object

A Color object defines a specific color.

Parameters:
  • color (str) – String in the form #FFFFFF representing the color
  • alpha (double) – transparency of color
get_gdk_color()

Returns GDK standard color

get_html()

Returns string in the standard html Color format (#FFFFFF)

get_int()

Returns color encoded as an int, in the form rgba

get_rgba()

Returns 4-tuple of red, green, blue, and alpha levels in range 0-1

get_svg()

Returns HTML formatted color, unless the color is completely transparent, in which case returns “none”

sugar3.graphics.style.DEFAULT_PADDING = 6

Padding is placed around an element

sugar3.graphics.style.DEFAULT_SPACING = 15

Spacing is placed in-between elements

sugar3.graphics.style.FONT_BOLD = <sugar3.graphics.style.Font object>

Bold font

sugar3.graphics.style.FONT_BOLD_H = 24

Height in pixels of bold font

sugar3.graphics.style.FONT_FACE = 'Sans Serif'

User’s preferred font face

sugar3.graphics.style.FONT_NORMAL = <sugar3.graphics.style.Font object>

Normal font

sugar3.graphics.style.FONT_NORMAL_H = 24

Height in pixels of normal font

sugar3.graphics.style.FONT_SIZE = 10.0

User’s preferred font size

class sugar3.graphics.style.Font(desc)

Bases: object

A font defines the style of how the text should be rendered.

Parameters:desc (str) – a description of the Font object
get_pango_desc()

Returns Pango description of font

sugar3.graphics.style.GRID_CELL_SIZE = 75

allow elements to tile neatly within boundaries of a grid http://wiki.sugarlabs.org/go/Human_Interface_Guidelines#The_Grid_System

sugar3.graphics.style.LARGE_ICON_SIZE = 110

larger than medium, used in journal empty view

sugar3.graphics.style.LINE_WIDTH = 2

Thickness of a separator line

sugar3.graphics.style.MEDIUM_ICON_SIZE = 82

larger than standard

sugar3.graphics.style.MENU_WIDTH_CHARS = 60

Max width of text in a palette menu, in chars

sugar3.graphics.style.PALETTE_CURSOR_DISTANCE = 10

Cursor invoked palettes will be placed this far from the cursor

sugar3.graphics.style.SMALL_ICON_SIZE = 33

small icon, used in palette menu items

sugar3.graphics.style.STANDARD_ICON_SIZE = 55

icon that fits within a grid cell

sugar3.graphics.style.TOOLBAR_ARROW_SIZE = 24

Size of arrow displayed under toolbar buttons to represent their status

sugar3.graphics.style.XLARGE_ICON_SIZE = 151

larger than large, used in activity pulsing launcher icon

sugar3.graphics.style.ZOOM_FACTOR = 1.0

scale factor, as float (eg. 0.72, 1.0)

sugar3.graphics.style.zoom(units)

Returns size of units pixels at current zoom level

Parameters:units (int) – size of item at full size