Laravel Color Library Package
This is a simple package to manage and seed various color libraries I find my self using all time. You can use the defaults or simple add your own. Laratone provides a few routes to allow simple access via url.
You can install the package via composer:
composer require daikazu/laratone
You can publish and run the migrations with:
php artisan vendor:publish --tag="laratone-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="laratone-config"
This is the contents of the published config file:
You can change the table prefix name in the config to what ever you like.
<?php
return [
'table_prefix' => 'laratone_', //default
];
Use the Laratone artisan command to seed Color Books to your database.
The following Color Books have been made available for you;
PantonePlusSolidCoated
PantonePlusSolidCoated336NewColors
PantoneMetallicCoated
PantonePlusMetallicCoated
GuangShunThreadColors
HCTwillColors
php artisan laratone:seed
php artisan laratone:seed PantonePlusSolidCoatedSeeder
php artisan laratone:seed --file ./mycolorbookfile.json
Example Color Book format
{
"name": "Pantone Plus Solid Coated",
"data": [
{
"name": "Yellow C",
"lab": "88.19,-6.97,111.73",
"hex": "FEDD00",
"rgb": "254,221,0",
"cmyk": "0,1,100,0"
},
{
"name": "Yellow 012 C",
"lab": "86.69,-3.2,109.49",
"hex": "FFD700",
"rgb": "255,215,0",
"cmyk": "0,2,98,0"
}...
http://example.test/api/laratone/colorbooks
URL Parameter | Required | Description | Default |
---|---|---|---|
sort | false | Sort Color Book By Name asc or desc |
asc |
[
{
"name": "Pantone Plus Solid Coated 336 new Colors",
"slug": "pantone-plus-solid-coated-336-new-colors"
},
{
"name": "Pantone Plus Solid Coated",
"slug": "pantone-plus-solid-coated"
}...
]
Return colors from ColorBook based on ColorBook slug ie.pantone-plus-solid-coated
http://example.test/api/laratone/colorbook/pantone-plus-solid-coated
URL Parameter | Required | Description | Default | |
---|---|---|---|---|
sort | false | Sort Colors By Name asc or desc |
asc | |
limit | false | Limit number of colors returned | - | |
random | false | Set to true to randomize colors (overrides sort ) |
false |
{
"name": "Pantone Plus Solid Coated",
"slug": "pantone-plus-solid-coated",
"colors": [
{
"name": "100 C",
"lab": null,
"hex": "F6EB61",
"rgb": null,
"cmyk": null
},
{
"name": "101 C",
"lab": null,
"hex": "F7EA48",
"rgb": null,
"cmyk": null
}...
}
- write tests (If someone would like to help with this please send a PR)
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.