Files
Basalt/docs/objects/Textfield/addRule.md
Robert Jelic 4d614372a1 Updated docs
There is still stuff to do
2022-08-28 18:18:26 +02:00

627 B

addRule

Adds a new rule for special coloring

Parameteres:

  1. string a pattern - check out this page: (https://riptutorial.com/lua/example/20315/lua-pattern-matching)
  2. number|color text color
  3. number|color background color - optional

Returns:

  1. object The object in use

Usage:

  • Changes the color of all numbers
local mainFrame = basalt.createFrame()
local aTextfield = mainFrame:addTextfield():addRule("%d", colors.lightBlue)
<textfield>
    <rules>
        <rule>
            <pattern>%d</pattern>
            <fg>lightBlue</fg>
        </rule>
    </rules>
</textfield>