LayerStyle

2167
By chflame
Updated 15 days ago
View on GitHub →See Common Issues →

A set of nodes for ComfyUI that can composite layer and mask to achieve Photoshop like functionality.

Available Nodes

LayerUtility: NameToColor

LayerUtility: NameToColor Node Documentation

Overview

The LayerUtility: NameToColor node is a versatile tool within the ComfyUI environment, primarily designed to convert human-readable color names into their corresponding hexadecimal color codes. This node is especially useful for users who need to convert textual descriptions of colors into visual representations in their user interface designs.

Functionality

The LayerUtility: NameToColor node facilitates the conversion of color names into their respective color codes, allowing the creation of images in user-defined sizes using the color specified by the name. This node supports multiple color palettes.

Inputs

The LayerUtility: NameToColor node accepts the following inputs:

  • Color Name: The name of the color you wish to convert (e.g., "white"). This input is case-insensitive and defaults to "white" if not provided.

  • Palette: A selection from different predefined color palettes, such as XKCD, Wiki Color, Flux SDXL, CSS4, CSS3, and HTML4.

  • In Palette Only: A boolean option determining whether to restrict the search for the color name within the selected palette only.

  • Default Color: The default color (in hex code format) to use if the specified color name is not found within the chosen palette. Defaults to black (#000000).

  • Size: The size of the image to be created. Users may select from predefined sizes or choose a custom size.

  • Custom Width: The custom width of the image in pixels if 'custom' is selected as the size option. The default is 512 pixels.

  • Custom Height: The custom height of the image in pixels if 'custom' is selected as the size option. The default is 512 pixels.

  • Size As: An optional input to specify another image's size to match for the created image.

Outputs

The outputs generated by the LayerUtility: NameToColor node are:

  • Image: A visual representation of the specified color name, created as an image with the defined dimensions.

  • Color: The hex code of the color derived from the provided color name.

Usage in Workflows

The LayerUtility: NameToColor node is beneficial in various ComfyUI workflows where color conversion and visualization are required. For instance, it can be used to:

  • Easily generate background colors by specifying color names instead of exact hex codes.
  • Instantly visualize colors from color lists like CSS4 or XKCD.
  • Replace or augment existing images in workflows to highlight specific color requirements visually.
  • Aid users in transferring color references from textual descriptions to digital representations.

Special Features and Considerations

  • Dynamic Palette Search: If a color name is not found in the current palette and in palette only is disabled, the node searches across all available palettes for a match.

  • Approximate Matching: The node can find approximate matches if an exact color name isn't available, enhancing flexibility in color selection.

  • Flexible Sizing: Users can define custom image sizes or match sizes with existing images, providing versatility for diverse application needs.

  • Error Handling: If the color name isn't found in any palette, the node gracefully falls back to a user-defined default color, ensuring workflow continuity.

By providing these capabilities, the LayerUtility: NameToColor node serves as an essential tool for users needing to translate color names into visual formats within their ComfyUI projects.