HammeriteEditorTheme
Editor. Inherits RefCounted
What the editor looks like: one Theme every control in it inherits.
A level editor is read for hours at a time and its job is to leave room for the level, so the rules here are density first - small type, hairline rules, padding measured in single pixels - and one accent used only where the editor is telling the author what is live.
It is Hammerite's own look rather than the host game's. A game sets its menus and its HUD; this is the tool, and the two are allowed to disagree.
Applied by HammeriteMapEditor to itself, so everything under it inherits and a panel written by an addon gets it for free. A control that needs something else overrides that one thing rather than styling itself from scratch.
Sizes here are in the editor's own units: HammeriteEditorCanvas scales the whole editor to its UI scale, so a control that copies one into an override is scaled with everything else and must not scale it again.
Methods
| Returns | Method |
|---|---|
Color | accent() static |
Color | accent_sunk() static |
StyleBoxFlat | badge_style(fill: Color) static |
Color | canvas() static |
Color | danger() static |
Font | face() static |
Label | heading(text: String) static |
Color | line() static |
Color | line_bright() static |
TextureRect | logo(side: float) static |
Theme | make_theme() static |
Color | raised() static |
Color | surface() static |
Color | text() static |
Color | text_dim() static |
Color | text_faint() static |
Theme | theme() static |
Color | variant() static |
Color | warning() static |
Constants
GAP
const GAP = 4
Spacing between siblings in a box or grid container, and a panel's inner margin, in pixels.
GAP_SECTION
const GAP_SECTION = 6
Spacing between sections of a panel, in pixels: wider than GAP.
PAD_X
const PAD_X = 6
Padding, in whole pixels, because half of one is a blurred edge at this size.
PAD_Y
const PAD_Y = 3
Vertical padding inside a button or field; PAD_X is the horizontal.
ROW_HEIGHT
const ROW_HEIGHT = 20
Height in pixels of one row of chrome, such as a dock's title strip.
SIZE_DENSE
const SIZE_DENSE = 11
Type size in pixels for trees, lists, tabs, tooltips and text editors.
SIZE_HEADING
const SIZE_HEADING = 10
Type size in pixels for heading(), which sets its text in capitals.
SIZE_TEXT
const SIZE_TEXT = 12
Type size in pixels for labels, buttons, fields and menus: the theme's default.
Method descriptions
accent()
static func accent() -> Color
One accent, for what is live: the tool in hand, the focused field, the selected row. The viewport keeps its own colours for geometry - a selected brush is yellow in the world, and the chrome must not be saying yellow at the same time about something else.
accent_sunk()
static func accent_sunk() -> Color
The background of something live: a pressed button, a selected row or menu item, a slider's filled part.
badge_style()
static func badge_style(fill: Color) -> StyleBoxFlat
The StyleBoxFlat of a filled tag for a word the author must not miss, in fill.
canvas()
static func canvas() -> Color
Graphite, four steps, plus the black the viewports sit on. Cool rather than neutral: the 3D views are full of warm stone and lamplight, and the chrome should not compete with them.
danger()
static func danger() -> Color
What has gone wrong. Used by the status bar to say an error has just been written, where an author who is looking at the viewport rather than at the log will still catch it.
face()
static func face() -> Font
Inter, which core already carries for the 2D gizmo labels: the editor's typeface.
heading()
static func heading(text: String) -> Label
A section heading: small, dim and spaced out, so it reads as a label on a drawer rather than as a line of text somebody has to take in. text is shown in capitals; a new Label each call.
line()
static func line() -> Color
Hairline rules: separators, and the borders of fields, trees and lists.
line_bright()
static func line_bright() -> Color
Borders that have to stand off what is behind them - popups, tooltips, windows - and scrollbar grabbers.
logo()
static func logo(side: float) -> TextureRect
The Hammerite seal, side pixels square. A new TextureRect each call, for the caller to add and free.
make_theme()
static func make_theme() -> Theme
A copy of theme() for a caller to change without changing the editor's.
raised()
static func raised() -> Color
A button at rest, and the selected tab.
surface()
static func surface() -> Color
Panels, popup menus, dialogs, tab containers and disabled buttons.
text()
static func text() -> Color
Type: white is expensive at this size, so it is spent on the thing being read and nothing else.
text_dim()
static func text_dim() -> Color
Secondary text: headings, the menubar at rest, labels beside values.
text_faint()
static func text_faint() -> Color
Text that is there to be ignored: placeholders, disabled items, menu accelerators.
theme()
static func theme() -> Theme
The editor's theme, built on first call and shared afterwards: every caller gets the same Theme, so changing it changes the whole editor. To start one of your own from it, take make_theme().
variant()
static func variant() -> Color
Which variant of the map is being edited: the one thing that says which WORLD is on screen, so none of the colours above may say it - blue is the tool in hand, amber a warning, red an error.
warning()
static func warning() -> Color
Something the author should look at that is not yet an error, such as a map that cannot bake.