daikazu/laratone

Simple API for managing color libraries in you Laravel application.

Fund package maintenance!
Daikazu

v3.0.0 2024-06-11 16:21 UTC

This package is auto-updated.

Last update: 2024-11-11 17:20:41 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

Installation

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
];

Usage

Seed with default Color Books

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

Seed all Color Books in Package

php artisan laratone:seed

Seed specific Color Books in Package

php artisan laratone:seed PantonePlusSolidCoatedSeeder

Seed your own Color Books

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"
    }...

API

Color Books

http://example.test/api/laratone/colorbooks

Example:

[
    {
        "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"
    }...
]

Colors

Return colors from ColorBook based on ColorBook slug ie.pantone-plus-solid-coated

http://example.test/api/laratone/colorbook/pantone-plus-solid-coated

Example:

{
    "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
        }...
}

TODO

  • write tests (If someone would like to help with this please send a PR)

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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