PHP code example of danielebuso / laravel-tailette

1. Go to this page and download the library: Download danielebuso/laravel-tailette library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

danielebuso / laravel-tailette example snippets


return [
    // Default color palette (blue)
    'default_palette' => [
        '50' => '#eff6ff',
        '100' => '#dbeafe',
        // ...
    ],
    
    // Cache duration in minutes (1 day by default)
    'cache_duration' => 60 * 24,
];

use DanieleBuso\Tailette\Facades\Tailette;

// Generate a palette from a hex color (with or without #)
$palette = Tailette::generate('#3b82f6');
// or
$palette = Tailette::generate('3b82f6');

// The result is a collection with keys 50, 100, 200, ..., 950
// Each value is a hex color code
echo $palette['500']; // #3b82f6 (the original color)
echo $palette['200']; // A lighter shade
echo $palette['800']; // A darker shade

$palette = Tailette::generatePalette('3b82f6');

$colors = [
    'primary' => Tailette::generate('#3b82f6')->toArray(),
    'secondary' => Tailette::generate('#10b981')->toArray(),
    // Add more colors as needed
];

file_put_contents(
    public_path('colors.json'), 
    json_encode($colors, JSON_PRETTY_PRINT)
);
bash
php artisan vendor:publish --tag="tailette-config"