Module TextFormatter
Stand alone text formatter object.
Remembers the options you set and can be adjusted as needed
Functions
setType (typeToSet) | Set's the formatting type whether it's for cecho, decho, or hecho |
setWrap (shouldWrap) | Sets whether or not we should do word wrapping. |
setWidth (width) | Sets the width we should format for |
setCap (cap) | Sets the cap for the formatter |
setCapColor (capColor) | Sets the color for the format cap |
setSpacerColor (spacerColor) | Sets the color for spacing character |
setTextColor (textColor) | Sets the color for formatted text |
setSpacer (spacer) | Sets the spacing character to use. |
setAlignment (alignment) | Set the alignment to format for |
setInside (spacerInside) | Set whether the the spacer should go inside the the cap or outside of it |
setMirror (shouldMirror) | Set whether we should mirror/reverse the caps. |
format (str) | Format a string based on the stored options |
new (options) | Creates and returns a new TextFormatter. |
Functions
- setType (typeToSet)
-
Set's the formatting type whether it's for cecho, decho, or hecho
Parameters:
- typeToSet string What type of formatter is this? Valid options are { 'd', 'dec', 'decimal', 'h', 'hex', 'hexidecimal', 'c', 'color', 'colour', 'col', 'name'}
- setWrap (shouldWrap)
-
Sets whether or not we should do word wrapping.
Parameters:
- shouldWrap boolean should we do wordwrapping?
- setWidth (width)
-
Sets the width we should format for
Parameters:
- width number the width we should format for
- setCap (cap)
-
Sets the cap for the formatter
Parameters:
- cap string the string to use for capping the formatted string.
- setCapColor (capColor)
-
Sets the color for the format cap
Parameters:
- capColor string Color which can be formatted via Geyser.Color.parse()
- setSpacerColor (spacerColor)
-
Sets the color for spacing character
Parameters:
- spacerColor string Color which can be formatted via Geyser.Color.parse()
- setTextColor (textColor)
-
Sets the color for formatted text
Parameters:
- textColor string Color which can be formatted via Geyser.Color.parse()
- setSpacer (spacer)
-
Sets the spacing character to use. Should be a single character
Parameters:
- spacer string the character to use for spacing
- setAlignment (alignment)
-
Set the alignment to format for
Parameters:
- alignment string How to align the formatted string. Valid options are 'left', 'right', or 'center'
- setInside (spacerInside)
-
Set whether the the spacer should go inside the the cap or outside of it
Parameters:
- spacerInside boolean
- setMirror (shouldMirror)
-
Set whether we should mirror/reverse the caps. IE << becomes >> if set to true
Parameters:
- shouldMirror boolean
- format (str)
-
Format a string based on the stored options
Parameters:
- str string The string to format
- new (options)
-
Creates and returns a new TextFormatter. For valid options, please see https://github.com/demonnic/fText/wiki/fText
Parameters:
- options table the options for the text formatter to use when running format()