Jump to content
Toggle menu
  • 1 articles
  • 7 files
  • 3 users
  • 102 edits
Shroudforge
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:BadgeLua/doc: Difference between revisions

From Shroudforge
starcitizen>Alistar Bot
Sync from Git (d69195e) (via update-page on MediaWiki MCP Server)
 
m 1 revision imported: Import Star Citizen Modules
 
(No difference)

Latest revision as of 22:22, 4 November 2026

Documentation subpage
<details class="t-mbox t-mbox--notice navigation-not-searchable noexcerpt t-dependencies" open="no"><summary class="t-mbox__header">Technical detailswiki-tools · uses 5</summary>
Source
Synced with wiki-tools on GitHub
Used by
Unavailable: looking up the pages that use it failed on this render. Purge the page to retry.
Functions
</details>
{{#seo:

|type = website |description = Module:BadgeLua/doc is a template page used on the Star Citizen Wiki. Templates are pages that are embedded (transcluded) into other pages to allow for the repetition of information. |site_name = Star Citizen Wiki |locale = en-gb }}

Lua interface for an inline pill-shaped badge, with an optional icon, custom text color, and custom background. Suited to status tags, version markers, or any short metadata that should read as a distinct chip rather than plain text.

Editors use this through {{Badge}}; see Template:Badge. Required directly by several rendering modules, including Module:Rarity, Module:DietaryEffect, and Module:Entity/ProductionStatus.

For module editors

API

  • p.render(props): builds and returns the badge markup plus its bundled <templatestyles> tags. props: text (required), variant (error/success/warning), icon (file name, rendered via Module:Icon at 16px), mask (render the icon as a currentColor mask instead of a thumbnail), link (wrap the whole pill in one anchor), color/backgroundColor (inline CSS overrides), class.
  • p.main(frame): wikitext entry point behind {{Badge}}. Reads args via Module:Arguments; the first positional argument becomes text, and bg is a shorthand for backgroundColor (an explicit backgroundColor= wins). mask is normalised through Module:Yesno.

Gotchas

  • An unrecognised variant is silently ignored, so a typo never emits a broken half-styled class.
  • color/backgroundColor render as inline styles, so they win over the variant class for text and background color, but a variant's border color has no inline counterpart and stays whatever the class set.
  • Icon's own <templatestyles> tag is appended only when icon is set, so a plain text badge doesn't load it unconditionally.
  • link wraps the already-rendered pill string in [[Target|…]]; the <templatestyles> tags stay outside the link label.

Styles

.t-badge, .t-badge__icon, and .t-badge__text are a contract other code targets directly rather than through props: Module:Rarity and Module:Entity/ProductionStatus override the base look with higher-specificity selectors (.t-badge.rarity-badge--*), and the aggridRenderers gadget (MediaWiki:Gadget-aggridRenderers.js/.css) reconstructs the same class names in JS so an AG Grid badge cell matches a wikitext one. Renaming a class here breaks all of them silently.