All Projects → nikkanetiya → laravel-color-palette

nikkanetiya / laravel-color-palette

Licence: MIT license
Laravel Wrapper for @ksubileau/color-thief-php. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to laravel-color-palette

Color Thief Php
Grabs the dominant color or a representative color palette from an image. Uses PHP and GD, Imagick or Gmagick.
Stars: ✭ 564 (+1988.89%)
Mutual labels:  color-palette, gd
Ghibli
Studio Ghibli colour palettes
Stars: ✭ 227 (+740.74%)
Mutual labels:  color-palette
Colourlovers
🎨 📦 R Client for the COLOURlovers API
Stars: ✭ 92 (+240.74%)
Mutual labels:  color-palette
React Native Color Wheel
🌈 A react native reusable and color picker wheel
Stars: ✭ 137 (+407.41%)
Mutual labels:  color-palette
Imagegonord
A tool that can convert your rgb images to nordtheme palette
Stars: ✭ 105 (+288.89%)
Mutual labels:  color-palette
Colorbook
🎨 Color schemes for UI design - Optimized for foreground, background, border, etc. https://liyasthomas.github.io/colorbook
Stars: ✭ 148 (+448.15%)
Mutual labels:  color-palette
Gvcci
color extraction to turn images into 16 color palettes
Stars: ✭ 86 (+218.52%)
Mutual labels:  color-palette
Ciapre.tmTheme
Ciapre - an easy-on-the-eyes Sublime Text/TextMate color scheme.
Stars: ✭ 63 (+133.33%)
Mutual labels:  color-palette
Colors.lol
🎨 Overly descriptive color palettes
Stars: ✭ 207 (+666.67%)
Mutual labels:  color-palette
Arduino Fastled Music Visualizer
An Arduino based music visualizer using the FastLED library and a strip of individually addressable LEDs
Stars: ✭ 134 (+396.3%)
Mutual labels:  color-palette
Paleta
Change terminal colors on-the-fly independent of terminal emulator.
Stars: ✭ 136 (+403.7%)
Mutual labels:  color-palette
Colordrop
Interactive Drag & Drop Coloring with Material Design Color palette
Stars: ✭ 120 (+344.44%)
Mutual labels:  color-palette
Flexcolorpicker
Modern color picker library written in Swift 5 that can be easily extended and customized. It aims to provide great UX and performance with stable, quality code.
Stars: ✭ 164 (+507.41%)
Mutual labels:  color-palette
Wesanderson
A Wes Anderson color palette for R
Stars: ✭ 1,343 (+4874.07%)
Mutual labels:  color-palette
Tints And Shades
🌈 Display tints and shades of a given hex color in 10% increments.
Stars: ✭ 228 (+744.44%)
Mutual labels:  color-palette
Colors App
🎨 A PWA for copying values from popular color palettes. Supports HEX, RGB, and HSL formats.
Stars: ✭ 90 (+233.33%)
Mutual labels:  color-palette
Colorthief
Color Thief for .NET
Stars: ✭ 128 (+374.07%)
Mutual labels:  color-palette
Gradstop
JavaScript micro library to generate gradient color stops 🏳️‍🌈
Stars: ✭ 144 (+433.33%)
Mutual labels:  color-palette
ImageGoNord-pip
A tool that can convert your rgb images to nordtheme palette
Stars: ✭ 120 (+344.44%)
Mutual labels:  color-palette
Md Color Picker
Angular-Material based color picker
Stars: ✭ 253 (+837.04%)
Mutual labels:  color-palette

Laravel Color Palette

Laravel Wrapper for Color-Thief-PHP with additional changes. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

This Laravel package is extremely useful to grab dominant color or a representative color palette from images. See this image for the example.

example image

Contents

Installation

You can install the package via Composer:

composer require nikkanetiya/laravel-color-palette

You must install the service provider (For Laravel < 5.5):

// config/app.php
'providers' => [
    ...
    NikKanetiya\LaravelColorPalette\ColorPaletteServiceProvider::class,
],

Register facade:

// config/app.php
'aliases' => [
    ...
    'ColorPalette' => NikKanetiya\LaravelColorPalette\ColorPaletteFacade::class,
],

Available Methods

  1. getColor() - Use this method to get most dominant single color form image

    Example:

    // get most dominant color from image
    
    $color = ColorPalette::getColor( 'https://rawcdn.githack.com/nikkanetiya/laravel-color-palette/master/tests/images/strawberry.jpeg' );
    
    // Color provides several getters/properties
    echo $color;             // '#dc5550'
    echo $color->rgbString;  // 'rgb(220,85,80)'
    echo $color->rgbaString; // 'rgba(220,85,80,1)'
    echo $color->int;        // 14439760
    print_r($color->rgb);        // array(220, 85, 80) 
    print_r($color->rgba);       // array(220, 85, 80, 1)

    Options

    $color = ColorPalette::getColor($sourceImage, $quality = 10, $area = null );

    By default, getColor will have quality -> 10 and specific area -> null.

    • Quality can be int. 1 is the highest quality. There is a trade-off between quality and speed. The bigger the number, the faster the palette generation but the greater the likelihood that colors will be missed.
    • Area can be array|null $area[x,y,w,h]. It allows you to specify a rectangular area in the image in order to get colors only for this area. It needs to be an associative array with the following keys:
      • $area['x']: The x-coordinate of the top left corner of the area. Default to 0.
      • $area['y']: The y-coordinate of the top left corner of the area. Default to 0.
      • $area['w']: The width of the area. Default to image width minus x-coordinate.
      • $area['h']: The height of the area. Default to image height minus y-coordinate.
  2. getPalette() - Use this method to find representative color palette form image.

    Example:

    // get colors from image
    
    $colors = ColorPalette::getPalette( 'https://github.com/nikkanetiya/laravel-color-palette/blob/master/tests/images/strawberry.jpeg' );
    
    foreach($colors as $color) {
        //
    }
    // Colors will be array of Color Objects

    Options

    $color = ColorPalette::getPalette($sourceImage, $colorCount = 10, $quality = 10, $area = null)
    • colorCount can be 2 to 256. It is the number of colors you want to retrieve for the image.
    • Quality & Area is same as above.

Image Source: https://www.pexels.com, google image

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].