Skip to content

JSON Style

NebelFox edited this page Feb 21, 2022 · 5 revisions

A style object consists of key-value pairs, each setting a value to a specific style aspect. Supports inheritance!

{
    "option.prefix": "/",
    "dialogue.greeting": "Hi there!",
    "dialogue.farewell": "See ya!"
}

Aspect subgroups

Dots in aspect names mean informal division into subgroups. They could be gathered in a nested style object, so we can reformat the example above as follows:

{
    "option.prefix": "/",
    "dialogue": {
        "greeting": "Hi there!",
        "farewell": "See ya!"
    }
}

Note. In this example the "option.prefix" aspect could also be written as "option": {"prefix": "/"}, but there is no much sense of doing it for a single aspect from a group

All the aspects and their default values

{
    "dialogue": {
        "greeting": null,
        "prompt-indicator": "$ ",
        "semantic-separator": "\n",
        "farewell": null
    },
    "input": {
        "separator": " ",
        "quotes": "'\"`",
        "new-line-escape": "\\"
    },
    "help": {
        "lobby": {
            "title": null,
            "header": null,
            "footer": null
        },
        "namespace-member-format": "> {0} - {1}"
    },
    "option.prefix": "--"
}
  • dialogue:
    • greeting - printed at the start of a dialogue
    • prompt-indicator - printed just before any user input
    • semantic-separator - is used to separate blocks of text
    • farewell - printed when a dialogue is terminated
  • input:
    • separator - first character of the string value is used to split the input into individual tokens. The rest of the string is ignored
    • quotes - each character from the string value is treated as a quote, thus could be used for escaping. A quoted token is enclosed in the same character, so one quote-char could be used to escape another
    • new-line-escape - end an input with this string to continue the input at the next line (unlimited usage)
  • help:
    • lobby:
      • title - very top of the lobby help message
      • header - under the title, but above commands
      • footer - very bottom of the lobby message
    • namespace-member-format - format of each command in its containing namespace help message. {0} for command name, {1} for brief.
  • option: prefix - an argument, prefixed with it, is treated as an option.
Clone this wiki locally