io7m | single-page | multi-page | JSycamore User Manual
2.6. Events
Previous
2. Model
Up
2.8. Coordinate Systems
Next

# 2.7. Themes

- 2.7.1. Description
- 2.7.2. Window Components
- 2.7.3. Components
- 2.7.4. Theme Classes
- 2.7.5. Standard Theme Classes

## 2.7.1. Description

1
A theme is an entity responsible for deciding the visual appearance of windows and components. Primarily, themes can be considered to be functions from components to sets of render nodes, although they do have some other responsibilities with regard to window components.

## 2.7.2. Window Components

1
Windows come with a set of predefined decoration components. Themes are responsible for deciding, given a set of layout constraints, where each of these components are to be placed within the constraints.

## 2.7.3. Components

1
A theme contains a set of theme component functions that, given a component c, will return a set of render nodes that describe how c should be rendered. The actual theme component function evaluated for any given component is chosen based on the theme classes defined for the component.

## 2.7.4. Theme Classes

1
A theme class is a textual string that is used by themes to locate theme information for specific components. The process is as follows for a given theme T:

### 2.7.4.2. Theme Class Lookup

1. For a given component c, request the non-empty list S of style classes held by c:
   1. For each style class k in S:
      1. If the theme T contains a theme component function for k, then evaluate the component function, passing it c, and halt execution.
      2. Otherwise, continue iterating over k.
   2. If there were no theme component functions for any style class in S, then evaluate the fallback component function defined by the theme.

3
The fallback component function is a function that will yield render nodes if no other component function can handle the given component and style classes. The fallback function is defined internally to the theme, and will typically return render nodes that unambiguously indicate that something is wrong; the fallback function should not be evaluated unless something is wrong with the theme or the component is defined in a manner that makes it incompatible with the theme.
4
As components return a non-empty list of style classes in priority order, this allows components to essentially instruct themes on how to handle the components including potential fallback behaviour. For example, a component can return the list of style classes [AcmeMagicButton, Button]. This is the same as stating "If you have support for AcmeMagicButtons, then render this component as one of those. Otherwise, if you only have support for ordinary buttons, then render this component as one of those."

## 2.7.5. Standard Theme Classes

1
The jsycamore package defines a set of standard theme classes for which all themes should attempt to support at a minimum. These names are provided as part of the SyThemeClassNameStandard enum.

### 2.7.5.2. Standard Theme Classes

Name | Description
--- | ---
Button | A generic button.
Checkbox | A checkbox.
Container | A generic container.
GridView | A grid view.
ImageView | An image view.
ListView | A list view.
MenuBar | A menu bar.
MenuBarItem | A menu bar item.
MenuBarItemText | The text in a menu bar item.
MenuItem | A menu item.
MenuItemAtom | A menu atom item.
MenuItemSeparator | A menu separator item.
MenuItemSubmenu | A menu submenu item.
Menu | A menu.
MenuItemText | A menu item text.
Meter | A generic meter.
ScrollbarHorizontal | A horizontal scrollbar.
ScrollbarHorizontalTrack | A horizontal scrollbar track.
ScrollbarHorizontalButtonLeft | A horizontal scrollbar left button.
ScrollbarHorizontalButtonLeftIcon | A horizontal scrollbar left button icon.
ScrollbarHorizontalButtonRight | A horizontal scrollbar right button.
ScrollbarHorizontalButtonRightIcon | A horizontal scrollbar right button icon.
ScrollbarHorizontalButtonThumb | A horizontal scrollbar thumb button.
ScrollbarHorizontalButtonThumbIcon | A horizontal scrollbar thumb button icon.
ScrollbarVertical | A vertical scrollbar.
ScrollbarVerticalTrack | A vertical scrollbar track.
ScrollbarVerticalButtonUp | A vertical scrollbar up button.
ScrollbarVerticalButtonUpIcon | A vertical scrollbar up button icon.
ScrollbarVerticalButtonDown | A vertical scrollbar down button.
ScrollbarVerticalButtonDownIcon | A vertical scrollbar down button icon.
ScrollbarVerticalButtonThumb | A vertical scrollbar thumb button.
ScrollbarVerticalButtonThumbIcon | A vertical scrollbar thumb button icon.
ScrollPane | A scroll pane.
ScrollPaneContentArea | A scroll pane content area.
ScrollPaneContentAreaViewport | A scroll pane viewport.
TextArea | A text area.
TextField | A text field.
TextView | A text view.
TextMultilineView | A multi-line text view.
WindowButtonClose | The close button for a window.
WindowButtonCloseIcon | The close button icon for a window.
WindowButtonMaximize | The maximize button for a window.
WindowButtonMenu | The menu button for a window.
WindowContentArea | The content area for a window.
WindowResizeE | The east resize area for a window.
WindowResizeN | The north resize area for a window.
WindowResizeNE | The north-east resize area for a window.
WindowResizeNW | The north-west resize area for a window.
WindowResizeS | The south resize area for a window.
WindowResizeSE | The south-east resize area for a window.
WindowResizeSW | The south-west resize area for a window.
WindowResizeW | The west resize area for a window.
WindowRoot | The root component for a window.
WindowTitle | The title component for a window.
WindowTitleText | The title text component for a window.

2.6. Events
Previous
2. Model
Up
2.8. Coordinate Systems
Next
io7m | single-page | multi-page | JSycamore User Manual