Styles, Themes and Colors
Available since 0.1.0
Change how a screen looks. Storage colors on slots and gauges, tabs or buttons, your own sprites, whole themes and every color.
Out of the box, a machine screen looks like the screens of current tech mods: light gauges with level marks, slots outlined in their storage's color and side configuration tabs on the right edge. You can change any part of that, one widget at a time or for every screen at once.
There are three levels, from the smallest change to the biggest:
- a style changes one widget or one panel;
- the screen's colors change the colors of that screen;
- a theme changes the sprites and colors of every screen that uses it.
Styles
Add style to a widget or a panel. Every field is optional, so write only what you want to change:
{
"id": "output",
"type": "foundry_apparatus:item_slot",
"x": 116,
"y": 35,
"width": 18,
"height": 18,
"target_binding": "output",
"style": {
"highlight": "tint"
}
}A field the widget does not use is reported as an error (FA-SCH-004), so a typo never goes unnoticed.
Storage colors on slots and gauges
Slots and gauges show the color of their storage, so players can tell which storage a slot belongs to and match it with the side configuration. highlight chooses how:
| Value | What players see |
|---|---|
outline | A border in the storage's color, darker on the top and left edges like a slot's bevel. This is the default. |
tint | The inside of the slot or gauge colored with the storage's color, with a soft ring around it. |
none | No color: a plain slot or gauge. |
The color comes from storage_styles. While a player points at a storage's button, or configures that storage's sides, its slots and gauges are also lit up.
Buttons and tabs
variant changes the shape of panel_button and side_config_button:
| Value | What players see |
|---|---|
button | A raised button. This is the default. |
tab | A tab attached to the edge of the screen, like the side tabs of Thermal machines. It opens towards the side it sits on. |
{
"id": "water_tab",
"type": "foundry_apparatus:side_config_button",
"x": 0,
"y": 0,
"width": 24,
"height": 22,
"target_binding": "water_in",
"params": {
"panel": "sides"
},
"style": {
"variant": "tab"
}
}Side configuration buttons and tabs take their storage's color and show an icon for its kind (items, fluid or energy).
Your own sprites
Any part can use a sprite from your pack instead of the theme's:
| Field | Used by | Replaces |
|---|---|---|
sprite | every widget, panels | the frame, the base, the button or the panel background |
hover_sprite | buttons | the button while the mouse is over it |
selected_sprite | buttons | the button while its panel is open |
fill_sprite | resource_gauge, progress_bar | the filled part |
Gauges also take marks, the number of level marks (see Gauges of any size).
A sprite id like mypack:steel_slot points to the image assets/mypack/textures/gui/sprites/steel_slot.png in your pack folder. If the image is missing, the validator reports FA-COMPAT-002 and the screen uses the theme's sprite instead.
Sprites are ordinary Minecraft GUI sprites, so they can stretch, tile or keep their corners when resized. Put a .mcmeta file next to the image:
{
"gui": {
"scaling": {
"type": "nine_slice",
"width": 18,
"height": 18,
"border": 1
}
}
}nine_slice keeps a border of border pixels and stretches the middle; tile repeats the image; without the file the image is stretched.
Gauges of any size
A gauge can be any size and any look. Set width and height for its shape, sprite for its frame and fill_sprite for what fills it, and marks for how many level marks it has (0 for none; 3 by default, at the quarters). This makes a thin bar of green segments:
{
"id": "energy",
"type": "foundry_apparatus:resource_gauge",
"x": 160,
"y": 16,
"width": 8,
"height": 54,
"target_binding": "energy",
"style": {
"sprite": "mypack:thin_gauge",
"fill_sprite": "mypack:green_segments",
"marks": 0
}
}Give green_segments.png a tile scaling so the segments repeat instead of stretching.
Gauges can lie down too. Make the gauge wider than tall and set its direction to right (or left); the level marks follow the long side. This works for every gauge: energy, items, and any fluid tank, including a tank the machine fills itself:
{
"id": "steam",
"type": "foundry_apparatus:resource_gauge",
"x": 44,
"y": 62,
"width": 88,
"height": 10,
"target_binding": "steam_out",
"params": {
"direction": "right"
}
}The fill is cut as a rectangle in the gauge's direction, so round or curved gauges are not possible yet.
Panels without a background, or under the screen
Two style fields only exist on panels. frame: none draws no background, which is what you want for a panel that only holds tabs. depth: below draws the panel under the main panel instead of over it, so tabs that overlap the screen's edge look like they come out from under it:
{
"id": "tabs",
"show": "always",
"placement": "right",
"width": 24,
"height": 70,
"style": {
"frame": "none",
"depth": "below"
},
"widgets": []
}Colors
The screen's colors change the colors that are not part of a sprite. Every key is optional:
"colors": {
"storage_palette": ["#4c8bf5", "#f59f00", "#3bc9db"],
"energy": "#f2c94c",
"blocked_face": "#5a5a5a",
"mixed_face": "#d0d0d0",
"title": "#404040",
"focus_outline": "#ffffff",
"focus_fill": "#40ffffff",
"tint_opacity": 0.55,
"progress_fill": "#ffffff",
"status": {
"running": "#3fbf3f",
"paused": "#d8b030",
"errored": "#d03030",
"protected": "#9040c0",
"idle": "#7f7f7f"
}
}| Key | What it colors |
|---|---|
storage_palette | Storages without a color in storage_styles, in order (1 to 32 colors). |
energy | Energy storages without a color in storage_styles. |
blocked_face | Faces set to "blocked" in the side configuration. |
mixed_face | Faces that connect every storage of a kind (side_config_group: type). |
side_tab | The side configuration tab when there is only one (side_config_group: machine). |
mode_in, mode_out, mode_both | Faces set to input, output or both when there is only one tab (side_config_group: machine). |
title | The screen title and the "Inventory" label. |
focus_outline, focus_fill | The light on the storage a player points at. |
tint_opacity | How strong highlight: tint is, from 0 (invisible) to 1 (solid). The default is 0.55. |
progress_fill | Progress bars that are not the arrow. |
status | The status light, per machine state. |
Colors are #RRGGBB, or #AARRGGBB when you want transparency (#40ffffff is white at a quarter strength).
Because colors lives in the screen file, each machine can have its own colors: give the machine its own screen, or write the screen inside the machine file. Like everything in a screen file, colors change with /reload.
Themes
A theme changes every screen that names it. Point the screen at your theme:
"theme": "mypack:steel"A theme is a folder of sprites and an optional colors file in your pack:
foundry_apparatus/
assets/
mypack/
gui_themes/
steel.json
textures/
gui/
sprites/
steel/
slot.png
gauge.png
gauge.png.mcmeta
tab_right.pngEach part of a screen looks for the sprite <theme>/<part>, so mypack:steel plus slot is assets/mypack/textures/gui/sprites/steel/slot.png. A part your theme does not have comes from the default theme, so a theme can be as small as one image.
The colors file has the same keys as colors. A screen's own colors win over its theme's.
The parts of a theme
| Part | What it is |
|---|---|
panel | The background of panels without a background texture. |
slot | An item slot. |
outline | The storage color border (multiplied by the storage's color: white for the full color, gray for darker edges). |
gauge, gauge_mark | The empty gauge and its level marks. |
energy, item_bar | The filled part of energy and item gauges. Fluids use their own texture. |
progress, progress_full | The arrow, empty and full. |
button, button_hovered, button_selected | Raised buttons. |
tab_right, tab_left (plus _hovered and _selected) | Tabs on the right and left edges. |
face | A face in the side configuration (drawn in the storage's color). |
mode_in, mode_out, mode_both | The arrows on a face. |
icon_item, icon_fluid, icon_energy | The icon on a storage's button or tab. |
status | The status light (drawn in the state's color). |
Parts drawn in a color (outline, the tabs, face, status, and buttons of a storage) are multiplied by that color, so draw them in white and grays.
Resource packs can replace any of these images too, including the default theme's, which lives in assets/foundry_apparatus/textures/gui/sprites/default/.
What is next
Every style and color field is listed in the GUI reference.