ComfyUI-EBU-PromptHelper
A collection of custom nodes for ComfyUI designed to enhance and manipulate prompts for image generation. These can be very useful for constructing workflows that randomize a prompt along a theme to have a lot of variety from generation to generation without having to hand generate prompts.
These nodes provide a suite of utilities for generating random color palettes, modifying and randomizing text, sampling lists, loading file contents, formatting datetime strings, and even creating abstract weather descriptions along with a randomly generated year, season, and time of day.
These work great with LLM custom nodes like my ComfyUI_EBU_LMStudio package.
See the included workflow flux_example_ebu_prompthelper.json for usage examples.
Features
-
Random Color Palette Generation: Generate diverse color palettes from multiple types (analogous, art house, chaotic, complementary, compound, split complementary, tetradic, triadic) with options to prefer or avoid certain color families. Color families can be customized via
color_data.py. -
Prompt Text Replacement: Replace targeted substrings in prompts using customizable patterns. Multiple words can be specified with a delimiter (|).
-
Prompt Randomization: Randomly replace substrings in a prompt with options from a list. The list can be delimited by newlines, commas, or semi-colons.
-
String Combination: Combine two strings using a custom join string, with empty strings handled gracefully.
-
List Sampling and Consumption: Randomly sample items from a multi-line list with optional numbering, plus functionality to consume list items one at a time.
-
File Loading: Load the contents of a file as a string using UTF-8 encoding for easy prompt import and template management.
-
Current Date/Time Generation: Retrieve the current datetime in multiple formats, useful for timestamping or dynamic prompt generation.
-
Season, Weather, and Time-of-Day Generation: Generate abstract datetime and weather descriptions with advanced options for skewing the random selection of both year and time-of-day.
Installation
-
Copy Files: Place the entire
ComfyUI-EBU-PromptHelperdirectory into yourComfyUI/custom_nodes/directory. -
Dependencies:
- Ensure you have Python 3.11 or newer
- Make sure ComfyUI is installed and updated
-
Restart ComfyUI: After copying the files and verifying your dependencies, restart ComfyUI to load the custom nodes.
Nodes
EBU PromptHelper Random Color Palette
Generates random color palettes using several possible generation methods. One method is randomly chosen from the enabled options.
Inputs:
include_analogous_palettes(BOOLEAN): Include analogous palettesinclude_art_house_palettes(BOOLEAN): Include art house palettesinclude_chaotic_palettes(BOOLEAN): Include chaotic palettesinclude_complementary_palettes(BOOLEAN): Include complementary palettesinclude_compound_palettes(BOOLEAN): Include compound palettesinclude_split_complementary_palettes(BOOLEAN): Include split complementary palettesinclude_tetradic_palettes(BOOLEAN): Include tetradic palettesinclude_triadic_palettes(BOOLEAN): Include triadic palettespalette_size(STRING): "3 colors", "4 colors", or "5 colors"prefer_color_family(STRING): e.g., "None", "Reds", "Blues", etc.avoid_color_family(STRING): e.g., "None", "Neutrals", etc.seed(INT): Random seed (0 for non-deterministic)
Returns:
palette_string(STRING): Comma-separated color namescolor1...color5(STRING): Individual colorspalette_type(STRING): The palette method usedhex_values(STRING): Comma-separated hex codes
EBU PromptHelper Replace
Replaces occurrences of one or more target words in a prompt with a specified replacement string.
Inputs:
prompt_text(STRING): Input prompt textword_to_replace(STRING): Target word(s) to replace (use | as delimiter for multiple)replace_with(STRING): Replacement textcase_sensitive(BOOLEAN): Whether to match case when replacing
Returns:
updated_prompt_text(STRING): The modified prompt
EBU PromptHelper Randomize
Replaces a target substring with a randomly selected option from a list.
Inputs:
prompt_text(STRING): Input prompt textword_to_replace(STRING): Target substring to replacereplacement_options(STRING): List of possible replacementsrandom_seed(INT): Seed for random selectioncase_sensitive(BOOLEAN): Whether to match case when replacingdelimit_options_with(STRING): How to split options - "newlines", "commas", or "semi-colons"
Returns:
updated_prompt_text(STRING): The modified promptword_selected(STRING): The chosen replacement
EBU PromptHelper Combine Two Strings
Combines two strings using a specified join string.
Inputs:
str1(STRING): First stringstr2(STRING): Second stringjoin_str(STRING): String used to join (default: "\n\n")
Returns:
combined(STRING): The joined result
EBU PromptHelper List Sampler
Samples random items from a list, with optional numbering.
Inputs:
list(STRING): Newline-separated list of itemsseed(INT): Random seednumber_of_elements(INT, optional): Number of items to sample (default: 10)number_sampled_list(BOOLEAN): Whether to number the output list
Returns:
- (STRING): Sampled items as a newline-separated string
EBU PromptHelper Load File as String
Loads file contents as a string using UTF-8 encoding.
Inputs:
directory(STRING): File directory pathfile_name(STRING): Name of file to load
Returns:
- (STRING): File contents or empty string on error
EBU PromptHelper Current DateTime
Returns the current date/time in various formats.
Returns:
date(STRING): e.g., "February 10, 2025"time(STRING): e.g., "1:15pm"datetime(STRING): e.g., "2025-02-10 1:15:33pm"datetime_for_filename(STRING): e.g., "2025-02-10_13-15-33"
EBU PromptHelper Consume List Item
Selects and removes an item from a list while updating a prompt.
Inputs:
word_to_replace(STRING): Target substring to replacelist(STRING): Newline-separated list of optionsseed(INT): Random seedprompt_text(STRING, optional): Input prompt text
Returns:
updated_prompt_text(STRING): Modified promptword_selected(STRING): Selected list itemrevised_list(STRING): Remaining list items
EBU PromptHelper Season Weather Time-Of-Day
Generates random datetime and weather descriptions.
Inputs:
year_from(INT): Start yearyear_to(INT): End yeartime_from(STRING): Start time (e.g., "6:00am")time_to(STRING): End time (e.g., "7:00pm")random_seed(INT): Random seedyear_skew(STRING): How to bias year selectiontime_of_day_skew(STRING): How to bias time selection
Returns:
when(STRING): Full datetime description (e.g., "early morning during early winter of 2020")when_no_year(STRING): Description without year (e.g., "early morning during early winter")weather(STRING): Weather description
Requirements
- ComfyUI
- Python 3.11 or newer
License
This project is licensed under the MIT License. See the LICENSE file for details.
Acknowledgments
- Thank you to the ComfyUI team for all that you do!
- Thank you to the community making so many great custom nodes available, you've inspired me to try to do likewise.