vaersaagod/colormate
Composer 安装命令:
composer require vaersaagod/colormate
包简介
Color me impressed, mate!
README 文档
README
Color me impressed, mate!
Requirements
This plugin requires Craft CMS 5.0.0 or later.
Installation
To install the plugin, either install it from the plugin store, or follow these instructions:
- Install with composer via
composer require vaersaagod/colormatefrom your project directory. - Install the plugin in the Craft Control Panel under Settings → Plugins, or from the command line via
./craft install/plugin colormate.
Configuring
ToolMate is configured by creating a file named colormate.php in your Craft config folder,
and configuring as needed. Sample config:
<?php
return [
'*' => [
'presets' => [
'ctaColors' => [
'name' => 'CTA Colors',
'showCustom' => true,
'showOpacity' => true,
'showClear' => false,
'showTooltip' => true,
'colors' => [
'blush' => [
'name' => 'Blush',
'color' => '#eea8bf'
],
'mustard' => [
'name' => 'Mustard',
'color' => '#ead30a'
],
'baby' => [
'name' => 'Baby',
'color' => '#67cdfc'
],
'transred' => [
'name' => 'Lorem',
'color' => 'rgba(255, 0, 0, 0.4)'
],
],
'default' => 'blush'
],
'overlayColors' => [
'name' => 'Overlay Colors',
'showCustom' => false,
'showOpacity' => false,
'showClear' => true,
'colors' => [
'black-10p' => [
'name' => '10% black',
'color' => 'rgba(0, 0, 0, 0.1)',
],
'black-20p' => [
'name' => '20% black',
'color' => 'rgba(0, 0, 0, 0.2)',
],
'black-30p' => [
'name' => '30% black',
'color' => 'rgba(0, 0, 0, 0.3)',
]
]
]
]
]
];
Field type
The field type returns a Color model with the following properties and methods:
handle
Handle of preset color if the chosen color was from a preset.
custom
Custom color value.
opacity
Opacity value.
name
Name of preset color if the chosen color was from a preset.
baseColor
The calculated base color, either the custom one, or the color value from the selected preset color.
preset
The preset that was used for the field.
getColor([format = 'rgb'])
Returns the resulting color, either a custom color value or from a preset, with opacity factored into it.
isCustom()
Is the color a custom one?
hasTransparency()
Does the resulting color have transparency?
Template variables / Service methods
All the following methods are available both as template variables, using
craft.colormate.<method>(<args>), and as service methods, using
ColorMate::$plugin->color-><method>(<args>).
Most methods are wrappers for [ssnepenthe/color-utils](https://github.com/ssnepenthe/color-utils),
refer to it for additional documentation.
getColor(color)
adjustColor(color, adjustment)
getBrightness(color)
getHue(color)
getLightness(color)
isBright(color[, threshold = 127.5])
isLight(color[, threshold = 50])
looksBright(color[, threshold = 127.5])
getPercievedBrightness(color)
getRelativeLuminance(color)
getSaturation(color)
getBrightnessDifference(color1, color2)
getColorDifference(color1, color2)
getContrastRatio(color1, color2)
rgb2hex(color)
hex2rgb(hexValue)
Price, license and support
The plugin is released under the MIT license. It's made for Værsågod and friends, and no support is given. Submitted issues are resolved if it scratches an itch.
Changelog
See CHANGELOG.MD.
Credits
Brought to you by Værsågod
Icon designed by Freepik from Flaticon.
vaersaagod/colormate 适用场景与选型建议
vaersaagod/colormate 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 997 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 05 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cms」 「color」 「palette」 「Craft」 「craftcms」 「craft-plugin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vaersaagod/colormate 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vaersaagod/colormate 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vaersaagod/colormate 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Prominent image colour extraction for PHP
A slick color picker fieldtype plugin for the Craft CMS 3 control panel.
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Extract colors from an image as a human would do.
PHP library for using ANSI escape codes in the terminal
统计信息
- 总下载量: 997
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-05-21
