Skip to content

Derma

Advanced UI rendering and interaction system for the Lilia framework.


Overview

The derma library provides comprehensive UI rendering and interaction functionality for the Lilia framework. It handles advanced drawing operations including rounded rectangles, circles, shadows, blur effects, and gradients using custom shaders. The library offers a fluent API for creating complex UI elements with smooth animations, color pickers, player selectors, and various input dialogs. It includes utility functions for text rendering with shadows and outlines, entity text display, and menu positioning. The library operates primarily on the client side and provides both low-level drawing functions and high-level UI components for creating modern, visually appealing interfaces.

lia.derma.dermaMenu()

Purpose

Opens a fresh `liaDermaMenu` at the current cursor position and tracks it in `lia.gui.menuDermaMenu`.

When Called

Use when you need a standard context menu for interaction options and want any previous one closed first.

Returns

Panel The newly created `liaDermaMenu` panel.

Example Usage

  local menu = lia.derma.dermaMenu()
  menu:AddOption("Say hi", function() chat.AddText("hi") end)
  menu:Open()

lia.derma.optionsMenu(rawOptions, config)

Purpose

Builds and shows the configurable options/interaction menu, filtering and categorising provided options before rendering buttons.

When Called

Use when presenting interaction, action, or custom options to the player, optionally tied to a targeted entity and network message.

Parameters

table rawOptions Option definitions keyed by id or stored in an array; entries can include `type`, `range`, `target`, `shouldShow`, `callback`, and `onSelect`.

table config Optional settings such as `mode` ("interaction", "action", or "custom"), `entity`, `netMsg`, `preFiltered`, `registryKey`, sizing fields, and behaviour toggles like `closeOnSelect`.

Returns

Panel|nil The created frame when options are available; otherwise nil.

Example Usage

  lia.derma.optionsMenu({
      greet = {type = "action", callback = function(client) chat.AddText(client, " waves") end}
  }, {mode = "action"})

lia.derma.interactionTooltip(rawOptions, config, mode, entity, title, closeKey, netMsg, preFiltered, emitHooks, registryKey, autoCloseDelay)

Purpose

Creates and displays a tooltip-style interaction menu similar to magic/item tooltips, with enhanced visual effects and modern styling.

When Called

Automatically called when opening player interaction (TAB) or personal actions (G) menus to provide a polished tooltip interface.

Parameters

table rawOptions Raw interaction/action options data from playerinteract system.

table config Configuration options including:

string mode "interaction", "action", or "custom"

Entity entity Target entity for interactions

string title Menu title override

number closeKey Key code to close menu

string netMsg Network message for server communication

boolean preFiltered Whether options are already filtered

boolean emitHooks Whether to trigger interaction hooks

string registryKey Key for GUI registry

number autoCloseDelay Auto-close timeout in seconds

Returns

Panel|nil The created tooltip panel, or nil if no valid options.

Example Usage

  -- Automatically called by lia.playerinteract.openMenu()
  -- Can also be called directly:
  local tooltip = lia.derma.interactionTooltip(interactions, {
      mode = "interaction",
      title = "Player Interactions",
      entity = targetPlayer
  })

lia.derma.requestColorPicker(func, colorStandard)

Purpose

Displays a modal color picker window that lets the user pick a hue and saturation/value, then returns the chosen color.

When Called

Use when you need the player to choose a color for a UI element or configuration field.

Parameters

function func Callback invoked with the selected Color when the user confirms.

Color colorStandard Optional starting color; defaults to white.

Example Usage

  lia.derma.requestColorPicker(function(col) print("Picked", col) end, Color(0, 200, 255))

lia.derma.radialMenu(options)

Purpose

Spawns a radial selection menu using `liaRadialPanel` and stores the reference on `lia.gui.menu_radial`.

When Called

Use for quick circular option pickers, such as pie-menu interactions.

Parameters

table options Table passed directly to `liaRadialPanel:Init`, defining each radial entry.

Returns

Panel The created `liaRadialPanel` instance.

Example Usage

  lia.derma.radialMenu({{label = "Yes", callback = function() print("yes") end}})

lia.derma.requestPlayerSelector(doClick)

Purpose

Opens a player selector window listing all connected players and runs a callback when one is chosen.

When Called

Use when an action needs the user to target a specific player from the current server list.

Parameters

function doClick Called with the selected player entity after the user clicks a card.

Returns

Panel The created selector frame stored on `lia.gui.menuPlayerSelector`.

Example Usage

  lia.derma.requestPlayerSelector(function(pl) chat.AddText("Selected ", pl:Name()) end)

lia.derma.draw(radius, x, y, w, h, col, flags)

Purpose

Draws a rounded rectangle using the shader-based derma pipeline with the same radius on every corner.

When Called

Use when rendering a simple rounded box with optional shape or blur flags.

Parameters

number radius Corner radius to apply to all corners.

number x X position of the box.

number y Y position of the box.

number w Width of the box.

number h Height of the box.

Color col optional Fill color; defaults to solid white if omitted.

number flags optional Optional bitmask using `lia.derma` flag constants (shape, blur, corner suppression).

Example Usage

  lia.derma.draw(8, 10, 10, 140, 48, Color(30, 30, 30, 220))

lia.derma.drawOutlined(radius, x, y, w, h, col, thickness, flags)

Purpose

Draws only the outline of a rounded rectangle with configurable thickness.

When Called

Use when you need a stroked rounded box while leaving the interior transparent.

Parameters

number radius Corner radius for all corners.

number x X position of the outline.

number y Y position of the outline.

number w Width of the outline box.

number h Height of the outline box.

Color col optional Outline color; defaults to white when nil.

number thickness optional Outline thickness in pixels; defaults to 1.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawOutlined(10, 20, 20, 180, 60, lia.color.theme.text, 2)

lia.derma.drawTexture(radius, x, y, w, h, col, texture, flags)

Purpose

Draws a rounded rectangle filled with the provided texture.

When Called

Use when you need a textured rounded box instead of a solid color.

Parameters

number radius Corner radius for all corners.

number x X position.

number y Y position.

number w Width.

number h Height.

Color col optional Modulation color for the texture; defaults to white.

ITexture texture Texture handle to apply to the rectangle.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  local tex = Material("vgui/gradient-u"):GetTexture("$basetexture")
  lia.derma.drawTexture(6, 50, 50, 128, 64, color_white, tex)

lia.derma.drawMaterial(radius, x, y, w, h, col, mat, flags)

Purpose

Convenience wrapper that draws a rounded rectangle using the base texture from a material.

When Called

Use when you have an `IMaterial` and want its base texture applied to a rounded box.

Parameters

number radius Corner radius for all corners.

number x X position.

number y Y position.

number w Width.

number h Height.

Color col optional Color modulation for the material.

IMaterial mat Material whose base texture will be drawn.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawMaterial(6, 80, 80, 100, 40, color_white, Material("vgui/gradient-d"))

lia.derma.drawCircle(x, y, radius, col, flags)

Purpose

Draws a filled circle using the rounded rectangle shader configured for circular output.

When Called

Use when you need a smooth circle without manually handling radii or shapes.

Parameters

number x Center X position.

number y Center Y position.

number radius Circle diameter; internally halved for corner radii.

Color col optional Fill color; defaults to white.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawCircle(100, 100, 48, Color(200, 80, 80, 255))

lia.derma.drawCircleOutlined(x, y, radius, col, thickness, flags)

Purpose

Draws only the outline of a circle with configurable thickness.

When Called

Use for circular strokes such as selection rings or markers.

Parameters

number x Center X position.

number y Center Y position.

number radius Circle diameter.

Color col optional Outline color.

number thickness optional Outline thickness; defaults to 1.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawCircleOutlined(200, 120, 40, lia.color.theme.accent, 2)

lia.derma.drawCircleTexture(x, y, radius, col, texture, flags)

Purpose

Draws a textured circle using a supplied texture handle.

When Called

Use when you want a circular render that uses a specific texture rather than a solid color.

Parameters

number x Center X position.

number y Center Y position.

number radius Circle diameter.

Color col optional Color modulation for the texture.

ITexture texture Texture handle to apply.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawCircleTexture(64, 64, 32, color_white, Material("icon16/star.png"):GetTexture("$basetexture"))

lia.derma.drawCircleMaterial(x, y, radius, col, mat, flags)

Purpose

Draws a textured circle using the base texture from an `IMaterial`.

When Called

Use when you have a material and need to render its base texture within a circular mask.

Parameters

number x Center X position.

number y Center Y position.

number radius Circle diameter.

Color col optional Color modulation for the material.

IMaterial mat Material whose base texture will be drawn.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawCircleMaterial(48, 48, 28, color_white, Material("vgui/gradient-l"))

lia.derma.drawBlur(x, y, w, h, flags, tl, Top, Top, tr, Top, Top, bl, Bottom, Bottom, br, Bottom, Bottom, thickness)

Purpose

Renders a blurred rounded shape using the blur shader while respecting per-corner radii and optional outline thickness.

When Called

Use to blur a rectangular region (or other supported shapes) without drawing a solid fill.

Parameters

number x X position of the blurred region.

number y Y position of the blurred region.

number w Width of the blurred region.

number h Height of the blurred region.

number flags optional Bitmask using `lia.derma` flags to control shape, blur, and disabled corners.

number tl optional Top-left radius override.

unknown Top left radius override.

unknown Top left radius override.

number tr optional Top-right radius override.

unknown Top right radius override.

unknown Top right radius override.

number bl optional Bottom-left radius override.

unknown Bottom left radius override.

unknown Bottom left radius override.

number br optional Bottom-right radius override.

unknown Bottom right radius override.

unknown Bottom right radius override.

number thickness optional Optional outline thickness for partial arcs.

Example Usage

  lia.derma.drawBlur(0, 0, 220, 80, lia.derma.BLUR, 12, 12, 12, 12)

lia.derma.drawShadowsEx(x, y, w, h, col, flags, tl, Top, Top, tr, Top, Top, bl, Bottom, Bottom, br, Bottom, Bottom, spread, intensity, thickness)

Purpose

Draws a configurable drop shadow behind a rounded shape, optionally using blur and manual color control.

When Called

Use when you want a soft shadow around a shape with fine control over radii, spread, intensity, and flags.

Parameters

number x X position of the shape casting the shadow.

number y Y position of the shape casting the shadow.

number w Width of the shape.

number h Height of the shape.

Color|boolean col optional Shadow color; pass `false` to skip color modulation.

number flags optional Bitmask using `lia.derma` flags (shape, blur, corner suppression).

number tl optional Top-left radius override.

unknown Top left radius override.

unknown Top left radius override.

number tr optional Top-right radius override.

unknown Top right radius override.

unknown Top right radius override.

number bl optional Bottom-left radius override.

unknown Bottom left radius override.

unknown Bottom left radius override.

number br optional Bottom-right radius override.

unknown Bottom right radius override.

unknown Bottom right radius override.

number spread optional Pixel spread of the shadow; defaults to 30.

number intensity optional Shadow alpha scaling; defaults to `spread * 1.2`.

number thickness optional Optional outline thickness when rendering arcs.

Example Usage

  lia.derma.drawShadowsEx(40, 40, 200, 80, Color(0, 0, 0, 180), nil, 12, 12, 12, 12, 26, 32)

lia.derma.drawShadows(radius, x, y, w, h, col, spread, intensity, flags)

Purpose

Convenience wrapper to draw a drop shadow with the same radius on every corner.

When Called

Use when you need a uniform-radius shadow without manually specifying each corner.

Parameters

number radius Radius applied to all corners.

number x X position.

number y Y position.

number w Width.

number h Height.

Color col optional Shadow color.

number spread optional Pixel spread of the shadow.

number intensity optional Shadow alpha scaling.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawShadows(10, 60, 60, 180, 70, Color(0, 0, 0, 150))

lia.derma.drawShadowsOutlined(radius, x, y, w, h, col, thickness, spread, intensity, flags)

Purpose

Convenience wrapper that draws only the shadow outline for a uniform-radius shape.

When Called

Use when you need a stroked shadow ring around a rounded box.

Parameters

number radius Radius applied to all corners.

number x X position.

number y Y position.

number w Width.

number h Height.

Color col optional Shadow color.

number thickness optional Outline thickness for the shadow.

number spread optional Pixel spread of the shadow.

number intensity optional Shadow alpha scaling.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawShadowsOutlined(12, 40, 40, 160, 60, Color(0, 0, 0, 180), 2)

lia.derma.rect(x, y, w, h)

Purpose

Starts a chainable rectangle draw builder using the derma shader helpers.

When Called

Use when you want to configure a rectangle (radius, color, outline, blur, etc.) through a fluent API before drawing.

Parameters

number x X position of the rectangle.

number y Y position of the rectangle.

number w Width of the rectangle.

number h Height of the rectangle.

Returns

table Chainable rectangle builder supporting methods like `:Rad`, `:Color`, `:Outline`, and `:Draw`.

Example Usage

  lia.derma.rect(12, 12, 220, 80):Rad(10):Color(Color(40, 40, 40, 220)):Shadow():Draw()

lia.derma.circle(x, y, r)

Purpose

Starts a chainable circle draw builder using the derma shader helpers.

When Called

Use when you want to configure a circle (color, outline, blur, etc.) before drawing it.

Parameters

number x Center X position.

number y Center Y position.

number r Circle diameter.

Returns

table Chainable circle builder supporting methods like `:Color`, `:Outline`, `:Shadow`, and `:Draw`.

Example Usage

  lia.derma.circle(100, 100, 50):Color(lia.color.theme.accent):Outline(2):Draw()

lia.derma.setFlag(flags, flag, bool)

Purpose

Sets or clears a specific drawing flag on a bitmask using a flag value or named constant.

When Called

Use when toggling derma drawing flags such as shapes or corner suppression.

Parameters

number flags Current flag bitmask.

number|string flag Flag value or key in `lia.derma` (e.g., "BLUR").

boolean bool Whether to enable (`true`) or disable (`false`) the flag.

Returns

number Updated flag bitmask.

Example Usage

  flags = lia.derma.setFlag(flags, "BLUR", true)

lia.derma.setDefaultShape(shape)

Purpose

Updates the default shape flag used by the draw helpers (rectangles and circles) when no explicit flag is provided.

When Called

Use to globally change the base rounding style (e.g., figma, iOS, circle) for subsequent draw calls.

Parameters

number shape Shape flag constant such as `lia.derma.SHAPE_FIGMA`; defaults to `SHAPE_FIGMA` when nil.

Example Usage

  lia.derma.setDefaultShape(lia.derma.SHAPE_IOS)

lia.derma.shadowText(text, font, x, y, colortext, colorshadow, dist, xalign, yalign)

Purpose

Draws text with a single offset shadow before the main text for lightweight legibility.

When Called

Use when you need a subtle shadow behind text without a full outline.

Parameters

string text Text to draw.

string font Font name.

number x X position.

number y Y position.

Color colortext Foreground text color.

Color colorshadow Shadow color.

number dist Pixel offset for both X and Y shadow directions.

number xalign Horizontal alignment (`TEXT_ALIGN_*`).

number yalign Vertical alignment (`TEXT_ALIGN_*`).

Example Usage

  lia.derma.shadowText("Hello", "LiliaFont.18", 200, 100, color_white, Color(0, 0, 0, 180), 1, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)

lia.derma.drawTextOutlined(text, font, x, y, colour, xalign, outlinewidth, outlinecolour)

Purpose

Draws text with a configurable outline by repeatedly rendering offset copies around the glyphs.

When Called

Use when you need high-contrast text that stays legible on varied backgrounds.

Parameters

string text Text to draw.

string font Font name.

number x X position.

number y Y position.

Color colour Main text color.

number xalign Horizontal alignment (`TEXT_ALIGN_*`).

number outlinewidth Total outline thickness in pixels.

Color outlinecolour Color applied to the outline renders.

Returns

number The value returned by `draw.DrawText` for the final text render.

Example Usage

  lia.derma.drawTextOutlined("Warning", "LiliaFont.16", 50, 50, color_white, TEXT_ALIGN_LEFT, 2, Color(0, 0, 0, 200))

lia.derma.drawTip(x, y, w, h, text, font, textCol, outlineCol)

Purpose

Draws a speech-bubble style tooltip with a triangular pointer and centered label.

When Called

Use for lightweight tooltip rendering when you need a callout pointing to a position.

Parameters

number x Left position of the bubble.

number y Top position of the bubble.

number w Bubble width.

number h Bubble height including pointer.

string text Text to display inside the bubble.

string font Font used for the text.

Color textCol Color of the label text.

Color outlineCol Color used to draw the bubble outline/fill.

Example Usage

  lia.derma.drawTip(300, 200, 160, 60, "Hint", "LiliaFont.16", color_white, Color(20, 20, 20, 220))

lia.derma.drawText(text, x, y, color, alignX, alignY, font, alpha)

Purpose

Draws text with a subtle shadow using `draw.TextShadow`, defaulting to common derma font and colors.

When Called

Use when rendering HUD/UI text that benefits from a small shadow for readability.

Parameters

string text Text to render.

number x X position.

number y Y position.

Color color optional Text color; defaults to white.

number alignX optional Horizontal alignment (`TEXT_ALIGN_*`), defaults to left.

number alignY optional Vertical alignment (`TEXT_ALIGN_*`), defaults to top.

string font optional Font name; defaults to `LiliaFont.16`.

number alpha optional Shadow alpha override; defaults to 57.5% of text alpha.

Returns

number Width returned by `draw.TextShadow`.

Example Usage

  lia.derma.drawText("Objective updated", 20, 20, lia.color.theme.text, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP)

lia.derma.drawBoxWithText(text, x, y, options)

Purpose

Renders a configurable blurred box with optional border and draws one or more text lines inside it.

When Called

Use for notification overlays, labels, or caption boxes that need automatic sizing and padding.

Parameters

string|table text Single string or table of lines to display.

number x Reference X coordinate.

number y Reference Y coordinate.

table options optional Customisation table supporting `font`, `textColor`, `backgroundColor`, `borderColor`, `borderRadius`, `borderThickness`, `padding`, `blur`, `textAlignX`, `textAlignY`, `autoSize`, `width`, `height`, and `lineSpacing`.

Returns

number, number The final box width and height.

Example Usage

  local w, h = lia.derma.drawBoxWithText("Saved", ScrW() * 0.5, 120, {textAlignX = TEXT_ALIGN_CENTER})

lia.derma.drawSurfaceTexture(material, color, x, y, w, h)

Purpose

Draws a textured rectangle using either a supplied material or a material path.

When Called

Use when you need to render a texture/material directly without rounded corners.

Parameters

IMaterial|string material Material instance or path to the material.

Color color optional Color modulation for the draw; defaults to white.

number x X position.

number y Y position.

number w Width.

number h Height.

Example Usage

  lia.derma.drawSurfaceTexture("vgui/gradient-l", color_white, 10, 10, 64, 64)

lia.derma.skinFunc(name, panel)

Purpose

Calls a named skin function on the panel's active skin (or the default skin) with the provided arguments.

When Called

Use to defer drawing or layout to the current Derma skin implementation.

Parameters

string name Skin function name to invoke.

Panel panel optional Target panel whose skin should be used; falls back to the default skin.

Returns

any Whatever the skin function returns, or nil if unavailable.

Example Usage

  lia.derma.skinFunc("PaintButton", someButton, w, h)

lia.derma.approachExp(current, target, speed, dt)

Purpose

Smoothly moves a value toward a target using an exponential approach based on delta time.

When Called

Use for UI animations or interpolations that should ease toward a target without overshoot.

Parameters

number current Current value.

number target Desired target value.

number speed Exponential speed factor.

number dt Frame delta time.

Returns

number The updated value after applying the exponential approach.

Example Usage

  scale = lia.derma.approachExp(scale, 1, 4, FrameTime())

lia.derma.easeOutCubic(t)

Purpose

Returns a cubic ease-out interpolation for values between 0 and 1.

When Called

Use for easing animations that should start quickly and slow toward the end.

Parameters

number t Normalized time between 0 and 1.

Returns

number Eased value.

Example Usage

  local eased = lia.derma.easeOutCubic(progress)

lia.derma.easeInOutCubic(t)

Purpose

Returns a cubic ease-in/ease-out interpolation for values between 0 and 1.

When Called

Use when you want acceleration at the start and deceleration at the end of an animation.

Parameters

number t Normalized time between 0 and 1.

Returns

number Eased value.

Example Usage

  local eased = lia.derma.easeInOutCubic(progress)

lia.derma.animateAppearance(panel, targetWidth, targetHeight, duration, alphaDuration, callback, scaleFactor)

Purpose

Animates a panel from a scaled, transparent state to a target size/position with exponential easing and optional callback.

When Called

Use to show panels with a smooth pop-in animation that scales and fades into place.

Parameters

Panel panel Panel to animate.

number targetWidth Final width.

number targetHeight Final height.

number duration optional Time in seconds for the size/position animation; defaults to 0.18s.

number alphaDuration optional Time in seconds for the fade animation; defaults to the duration.

function callback optional Called once the animation finishes.

number scaleFactor optional Starting scale factor relative to the final size; defaults to 0.8.

Example Usage

  local pnl = vgui.Create("DPanel")
  pnl:SetPos(100, 100)
  lia.derma.animateAppearance(pnl, 300, 200, 0.2, nil, function() pnl:SetMouseInputEnabled(true) end)

lia.derma.clampMenuPosition(panel)

Purpose

Repositions a panel so it remains within the visible screen area with a small padding.

When Called

Use after moving or resizing a popup to prevent it from clipping off-screen.

Parameters

Panel panel Panel to clamp.

Example Usage

  lia.derma.clampMenuPosition(myPanel)

lia.derma.drawGradient(x, y, w, h, direction, colorShadow, radius, flags)

Purpose

Draws a rectangular gradient using common VGUI gradient materials and optional rounding.

When Called

Use when you need a directional gradient fill without creating custom materials.

Parameters

number x X position.

number y Y position.

number w Width.

number h Height.

number direction Gradient index (1 = up, 2 = down, 3 = left, 4 = right).

Color colorShadow Color modulation for the gradient texture.

number radius optional Corner radius; defaults to 0.

number flags optional Optional bitmask using `lia.derma` flags.

Example Usage

  lia.derma.drawGradient(0, 0, 200, 40, 2, Color(0, 0, 0, 180), 6)

lia.derma.wrapText(text, width, font)

Purpose

Splits text into lines that fit within a maximum width using the specified font.

When Called

Use before rendering multi-line text to avoid manual word wrapping.

Parameters

string text Text to wrap.

number width Maximum line width in pixels.

string font optional Font to measure with; defaults to `LiliaFont.16`.

Returns

table, number A table of wrapped lines and the widest measured width.

Example Usage

  local lines, maxW = lia.derma.wrapText("Hello world", 180, "LiliaFont.16")

lia.derma.drawBlur(panel, amount, passes, alpha)

Purpose

Applies a screen-space blur behind the given panel by repeatedly sampling the blur material.

When Called

Use when you want a translucent blurred background behind a Derma panel.

Parameters

Panel panel Panel whose bounds define the blur area.

number amount optional Blur strength multiplier; defaults to 5.

number passes optional Number of blur passes; defaults to 0.2 steps up to 1.

number alpha optional Alpha applied to the blur draw; defaults to 255.

Example Usage

  lia.derma.drawBlur(myPanel, 4, 1, 200)

lia.derma.drawBlackBlur(panel, amount, passes, alpha, darkAlpha)

Purpose

Draws a blur behind a panel and overlays a dark tint to emphasize foreground elements.

When Called

Use for modal backdrops or to dim the UI behind dialogs.

Parameters

Panel panel Panel whose bounds define the blur and tint area.

number amount optional Blur strength; defaults to 6.

number passes optional Number of blur passes; defaults to 5.

number alpha optional Alpha applied to the blur draw; defaults to 255.

number darkAlpha optional Alpha of the dark overlay; defaults to 220.

Example Usage

  lia.derma.drawBlackBlur(myPanel, 8, 4, 255, 180)

lia.derma.drawBlurAt(x, y, w, h, amount, passes, alpha)

Purpose

Applies a blur effect to a specific screen-space rectangle defined by coordinates and size.

When Called

Use to blur a custom area of the screen that is not tied to a panel.

Parameters

number x X position of the blur rectangle.

number y Y position of the blur rectangle.

number w Width of the blur rectangle.

number h Height of the blur rectangle.

number amount optional Blur strength; defaults to 5.

number passes optional Number of blur passes; defaults to 0.2 steps up to 1.

number alpha optional Alpha applied to the blur draw; defaults to 255.

Example Usage

  lia.derma.drawBlurAt(100, 100, 200, 120, 6, 1, 180)

lia.derma.requestArguments(title, argTypes, onSubmit, defaults)

Purpose

Builds a dynamic argument entry form with typed controls and validates input before submission.

When Called

Use when a command or action requires the player to supply multiple typed arguments.

Parameters

string title optional Title text key; defaults to `"enterArguments"`.

table argTypes Ordered list or map describing fields; entries can be `"string"`, `"boolean"`, `"number"/"int"`, `"table"` (dropdown), or `"player"`, optionally with data and default values.

function onSubmit optional Callback receiving `(true, resultsTable)` on submit or `(false)` on cancel.

table defaults optional Default values keyed by field name.

Example Usage

  lia.derma.createTableUI("Players", {
      {name = "name", field = "name"},
      {name = "steamid", field = "steamid"}
  }, playerRows)

lia.derma.createTableUI(title, columns, data, options, charID)

Purpose

Builds a full-screen table UI with optional context actions, populating rows from provided data and column definitions.

When Called

Use when you need to display tabular data (e.g., admin lists) with right-click options and copy support.

Parameters

string title optional Title text key; defaults to localized table list title.

table columns Array of column definitions `{name = , field = , width = }`.

table data Array of row tables keyed by column fields.

table options optional Optional array of context menu option tables with `name`, `net`, and optional `ExtraFields`.

number charID optional Character identifier forwarded to network options.

Returns

Panel, Panel The created frame and the underlying `DListView`.

Example Usage

  lia.derma.createTableUI("Players", {
      {name = "name", field = "name"},
      {name = "steamid", field = "steamid"}
  }, playerRows)

lia.derma.openOptionsMenu(title, options)

Purpose

Opens a compact options window from either a keyed table or an array of `{name, callback}` entries.

When Called

Use for lightweight choice prompts where each option triggers a callback and then closes the window.

Parameters

string title optional Localized title text key; defaults to `"options"`.

table options Either an array of option tables `{name=, callback=}` or a map of `name -> callback`.

Returns

Panel The created options frame.

Example Usage

  lia.derma.openOptionsMenu("Actions", {
      {name = "Heal", callback = function() net.Start("Heal") net.SendToServer() end}
  })

lia.derma.drawEntText(ent, text, posY, alphaOverride)

Purpose

Draws floating text above an entity with distance-based fade and easing, caching per-entity scales.

When Called

Use to display labels or names above entities that appear when nearby.

Parameters

Entity ent Target entity to label.

string text Text to display.

number posY optional Vertical offset for the text; defaults to 0.

number alphaOverride optional Optional alpha multiplier or raw alpha value.

Example Usage

  hook.Add("PostDrawTranslucentRenderables", "DrawNames", function()
      for _, ent in ipairs(ents.FindByClass("npc_*")) do
          lia.derma.drawEntText(ent, ent:GetClass(), 0)
      end
  end)

lia.derma.requestDropdown(title, options, callback, defaultValue)

Purpose

Shows a modal dropdown prompt and returns the selected entry through a callback.

When Called

Use when you need the player to choose a single option from a list with optional default selection.

Parameters

string title optional Title text key; defaults to `"selectOption"`.

table options Array of options, either strings or `{text, data}` tables.

function callback optional Invoked with `selectedText` and optional `selectedData`, or `false` if cancelled.

any|table defaultValue optional Optional default selection value or `{text, data}` pair.

Returns

Panel The created dropdown frame.

Example Usage

  lia.derma.requestDropdown("Choose color", {"Red", "Green", "Blue"}, function(choice) print("Picked", choice) end)

lia.derma.requestString(title, description, callback, defaultValue, Pre, Pre, maxLength)

Purpose

Prompts the user for a single line of text with an optional description and default value.

When Called

Use for simple text input such as renaming or entering custom values.

Parameters

string title optional Title text key; defaults to `"enterText"`.

string description optional Helper text displayed above the entry field.

function callback optional Invoked with the entered string, or `false` when cancelled.

any defaultValue optional Pre-filled value for the input field.

unknown Pre filled value for the input field.

unknown Pre filled value for the input field.

number maxLength optional Optional character limit.

Returns

Panel The created input frame.

Example Usage

  lia.derma.requestString("Rename", "Enter a new name:", function(val) if val then print("New name", val) end end, "Default")

lia.derma.requestOptions(title, options, callback, defaults)

Purpose

Presents multiple selectable options, supporting dropdowns and checkboxes, and returns the chosen set.

When Called

Use for multi-field configuration prompts where each option can be a boolean or a list of choices.

Parameters

string title optional Title text key; defaults to `"selectOptions"`.

table options Array where each entry is either a value or `{display, data}` table; tables create dropdowns, values create checkboxes.

function callback optional Invoked with a table of selected values or `false` when cancelled.

table defaults optional Default selections; for dropdowns this can map option names to selected values.

Returns

Panel The created options frame.

Example Usage

  lia.derma.requestOptions("Permissions", {{"Rank", {"User", "Admin"}}, "CanKick"}, function(result) PrintTable(result) end)

lia.derma.requestBinaryQuestion(title, question, callback, yesText, noText)

Purpose

Displays a yes/no style modal dialog with customizable labels and forwards the response.

When Called

Use when you need explicit confirmation from the player before executing an action.

Parameters

string title optional Title text key; defaults to `"question"`.

string question optional Prompt text; defaults to `"areYouSure"`.

function callback optional Invoked with `true` for yes, `false` for no.

string yesText optional Custom text for the affirmative button; defaults to `"yes"`.

string noText optional Custom text for the negative button; defaults to `"no"`.

Returns

Panel The created dialog frame.

Example Usage

  lia.derma.requestBinaryQuestion("Confirm", "Delete item?", function(ok) if ok then print("Deleted") end end)

lia.derma.requestButtons(title, buttons, callback, description)

Purpose

Creates a dialog with a list of custom buttons and optional description, forwarding clicks to provided callbacks.

When Called

Use for multi-action prompts where each button can perform custom logic and optionally prevent auto-close by returning false.

Parameters

string title optional Title text key; defaults to `"selectOption"`.

table buttons Array of button definitions; each can be a string or a table with `text`, `callback`, and optional `icon`.

function callback optional Fallback invoked with `(index, buttonText)` when a button lacks its own callback; returning false keeps the dialog open.

string description optional Optional descriptive text shown above the buttons.

Returns

Panel, table The created frame and a table of created button panels.

Example Usage

  lia.derma.requestButtons("Choose action", {"Heal", "Damage"}, function(_, text) print("Pressed", text) end, "Pick an effect:")

lia.derma.requestPopupQuestion(question, buttons)

Purpose

Shows a small popup question with custom buttons, closing automatically unless a button callback prevents it.

When Called

Use for quick confirmation prompts that need more than a binary choice.

Parameters

string question optional Prompt text; defaults to `"areYouSure"`.

table buttons Array of button definitions; each can be a string or `{text, callback}` table.

Returns

Panel The created popup frame.

Example Usage

  lia.derma.requestPopupQuestion("Teleport where?", {{"City", function() net.Start("tp_city") net.SendToServer() end}, "Cancel"})