2017 © Pedro Pelรกez
 

library laratone

Color Library for Laravel

image

daikazu/laratone

Color Library for Laravel

  • Thursday, June 28, 2018
  • by daikazu
  • Repository
  • 2 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 89 % Grown

The README.md

Logo for Laratone , (*1)

Laratone

Latest Version on Packagist GitHub Tests Action Status Total Downloads, (*2)

Laratone is a comprehensive Laravel package for managing color libraries and swatches in your applications. It provides an easy-to-use API for storing, retrieving, and managing color data, with built-in support for various color formats (HEX, RGB, CMYK, LAB) and popular color libraries., (*3)

Features

  • ๐ŸŽจ Multiple built-in color libraries (Pantone, GuangShun Thread, HC Twill)
  • ๐Ÿ”„ Automatic color data caching for improved performance
  • ๐Ÿ“ฆ Easy color book management and seeding
  • ๐Ÿ” Flexible API for color searching and filtering
  • ๐Ÿ› ๏ธ Simple integration with Laravel applications
  • ๐Ÿ“ Support for custom color books and formats

Requirements

  • PHP 8.3 or higher
  • Laravel 11.x or greater

Installation

You can install the package via composer:, (*4)

composer require daikazu/laratone

Publish Configuration and Migrations

Publish the configuration file:, (*5)

php artisan vendor:publish --tag="laratone-config"

Publish and run the migrations:, (*6)

php artisan vendor:publish --tag="laratone-migrations"
php artisan migrate

Configuration

The published config file (config/laratone.php) contains the following options:, (*7)

return [
    // Table prefix for Laratone tables
    'table_prefix' => 'laratone_',

    // Cache duration in seconds for color books and colors
    'cache_time' => 3600,
];

Usage

Seeding Color Books

Laratone comes with several pre-built color libraries:, (*8)

  • ColorBookPlusSolidCoated
  • ColorBookPlusSolidCoated336NewColors
  • ColorBookMetallicCoated
  • ColorBookPlusMetallicCoated
  • GuangShunThreadColors
  • HCTwillColors

Seed All Color Books

php artisan laratone:seed

Seed Specific Color Books

php artisan laratone:seed ColorBookPlusSolidCoatedSeeder

Import Custom Color Books

php artisan laratone:seed --file ./mycolorbookfile.json

Example Color Book format:, (*9)

{
  "name": "My Custom Color Book",
  "data": [
    {
      "name": "Custom Color 1",
      "lab": "88.19,-6.97,111.73",
      "hex": "FEDD00",
      "rgb": "254,221,0",
      "cmyk": "0,1,100,0"
    }
  ]
}

API

Color Books

List all available color books:, (*10)

GET /api/laratone/colorbooks
Parameter Required Description Default
sort No Sort by name (asc/desc) asc

Colors

Get colors from a specific color book:, (*11)

GET /api/laratone/colorbook/{color-book-slug}
Parameter Required Description Default
sort No Sort by name (asc/desc) asc
limit No Limit number of results -
random No Randomize results false

Color Management

Laratone provides a simple API for managing colors programmatically:, (*12)

use Daikazu\Laratone\Laratone;

// Get all color books
$colorBooks = Laratone::colorBooks();

// Get a specific color book
$colorBook = Laratone::colorBookBySlug('color-book-plus-solid-coated');

// Create a new color book
$newColorBook = Laratone::createColorBook('My New Color Book');

// Add colors to a color book
$color = Laratone::addColorToBook($colorBook, [
    'name' => 'New Color',
    'hex' => 'FF0000',
    'rgb' => '255,0,0'
]);

// Update a color
Laratone::updateColor($color, ['name' => 'Updated Color Name']);

// Delete a color
Laratone::deleteColor($color);

Caching

Laratone automatically caches color book and color data to improve performance. The cache duration can be configured in the config file. To clear the cache:, (*13)

Laratone::clearCache();

Testing

composer test

Contributing

Please see CONTRIBUTING for details., (*14)

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities., (*15)

Credits

License

The MIT License (MIT). Please see License File for more information., (*16)

The Versions

28/06 2018

dev-master

9999999-dev

Color Library for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Wall

22/05 2018

v0.0.5

0.0.5.0

Color Library for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Wall

04/04 2018

0.0.1

0.0.1.0

Color Library for Laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

by Mike Wall