> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Recraft Controls - ComfyUI 原生节点文档

> 为Recraft图像生成提供高级控制参数的节点

<img src="https://mintcdn.com/dripart/5003JSxULDwNImme/images/built-in-nodes/api_nodes/recraft/recraft-contorols.jpg?fit=max&auto=format&n=5003JSxULDwNImme&q=85&s=6c5b9b0c3f9e255975e9bca7d12a9d2b" alt="ComfyUI 原生 Recraft Controls 节点" width="1506" height="556" data-path="images/built-in-nodes/api_nodes/recraft/recraft-contorols.jpg" />

Recraft Controls 节点允许你定义一系列控制参数（如颜色和背景颜色指导），用于精确指导Recraft的图像生成过程。这个节点将多种控制输入整合为一个统一的控制对象。

## 参数说明

### 可选参数

| 参数                | 类型            | 说明          |
| ----------------- | ------------- | ----------- |
| colors            | Recraft Color | 用于生成图像的颜色控制 |
| background\_color | Recraft Color | 背景颜色控制      |

### 输出

| 输出                | 类型               | 说明                    |
| ----------------- | ---------------- | --------------------- |
| recraft\_controls | Recraft Controls | 控制配置对象，连接到Recraft生成节点 |

## 使用示例

<Card title="Recraft Text to Image 工作流示例" icon="book" href="/zh/tutorials/partner-nodes/recraft/recraft-text-to-image">
  Recraft Text to Image 工作流示例
</Card>

## 工作原理

节点处理流程:

1. 收集输入的控制参数（colors和background\_color）
2. 将这些参数整合到一个结构化的控制对象中
3. 输出此控制对象，可连接到各种Recraft生成节点

当连接到Recraft生成节点后，这些控制参数会影响AI的生成过程，使AI能够考虑多种因素，而不仅仅是文本提示的语义内容。如果配置了颜色输入，AI将尝试在生成的图像中合理地使用这些颜色。

## 源码参考

\[节点源码 (更新于2025-05-03)]

```python theme={null}
class RecraftControlsNode:
    """
    Create Recraft Controls for customizing Recraft generation.
    """

    RETURN_TYPES = (RecraftIO.CONTROLS,)
    RETURN_NAMES = ("recraft_controls",)
    DESCRIPTION = cleandoc(__doc__ or "")  # Handle potential None value
    FUNCTION = "create_controls"
    CATEGORY = "api node/image/Recraft"

    @classmethod
    def INPUT_TYPES(s):
        return {
            "required": {
            },
            "optional": {
                "colors": (RecraftIO.COLOR,),
                "background_color": (RecraftIO.COLOR,),
            }
        }

    def create_controls(self, colors: RecraftColorChain=None, background_color: RecraftColorChain=None):
        return (RecraftControls(colors=colors, background_color=background_color), )

```
