Skip to content

Styles

Styles are a powerful SD.Next feature that can apply reusable changes to generation settings:

  • Prompt: both positive and negative
  • Parameters: all generation parameters
  • Wildcards

image

Note

Style wildcards are separate from standard wildcards, and both can be used together.

Styles can be selected through Networks -> Styles, or from the shortcut combo box below the Generate buttons.

You can select any number of styles, and they are applied in selection order.

Each style is a separate JSON file that can be edited manually or via UI. Set style location in Settings -> System Paths -> Styles folder. Default path: models\styles.

Tip

Button ↶ "Apply selected style to prompt" will apply currently selected styles to current prompt as-is and remove style from being applied during runtime

[!TIP] Button ↷ "Save current prompt to style" will simply save current prompt to named style. Such style can be later edited for more fine-tuning

Migration

Legacy A1111 styles use a single CSV file, and SD.Next can migrate them to JSON. Set the full CSV path in Settings -> System Paths -> Styles and restart the server. SD.Next migrates discovered styles into individual JSON files.

Prompt

The style prompt either replaces the {prompt} placeholder in the current prompt, or is appended to the end when no placeholder is present.

Example:

"national geographic style photo shot on sony a7 camera"

Parameters

In addition to prompt text, a style can define generation parameters. Parameters are comma-separated key-value pairs using :.

Note

Recognized parameters are all parameters that can be typically found in image metadata,
but they can also include any generation parameters and any server settings.

Example:

Model: PrometheusV1, Size: 1152x864, Sampler: DPM++ 2M SDE, CFG scale: 5, Steps: 30, Seed: 3849770518, Refine: True, Hires: True, Refiner steps: 20, hr_upscaler: ESRGAN 4x NMKD Siax, hr_scale: 1.5, hr_denoising_strength: 0.3, save_to_dirs: True

Wildcards

Both prompt and parameters can be modified using the style wildcards section. Wildcards are key-value pairs using =. Multiple wildcard entries are separated by ;.

Example#1:

Prompt: "a woman wearing a {color} dress"
Wildcard: "{color}=red, green, blue"

Example#2:

Prompt: "{style} a woman wearing a {color} dress"
Wildcard: "{style}=photo, sketch, painting; {color}=red, green, blue"

Example#3:

Parameters: "Size: {size}"
Wildcard: "{size}=1024x1024, 1024x768, 768x1024, 1280x720, 720x1280, 1536x640"

JSON

Structure of the style is a simple JSON object:

{
  "name": "Cute Robot",
  "description": "This is a style of a random cute robot",
  "prompt": "photo of a cute {color} robot, walking {where} with {background} visible in background",
  "negative": "",
  "extra": "Size: {size}",
  "wildcards": "
    {color}=blue, red, rusty, silver, cyan;
    {where}=on alien planet, in rainforest, in the city street;
    {background}=rocks and mountains, moon and planets, spaceship, battle;
    {size}=1024x1024, 1280x720, 720x1280"
}

Validation

Styles use will be logged in the standard log with debug level:

DEBUG Applying style: name="mine/Cute Robot" extra=[] skipped=[] reference=False
DEBUG Wildcards applied: {'{color}': 'red', '{what}': 'water', '{background}': 'moon and planets'} path="/mnt/models/wildcards" type=style time=0.00