https://github.com/burnsbert/ComfyUI-EBU-PromptHelper
This ComfyUI extension provides a suite of custom nodes for enhancing and manipulating prompts. Features include random color palette generation, prompt text replacement, prompt randomization using variable names and lists of options, list sampling, file loading, current datetime formatting, and season/weather/time-of-day generation.
https://github.com/burnsbert/ComfyUI-EBU-PromptHelper
Last synced: 2 months ago
JSON representation
This ComfyUI extension provides a suite of custom nodes for enhancing and manipulating prompts. Features include random color palette generation, prompt text replacement, prompt randomization using variable names and lists of options, list sampling, file loading, current datetime formatting, and season/weather/time-of-day generation.
- Host: GitHub
- URL: https://github.com/burnsbert/ComfyUI-EBU-PromptHelper
- Owner: burnsbert
- License: mit
- Created: 2025-02-11T01:06:20.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-02-11T04:04:46.000Z (2 months ago)
- Last Synced: 2025-02-11T04:25:37.384Z (2 months ago)
- Language: Python
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-comfyui - **EBU PromptHelper** - of-day generation. (All Workflows Sorted by GitHub Stars)
README
# 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
1. **Copy Files:**
Place the entire `ComfyUI-EBU-PromptHelper` directory into your `ComfyUI/custom_nodes/` directory.2. **Dependencies:**
- Ensure you have Python 3.11 or newer
- Make sure ComfyUI is installed and updated3. **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 palettes
- `include_art_house_palettes` (BOOLEAN): Include art house palettes
- `include_chaotic_palettes` (BOOLEAN): Include chaotic palettes
- `include_complementary_palettes` (BOOLEAN): Include complementary palettes
- `include_compound_palettes` (BOOLEAN): Include compound palettes
- `include_split_complementary_palettes` (BOOLEAN): Include split complementary palettes
- `include_tetradic_palettes` (BOOLEAN): Include tetradic palettes
- `include_triadic_palettes` (BOOLEAN): Include triadic palettes
- `palette_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 names
- `color1` ... `color5` (STRING): Individual colors
- `palette_type` (STRING): The palette method used
- `hex_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 text
- `word_to_replace` (STRING): Target word(s) to replace (use | as delimiter for multiple)
- `replace_with` (STRING): Replacement text
- `case_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 text
- `word_to_replace` (STRING): Target substring to replace
- `replacement_options` (STRING): List of possible replacements
- `random_seed` (INT): Seed for random selection
- `case_sensitive` (BOOLEAN): Whether to match case when replacing
- `delimit_options_with` (STRING): How to split options - "newlines", "commas", or "semi-colons"**Returns:**
- `updated_prompt_text` (STRING): The modified prompt
- `word_selected` (STRING): The chosen replacement### EBU PromptHelper Combine Two Strings
Combines two strings using a specified join string.
**Inputs:**
- `str1` (STRING): First string
- `str2` (STRING): Second string
- `join_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 items
- `seed` (INT): Random seed
- `number_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 path
- `file_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 replace
- `list` (STRING): Newline-separated list of options
- `seed` (INT): Random seed
- `prompt_text` (STRING, optional): Input prompt text**Returns:**
- `updated_prompt_text` (STRING): Modified prompt
- `word_selected` (STRING): Selected list item
- `revised_list` (STRING): Remaining list items### EBU PromptHelper Season Weather Time-Of-Day
Generates random datetime and weather descriptions.
**Inputs:**
- `year_from` (INT): Start year
- `year_to` (INT): End year
- `time_from` (STRING): Start time (e.g., "6:00am")
- `time_to` (STRING): End time (e.g., "7:00pm")
- `random_seed` (INT): Random seed
- `year_skew` (STRING): How to bias year selection
- `time_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](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.