rias / statamic-color-swatches
Installs: 13 206
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 2
Forks: 2
Open Issues: 11
Type:statamic-addon
Requires
- statamic/cms: ^3.0|^4.0|^5.0
- dev-main
- 2.3.0
- v2.2.0
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.0.1
- 1.0
- dev-dependabot/npm_and_yarn/ws-6.2.3
- dev-dependabot/npm_and_yarn/multi-00775cc1dc
- dev-dependabot/npm_and_yarn/express-4.19.2
- dev-dependabot/npm_and_yarn/follow-redirects-1.15.6
- dev-dependabot/npm_and_yarn/multi-8a19c61169
- dev-dependabot/npm_and_yarn/babel/traverse-7.24.5
- dev-dependabot/npm_and_yarn/browserify-sign-4.2.3
- dev-dependabot/npm_and_yarn/fsevents-1.2.13
- dev-dependabot/npm_and_yarn/ip-1.1.9
- dev-dependabot/npm_and_yarn/json5-1.0.2
This package is auto-updated.
Last update: 2024-11-19 06:38:08 UTC
README
Color Swatches
Color Swatches for Statamic 3.
For the Statamic 2 version, check out the v1 branch
Let clients choose from a predefined set of colors.
License
Color Swatches requires a license to be used while on a production site.
You can purchase one at https://statamic.com/marketplace/addons/color-swatches.
You may use Color Swatches without a license while Statamic is in Trial mode.
Installation
Require it using Composer.
composer require rias/statamic-color-swatches
Publish the assets:
php artisan vendor:publish --provider="Rias\ColorSwatches\ServiceProvider"
Color Swatches Overview
Instead of providing a user a full color picker, Color Swatches gives an admin the ability to provide a selection of colors for a user to choose from.
Using Color Swatches
Add the fieldtype to your fieldset, you can define multiple colors for a swatch by using a YAML array. You can also set a default color by entering the label.
sections: main: display: Main fields: - handle: color field: type: color_swatches display: Color colors: - label: red value: - '#F56565' - label: orange value: - '#ED8936' - label: green value: - '#48BB78' - label: blue_yellow value: - '#4299E1' - '#E7C961'
Using Color Swatches
You can access both the label and color in your template.
{{ color.label }} {{ color.value }} {{ color.value.0 }} #If it's more than one color
Brought to you by Rias