mcpField
T
theme-design

theme-design

github.com/ahmed-lakosha设计与 UI7660 次安装31 周前更新
代码仓库

关于 theme-design

theme-design 是将 Figma 设计转化为 Odoo 网站主题的工作流参考。它指导设计分析、匹配内置模板、配置主题变量,并在需要时添加 CSS 或自定义片段。

主要功能

  1. 01Figma 设计分析工作流
  2. 02将颜色映射到 Odoo 主题变量
  3. 03页眉与页脚模板选择
  4. 04商店和博客布局选项
  5. 05以编程方式启用模板

适用场景

  1. 01根据 Figma 设计规划 Odoo 主题
  2. 02选择匹配的页眉和页脚模板
  3. 03配置商店与博客页面
  4. 04根据提取的设计信息生成主题设置

MCP 相关

参考内容说明可在设计提取流程中使用 Figma MCP 和 Chrome MCP,但未描述实现或提供 MCP 服务。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/ahmed-lakosha/odoo-plugins --skill theme-design

安装后在 Claude Code 中输入/theme-design确认已加载。

详细介绍

Figma 到 Odoo 设计工作流

设计工作流方法

1. ANALYZE DESIGN → Extract colors, fonts, layout, components
2. COMPARE TO ODOO TEMPLATES → Match header, footer, page layouts
3. CHOOSE CLOSEST TEMPLATE → Select best matching built-in template
4. CONFIGURE VIA VARIABLES → Set $o-website-values-palettes
5. ENHANCE WITH CUSTOM CSS → Only what templates can't provide
6. CREATE CUSTOM SNIPPETS → Components not available in Odoo

Figma 提取流程

使用 Figma MCP
1. Use Figma MCP with prompt:
   "Convert this Figma design to HTML for Odoo <version> website theme.
   Use Bootstrap v5.1.3 classes (not Tailwind).
   Apply proper Odoo theme structure with sections and containers."

2. Extract Color Palette:
   "Extract the color palette and map to o-color-1 through o-color-5."

3. Extract Typography:
   "Convert text styling to Bootstrap typography classes."
使用 Chrome MCP(浏览器自动化)
  1. 导航至 Figma URL → 打开页面(而非组件!)
  2. 点击页面元素以提取:
    • 页眉/导航栏 → 主色
    • CTA 按钮 → 辅助色
    • 区块背景 → o-color-3
    • 正文文本 → 文本颜色、字体
    • 标题(H1-H6)→ 标题字体、字号

需要检查的页面:主页、关于/服务、联系、页脚区域

颜色映射
设计元素对应项
品牌主色(按钮、链接)o-color-1
强调色/CTA 颜色o-color-2
浅色区块背景o-color-3
主内容背景o-color-4
深色文本/标题o-color-5

页眉模板(11 个主要模板 + 变体)

XML ID名称适用场景
website.template_header_default默认大多数网站
website.template_header_hamburger汉堡菜单极简设计
website.template_header_stretch延展宽屏布局
website.template_header_vertical垂直类应用网站
website.template_header_search搜索电子商务、目录
website.template_header_sales_one销售 1在线商店
website.template_header_sales_two销售 2大型商品目录
website.template_header_sales_three销售 3以产品为主
website.template_header_sales_four销售 4时尚、零售
website.template_header_sidebar侧边栏仪表板网站
website.template_header_boxed框式现代品牌
页眉对齐变体
  • ..._align_center / ..._align_right — 桌面端对齐方式
  • ..._mobile_align_center / ..._mobile_align_right — 移动端对齐方式
页眉可见性(互斥)
XML ID效果
website.header_visibility_standard随页面滚动
website.header_visibility_fixed固定在顶部
website.header_visibility_disappears向下滚动时隐藏
website.header_visibility_fade_out淡出
页眉组件(可组合)
XML ID组件默认状态
website.option_header_brand_logoLogo 图片启用
website.option_header_brand_name文本名称未启用
website.header_call_to_actionCTA 按钮启用
website.header_search_box搜索栏启用
website.header_social_links社交图标未启用
页眉决策流程图
Is navigation hidden? → YES → template_header_hamburger
                       → NO → Vertical sidebar? → YES → Full page? → sidebar / vertical
                                                 → NO → E-commerce? → YES → Categories? → sales_two / sales_one
                                                                    → NO → Search prominent? → template_header_search
                                                                                             → Boxed? → boxed / stretch / default

页脚模板(9 个选项)

XML ID名称适用场景
website.footer_custom默认通用
website.template_footer_descriptive描述式企业网站
website.template_footer_centered居中落地页
website.template_footer_links链接大型网站
website.template_footer_minimalist极简简洁设计
website.template_footer_contact联系方式服务型企业
website.template_footer_call_to_actionCTA营销网站
website.template_footer_headline主标题品牌宣言
website.template_footer_slideout滑出式现代/潮流风格
页脚决策流程图
Minimal (just copyright)? → YES → template_footer_minimalist
                          → NO → Center-aligned? → template_footer_centered
                                 Newsletter/CTA? → template_footer_call_to_action
                                 Contact info? → template_footer_contact
                                 Primarily links? → template_footer_links
                                 Detailed description? → template_footer_descriptive
                                 Default → footer_custom

商店页面模板(website_sale)

布局选项
XML ID功能
website_sale.products_design_card卡片布局
website_sale.products_design_grid网格布局
website_sale.products_thumb_4_34:3 图片比例
website_sale.products_thumb_cover图片填充容器(默认)
分类和筛选器
XML ID功能默认状态
website_sale.products_categories左侧边栏未激活
website_sale.products_categories_top顶部导航已激活
website_sale.products_attributes属性筛选器已激活
website_sale.filter_products_price价格筛选器未激活
website_sale.search搜索框已激活
website_sale.sort排序下拉菜单已激活
产品详情选项
XML ID功能默认状态
website_sale.product_comment评论未激活
website_sale.product_buy_now立即购买按钮未激活
website_sale.alternative_products替代产品已激活

博客模板(website_blog)

博客列表
XML ID功能默认状态
website_blog.opt_blog_cover_post特色横幅已激活
website_blog.opt_blog_list_view列表视图未激活
website_blog.opt_blog_cards_design卡片组件未激活
website_blog.opt_blog_sidebar_show侧边栏未激活
博客文章详情
XML ID功能默认状态
website_blog.opt_blog_post_breadcrumb面包屑导航已激活
website_blog.opt_blog_post_read_next接着阅读已激活
website_blog.opt_blog_post_comment评论未激活

购物车和结账

XML ID功能默认状态
website_sale.suggested_products_list推荐产品已激活
website_sale.reduction_code优惠码已激活
website_sale.accept_terms_and_conditions条款与条件复选框未激活

根据设计生成主题配置

分析设计并匹配模板后:

// primary_variables.scss — Generated from Design Analysis
$o-theme-font-configs: (
    'Poppins': (
        'family': ('Poppins', sans-serif),
        'url': 'Poppins:300,400,500,600,700',
    ),
);

$o-website-values-palettes: (
    (
        'color-palettes-name': 'default-1',
        'font': 'Poppins',
        'headings-font': 'Poppins',
        'header-template': 'hamburger',
        'header-links-style': 'pills',
        'logo-height': 48px,
        'footer-template': 'contact',
        'footer-scrolltop': true,
        'btn-padding-y': 0.75rem,
        'btn-border-radius': 8px,
        'link-underline': 'never',
    )
);

然后创建 theme.utils,以编程方式激活匹配的模板:

def _theme_yourtheme_post_copy(self, mod):
    self.enable_view('website.template_header_hamburger')
    self.enable_view('website.template_footer_contact')
    self.enable_view('website.option_header_brand_logo')
    self.disable_view('website.header_visibility_standard')
    self.enable_view('website.header_visibility_fixed')

评论

支持 Markdown