承接 clearbold/craft-color-palette 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

clearbold/craft-color-palette

Composer 安装命令:

composer require clearbold/craft-color-palette

包简介

Configure color themes. Select color themes for page or component styles via entry fields. Output CSS class names or color values in your templates.

README 文档

README

Configure color themes for your Craft CMS site. Select color themes for page or component styles via entry fields. Output CSS class names or color values in your templates.

Roadmap

  • Retain deleted collections & themes so they remain available to fields where they're selected
  • Import/export functionality
  • Display contrast scores for adjacent colors, for accessibility
  • Better color picker, incorporating alpha
  • UI enhancements

Twig Examples

<style>
{% for color in entry.field.all() %}
    --color-{{ color.handle}}: {{ color.getHex() }};
{% endfor %}
</style>

{# Outputs: #}

<style>
    --color-background: #CC4224;
    --color-text: #000000;
    --color-button: #2A75B3;
    --color-highlight: #F3D403;
</style>
<style>
    --color-background: {{ entry.field.handle('background').getRgb() }}
    --color-background-alpha: {{ entry.field.handle('background').getRgba() }}
</style>

{# Outputs: #}

<style>
    --color-background: rgb(204, 66, 36);
    --color-background-alpha: rgb(204, 66, 36, .5);
</style>
<style>
{% set collections = craft.colorpalette.collections %}
{# or #}
{% for collection in craft.colorpalette.all() %}

{% set themes = collections.themes %}
{# or #}
{% for theme in collection.all() %}
{% for color in theme.colors %}
    --color-{{ color.handle}}: {{ color.getHex() }};
{% endfor %}
{% endfor %}
{% endfor %}
</style>

{# Outputs: #}

<style>
    --color-background: #CC4224;
    --color-text: #000000;
    --color-button: #2A75B3;
    --color-highlight: #F3D403;
</style>
<div class="color-{{ entry.field.collection }} color-{{ entry.field.theme }}"></div>

{# Outputs #}

<div class="color-heroes color-captainMarvel"></div>
{% set collection = craft.colorpalette.handle('heroes') %}
{% set theme = collection.handle('captainMarvel') %}
{# or #}
{% set collection = craft.colorpalette.collection('heroes') %}
{% set theme = collection.theme('captainMarvel') %}
{# or #}
{{ craft.colorpalette.collection('heroes').theme('captainMarvel').name }}

<style>
{% for color in theme.colors %}
    --color-{{ color.handle}}: {{ color.getHex() }};
{% endfor %}
</style>

{# Outputs: #}

<style>
    --color-background: #CC4224;
    --color-text: #000000;
    --color-button: #2A75B3;
    --color-highlight: #F3D403;
</style>

{# ~~~~~~~~ #}

{% set color = theme.color('background') %}
{# or #}
{% set color = theme.handle('background') %}
<style>
    --color-background: {{ color.getRgb() }}
</style>

{# Outputs: #}

<style>
    --color-background: rgb(204, 66, 36);
</style>

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2021-04-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固