HSP美学
一个MCP服务器,将HSV(色调、饱和度、值)颜色参数映射到丰富的美学词汇表中,实现确定性颜色理论正确的调色板生成和图像生成提示的语义颜色增强。
概述
HSP美学通过以下方式连接数学和感官体验:
- 提取颜色意图 来自自然语言提示
- 生成色彩理论正确的调色板 利用调和关系
- 将HSV值映射到美学词汇 (情绪、温度、材料、时代、能量)
- 实现确定性色彩合成 没有LLM令牌
其结果是一个系统的框架,在这个框架中,颜色选择在数学上是连贯的,在语义上是富有表现力的,并且是可重复的。
核心工具
extract_color_intent
解析自然语言中与颜色相关的关键字,并映射到HSV值。
extract_color_intent(text: str) → Dict退货:
primary_hsv:{h,s,v}代表主色semantic_tags:匹配的颜色关键字mood:总体情绪描述符detected_conflicts:相互矛盾的关键词(例如,“冷静精力充沛”)temperature:“温暖”或“凉爽”
例子:
extract_color_intent("A calm, warm, earthy composition with hints of rust")
# Returns:
# primary_hsv: {h: 25, s: 65, v: 60}
# semantic_tags: ["calm", "warm", "earthy", "rust"]
# mood: "contemplative, grounded"
# temperature: "warm"______________________________________________________________________
generate_harmony_palette
使用调和关系从基础HSV创建颜色理论校正调色板。
generate_harmony_palette(
base_hue: float, # 0-360°
base_saturation: float, # 0-100%
base_value: float, # 0-100%
harmony_type: str = "complementary",
palette_size: int = 5
) → Dict和谐类型:
complementary:底色+相反色调(180°)analogous:基础+相邻色调(±30°)triadic:基础色+两种相距120°的色调split_complementary:底色+两侧两种色调互补tetradic_rectangle:矩形排列的四种色调tetradic_square:四种色调,间隔90°monochromatic:单一色调,不同饱和度/值
退货:
colors:{h、s、v、十六进制、角色}字典列表harmony_type:应用和谐contrast_ratios:关键颜色之间的对比度accessibility:WCAG合规级别(AAA、AA或失败)
例子:
generate_harmony_palette(
base_hue=210,
base_saturation=70,
base_value=50,
harmony_type="triadic",
palette_size=5
)
# Returns 5-color palette with mathematical harmony______________________________________________________________________
hsv_to_aesthetic_descriptors
将HSV值映射到多个维度的丰富美学词汇表中。
hsv_to_aesthetic_descriptors(
hue: float, # 0-360°
saturation: float, # 0-100%
value: float # 0-100%
) → Dict退货:
color_name:人类可读名称temperature:“温暖”或“凉爽”mood_descriptors:情绪关键词列表energy_level:“低”、“中等”、“高”、“极端”era_associations:时间段关联material_suggestions:材料类型(金属、织物、陶瓷等)lighting_quality:照明特性(粗糙、柔和、金色等)texture_suggestions:纹理类型(光滑、粗糙、风化等)
例子:
hsv_to_aesthetic_descriptors(hue=25, saturation=65, value=60)
# Returns:
# color_name: "Burnt Sienna"
# temperature: "warm"
# mood_descriptors: ["nostalgic", "earthy", "contemplative"]
# energy_level: "moderate"
# era_associations: ["1970s", "art deco", "mid-century"]
# material_suggestions: ["ceramic", "leather", "clay", "weathered wood"]
# lighting_quality: "golden hour, soft ambient"
# texture_suggestions: ["matte", "weathered", "tactile"]______________________________________________________________________
list_available_harmonies
列出所有和谐类型及其描述和用例。
list_available_harmonies() → Dict退货: 具有特征的和谐类型以及何时使用每种类型
______________________________________________________________________
suggest_palette_from_mood
从情绪描述中建议最佳HSV基值和和声类型。
suggest_palette_from_mood(
mood: str, # e.g., "calm", "energetic", "mysterious"
intensity: str = "moderate" # "subtle", "moderate", "strong"
) → Dict退货:
suggested_base_hue:最佳色调suggested_base_saturation:最佳饱和度suggested_base_value:最佳值/亮度suggested_harmony_type:推荐和谐reasoning:建议说明
例子:
suggest_palette_from_mood(mood="mysterious", intensity="strong")
# Returns suggestions for deep, saturated purples/blacks
# with split-complementary harmony for tension______________________________________________________________________
色调到情绪映射
服务器维护色调范围和美学维度之间的确定性关联:
| 色调范围 | 原色 | 温度 | 情绪关联 | 能量水平 |
|---|---|---|---|---|
| 0-30° | 红色、橙色 | 温暖 | 充满活力、激情、紧迫 | 高 |
| 30-60° | 黄色、金色 | 温暖 | 乐观、开朗、怀旧 | 中等偏高 |
| 60-120° | 绿色、石灰色 | 中性凉爽 | 自然、平静、以生长为导向 | 低至中等 |
| 120-180° | 青色、青色 | 凉爽 | 宁静、冥想、空灵 | 低 |
| 180-240° | 蓝色、靛蓝色 | 凉爽 | 沉思、忧郁、权威 | 低-中度 |
| 240-300° | 紫色、紫罗兰色 | 冷暖 | 神秘、奢华、内省 | 适中 |
| 300-360° | 洋红色、粉色 | 温暖 | 浪漫、俏皮、富有表现力 | 中高 |
饱和度到字符映射
| 饱和度 | 字符 | 用例 | 视觉效果 |
|---|---|---|---|
| 0-20% | 不饱和、静音 | 怀旧、风化、极简 | 安静、内敛、衰老 |
| 20-40% | 柔和饱和 | 优雅、精致、复古 | 温和、精致 |
| 40-60% | 中等饱和度 | 自然、平衡、逼真 | 生动但脚踏实地 |
| 60-80% | 丰富饱和 | 大胆、戏剧性、艺术性 | 富有表现力、引人注目 |
| 80-100% | 高度饱和 | 纯净、强烈、数字化 | 极端,有时是人工的 |
值到亮度映射
| 价值 | 特性 | 用例 | 视觉效果 |
|---|---|---|---|
| 0-20% | 非常暗 | 阴影、深度、神秘 | 戏剧性、夜间、隐藏 |
| 20-40% | 深色 | 接地、厚重、严肃 | 略显厚重、正式 |
| 40-60% | 中等 | 平衡、可访问、标准 | 中性参考点 |
| 60-80% | 明亮 | 明亮、乐观、可见 | 充满活力、清晰、突出 |
| 80-100% | 非常明亮 | 高光、纯净、超凡脱俗 | 超凡脱俗,几乎无关紧要 |
工作流模式
模式1:情绪→ 调色板
User intent: "Create a calm, sophisticated palette"
↓
suggest_palette_from_mood(mood="calm", intensity="moderate")
↓
generate_harmony_palette(base_hue=..., harmony_type=...)
↓
Extract hex values for use in image generation模式2:提示→ 增强色彩
User prompt: "A melancholic autumn scene with golden light"
↓
extract_color_intent(text=prompt)
↓
hsv_to_aesthetic_descriptors(hue=..., saturation=..., value=...)
↓
Synthesize color vocabulary into enhanced prompt模式3:颜色分析→ 美学描述
Reference image with dominant colors
↓
Extract dominant HSV values
↓
hsv_to_aesthetic_descriptors()
↓
Map to mood/era/material descriptors
↓
Use as aesthetic anchors for new compositions关键概念
色温
- 温暖 (红色、橙色、黄色):0-60°和300-360°——与能量、激情、温暖有关
- 太酷了! (绿色、青色、蓝色、紫色):60-300°——与平静、沉思、距离有关
对比度
服务器计算调色板颜色之间的WCAG对比度:
- AAA:高对比度,包括色盲观众在内的所有人都可以观看
- AA:大多数用途可接受的对比度
- 失败:对比度不足,难以辨认
色彩和谐
在美学上连贯的色调之间的数学关系:
- 互补的:最大视觉张力,高对比度
- 类似的:和谐、相邻、自然流动
- 三元:平衡、充满活力、复杂
- 单色:统一、精致、冥想
实际案例
示例1:生成复杂的调色板
# Extract intent from natural language
intent = extract_color_intent(
"A sophisticated, vintage palette with warm undertones and subtle grays"
)
# primary_hsv: {h: 30, s: 50, v: 55}
# Generate harmonious palette
palette = generate_harmony_palette(
base_hue=intent["primary_hsv"]["h"],
base_saturation=intent["primary_hsv"]["s"],
base_value=intent["primary_hsv"]["v"],
harmony_type="analogous",
palette_size=6
)
# Returns 6 colors: warm tan, muted gold, sage, gray-taupe, cream, charcoal示例2:基于情绪的调色板
# Get suggestions for a specific mood
mood_suggestion = suggest_palette_from_mood(
mood="mysterious",
intensity="strong"
)
# Suggests deep indigo (h: 260, s: 80, v: 30) with split-complementary
# Generate palette from suggestions
palette = generate_harmony_palette(
base_hue=mood_suggestion["suggested_base_hue"],
base_saturation=mood_suggestion["suggested_base_saturation"],
base_value=mood_suggestion["suggested_base_value"],
harmony_type=mood_suggestion["suggested_harmony_type"],
palette_size=5
)示例3:颜色分析
# Analyze a specific color
descriptors = hsv_to_aesthetic_descriptors(
hue=210,
saturation=40,
value=70
)
# Returns:
# color_name: "Soft Sky Blue"
# mood_descriptors: ["serene", "ethereal", "contemplative", "peaceful"]
# era_associations: ["minimalist contemporary", "Scandinavian design"]
# material_suggestions: ["ceramic", "linen", "frosted glass"]
# lighting_quality: "soft diffused light, early morning"性能特征
| 操作 | 成本 | 速度 |
|---|---|---|
| 意图提取 | $0 | \<50ms |
| 调色板生成 | $0 | \<100ms |
| HSV到描述符 | $0 | \<50ms |
| 情绪建议 | 0美元 | \<100ms |
所有操作都是确定性的,无需成本。
与其他系统集成
HSP美学与以下元素自然融合:
- 图像生成提示:使用调色板提取将颜色理论中的提示背景化
- 语义编码美学:从参考图像中提取调色板
- 杂志摄影色彩理论指导摄影美学选择
- 诗歌视觉风格:调色板生成支持特定样式的颜色选择
- 驾驶舱设计:颜色标准遵循基于HSV的规范
设计理念
HSP美学基于以下原则运作 数学严谨性 和 语义连贯:
- 颜色理论是确定性的 --调和关系遵循既定的数学规则
- HSV坐标映射到感知 --色调、饱和度和值对应于人类的颜色体验
- 语义学源于数学 --从色彩属性出发,情绪和时代联想是合乎逻辑的
- 组合需要约束 --锁定参数可防止不连贯的颜色选择
无障碍
所有调色板都包括WCAG对比度分析:
- 在关键环境中使用前检查可访问性
- 在颜色用例上标记文本对比度不足
- 为色盲友好的构图提出替代方案
参考文献
- HSV颜色模型: 维基百科
- 色彩和谐理论: 艺术理论
- WCAG对比度指南: W3C可访问性
- 感知颜色空间: 孟塞尔和CIELAB
将来的扩展
- 感知均匀性:将HSV映射到CIELAB,以获得更准确的感知间距
- 色盲模拟:为不同的色觉缺陷生成可访问的变体
- 文化色彩语义学:情绪联想因文化背景而异
- 特定材料调色板:优化特定材料(屏幕、印刷、物理介质)的调色板
- 时间调色板演变:跟踪历史时期调色板的变化
许可证
麻省理工学院
贡献
欢迎捐款。感兴趣的领域:
- 其他和谐类型和颜色关系
- 情绪描述符的细化和扩展
- 时代协会文件
- 材质颜色映射改进
- 文化色彩语义整合
维护者
作为Lushy美学构图生态系统的一部分而建造。
