bogdancondorachi/kirby-colour-swatch-field 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bogdancondorachi/kirby-colour-swatch-field

最新稳定版本:1.0.1

Composer 安装命令:

composer require bogdancondorachi/kirby-colour-swatch-field

包简介

Colour swatch field for Kirby CMS

README 文档

README

Note

A simple color field extention that allows to pass options like 'hex', 'class' or 'title' for Kirby CMS.

📦 Installation

Composer

composer require bogdancondorachi/kirby-colour-swatch-field

Git Submodule

git submodule add https://github.com/bogdancondorachi/kirby-colour-swatch-field.git site/plugins/colour-swatch-field

Manual

Download the plugin and extract it to: /site/plugins/colour-swatch-field

⚙️ Usage

Add the field to your blueprint:

bgColor:
  label: Background Color
  type: swatch
  options:
    amber:
      hex: 'FFB900'
      title: Amber
      class: bg-amber-400
    emerald:
      hex: '009966'
      title: Apricot
      class: bg-emerald-600
    white:
      hex: 'FFFFFF'
      title: White
      class: bg-white
    black:
      hex: '000000'
      title: Black
      class: bg-black

Use the field in your template:

// Outputs the selected color title as a string
$page->bgColor()->toSwatch('title')

// Outputs the selected color hex code as a string (without preceding #)
$page->bgColor()->toSwatch('hex')

// Outputs the selected color class as a string
$page->bgColor()->toSwatch('class')

🙏 Credits

📜 License

MIT License Copyright © 2024 Bogdan Condorachi

统计信息

  • 总下载量: 28
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-26