Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
complete theme docs
Browse files Browse the repository at this point in the history
  • Loading branch information
brachy84 committed Oct 19, 2023
1 parent 0398f70 commit f0a7f10
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 2 deletions.
10 changes: 10 additions & 0 deletions docs/mod-wiki/modularui/framework.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,17 @@ This class has a lot of useful methods, too many to list them all. But you can t
to structure it and make it clean.

## WindowManager

Keeps track of all panels and the main panels. Handles opening and closing panels

## GuiSyncManager

Manages sync values. This is the only class (with `ModularContainer`) that exists on client and server side.

## GuiScreenWrapper

This is the minecraft `GuiContainer` class which wraps the `ModularScreen`. This is an internal class.

## ModularContainer

This is the minecraft `Container` class. This is an internal class.
2 changes: 1 addition & 1 deletion docs/mod-wiki/modularui/json/color.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The format is `AARRGGBB`. If `A` (alpha) is not set, it defaults to full opacity
!!! Example
```json
{
"color": "#FFFFFF"
"color": "#FFFFFF"
}
```

Expand Down
80 changes: 80 additions & 0 deletions docs/mod-wiki/modularui/json/drawable.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,83 @@ can also have any style property like `color` and `shadow`.
```

As you can see in the example above you can also start a string with `I18n:` to make it translated.

## Item

Type name: `item`

- `item`: The format is `mod:item_id:meta` where meta is optional
- `nbt`: nbt data (untested)

!!! Example
```json
{
"background": {
"type": "item",
"item": "minecraft:diamond"
}
}
```

## Icon

An icon is a drawable wrapper which can draw a drawable at a fixed size.

Type name: `icon`

Properties:

- `drawable` or `icon`: The wrapped drawable. (Required)
- `width` or `w`: The width to render the drawable at.
- `height` or `h`: The height to render the drawable at.
- `autoWidth` and `autoHeight`: True if the width/height should match the render size (how normal drawables work).
- `autoSize`: True if the width and height should match the render size (how normal drawables work). (Default is true)
- `alignment` or `align`: The alignment of the drawable in the render size. (see [alignment](alignment.md)) (default is center)

You can also set margins. But they only work if the width (for left and right) or the height (for top and bottom) is set to auto.
Multiple margins can be combined.

- `margin`: The margin on all edges
- `marginHorizontal` and `marginVertical`: The margin on horizontal (left and right) or vertical (top and bottom) edges
- `marginTop`, `marginBottom`, `marginLeft`, `marginRight`; The margin of each edge

!!! Example
```json
{
"background": {
"type": "icon",
"drawable": {
"type": "...",
"...": "..."
},
"width": 18,
"height": 18
}
}
```

## Drawable array

A drawable can also be multiple drawable. You can do that by using square brackets `[]` instead of curly brackets `{}`.
And inside there you just define multiple drawable objects

!!! Example
```json
{
"background": [
{
"type": "...",
"...": "..."
},
{
"type": "...",
"...": "..."
},
{
"type": "...",
"...": "..."
}

]
}
```
34 changes: 33 additions & 1 deletion docs/mod-wiki/modularui/json/theme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Make sure to check out [how to register themes](../themes.md).

Here we will take a look what the theme file can look like. If you are a mod developer you can directly translate to
Here we will take a look what the theme file can look like. If you are a mod developer you can directly translate it to
your `JsonBuilder`.

Let's look at an example. This is what the default vanilla theme as a json file would look like.
Expand Down Expand Up @@ -62,3 +62,35 @@ Let's look at an example. This is what the default vanilla theme as a json file
}
}
```

First we have the `parent` property. This defines the parent theme. If a theme does not define a widget theme, it will
be taken from its parent. If the `parent` property is not set, it defaults to `DEFAULT`, which is just the vanilla theme.

After that we have the `color`, `background`, `hoverBackground`, `textColor` and `textShadow` properties. These are
fallback properties of [widget themes](#widget-themes). You can put any properties that any widget theme can have here.
If a widget theme does not have said property it will fall back to the top level property if defined.

For `color` and `textColor` see [color](color.md). For `background` and `hoverBackground` see [drawables](drawable.md).

Next we have objects defined with the property name `panel`, `button`, `itemSlot`, `fluidSlot`, `textField` and `toggleButton`.
These are widget themes. These are all widget themes ModularUI provides. Addons may add more.

## Widget themes

Widgets which don't use one of the existing widget themes use the fallback properties.

All widget themes have the properties `color`, `background`, `hoverBackground`, `textColor` and `textShadow`. Which are
all mostly self-explanatory. `color` is applied additionally to the background (if possible).

The `itemSlot` and `fluidSlot` also have the `slotHoverColor`, which is just the rendered color when the slot is hovered.
Don't use full opacity here. Otherwise, you won't be able to see the item.

The `textField` theme has the `markedColor` property which is the marked text background.

The `toggleButton` has `selectedBackground`, `selectedHoverBackground` and `selectedColor` which are all self-explanatory.

!!! Note
All widget themes are optional. You can define as many as you like. Not defined widget themes will be taken from the
parent theme

All properties of widget themes (and the fallback properties) are optional.

0 comments on commit f0a7f10

Please sign in to comment.