From c8723d2a635abd383fbc64b4680fff27e48aca1a Mon Sep 17 00:00:00 2001 From: SpookyDervish Date: Mon, 27 Oct 2025 19:19:11 +1100 Subject: [PATCH] Add berry.ui --- berry.ui.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 berry.ui.md diff --git a/berry.ui.md b/berry.ui.md new file mode 100644 index 0000000..e073f13 --- /dev/null +++ b/berry.ui.md @@ -0,0 +1,57 @@ +Documentation for interfacing with the different UI functions. + +## notify +```lua +berry.ui.notify(message, title?, severity?, timeout?) +``` +Display a notification in the bottom right corner of the screen. +#### Parameters: +| Name | Type | Description | Default | +| --- | --- | --- | --- | +| `message` | `string` | The message to be displayed | *required* | +| `title` | `string` | The title to be displayed at the top of the notification. | `nil` | +| `severity` | `string` | The severity of the notification. Options: `information`, `warning`, `error` | `information` | +| `timeout` | `number` | How many seconds the notification will be on screen before automatically disappearing. | `5` | + +## createAction +```lua +berry.ui.createAction(actionName, func) +``` +Create an action and run a function whenever that action occurs in the UI. +#### Parameters: +| Name | Type | Description | Default | +| --- | --- | --- | --- | +| `actionName` | `string` | The name of the new action. You can override an existing action if you want. | *required* | +| `func` | `function` | The function to call when this action occurs. | *required* | + +## addBind +```lua +berry.ui.addBind(actionName, key, description, show?) +``` +Bind a key to an action. +#### Parameters: +| Name | Type | Description | Default | +| --- | --- | --- | --- | +| `actionName` | `string` | The name of the action you want to bind the key to. | *required* | +| `key` | `string` | The key to bind the action to. You can set this to things like `ctrl+f` or `ctrl+shift+t` to create key sequences. | *required* | +| `description` | `string` | The description to be shown at the bottom of the screen. Leave empty if you will set `show` to `false`. | *required* | +| `show` | `boolean` | Whether or not the show the keybind at the bottom of the screen. | `true` | + +## runAction +```lua +berry.ui.runAction(actionName) +``` +Run an action. +| Name | Type | Description | Default | +| --- | --- | --- | --- | +| `actionName` | `string` | The action to run. | *required* | + +## setTheme +```lua +berry.ui.setTheme(theme) +``` +Forcefully change the theme of the UI. +#### Parameters: +| Name | Type | Description | Default | +| --- | --- | --- | --- | +| `theme` | `string` | The name of the theme. | *required* |