Takes in a HEX color and produces variations of that colour for the foreground and background

Related tags

Laravel css-colors
Overview

css-colors

Build Status

Takes in a HEX color and produces variations of that colour for the foreground and background

It takes a great php class made by Patrick Fitzgerald in 2004 ( http://www.barelyfitz.com/projects/csscolor/ ) and wraps it in a library for use in your project.

Installation

Install this package through Composer. Add the following to your composer.json file:

"require": {
    "soapbox/css-colors": "dev-master"
}

Next, run composer install

Finally, add the service provider and the facade to app/config/app.php.

'providers' => array(
    // ...

    'SoapBox\Csscolor\CsscolorServiceProvider'
)


Not required, but you can addd the Csscolor alias if you want.

'aliases' => array(
    // ...

    'Csscolor' => 'SoapBox\Csscolor\Facade'
)

How to Use:

All you need to do is put the HEX values into a colour object

$color = Csscolor::make('3D88C8');

$color->bg['0']; // returns the same colour as entered
$color->bg['+1']; // +1 to +5 and -1 to -5 to return variations of the colour to work with gradiants
$color->fg['0']; // returns a colour that can sit on the foreground of the defined hex value
...

A var_dump of the $color objects instanciated with the color #3D88C8 look like the following:

object(SoapBox\Csscolor\Csscolor)[1109]
  public 'bg' => 
    array (size=11)
      0 => string '3D88C8' (length=6)
      '+1' => string '5a9ad0' (length=6)
      '+2' => string '6ea6d6' (length=6)
      '+3' => string '9fc4e4' (length=6)
      '+4' => string 'cee1f1' (length=6)
      '+5' => string 'ecf4fa' (length=6)
      -1 => string '3474aa' (length=6)
      -2 => string '2e6696' (length=6)
      -3 => string '1f4464' (length=6)
      -4 => string '0f2232' (length=6)
      -5 => string '060e14' (length=6)
  public 'fg' => 
    array (size=11)
      0 => string 'ffffff' (length=6)
      '+1' => string '000000' (length=6)
      '+2' => string '000000' (length=6)
      '+3' => string '000000' (length=6)
      '+4' => string '0f2232' (length=6)
      '+5' => string '1f4464' (length=6)
      -1 => string 'ffffff' (length=6)
      -2 => string 'ffffff' (length=6)
      -3 => string 'ffffff' (length=6)
      -4 => string 'cee1f1' (length=6)
      -5 => string '9fc4e4' (length=6)
  public 'minBrightDiff' => int 126
  public 'minColorDiff' => int 500
You might also like...
Laravel blade directives and php helpers for serverside rendered content, based on browser window size WITHOUT css. Requires Livewire and AlpineJS.

Laravel Livewire Window Size and Breakpoints Laravel blade directives and php helpers for server side rendered content, based on browser window size W

Invalidate caches and achieve high hitrate with readable and maintainable annotations

Purgatory Purgatory is an extension which makes it possible for Symfony applications to handle enormous load using minimal infrastructure. Infrastruct

Sweetalert and Toaster notifications for Laravel livewire with support for tailwind and bootstrap.

Larabell Integrate livewire with sweetalert. Installation How to use Sweetalert Toast Available configuration Installation composer require simtabi/la

Invoices, Expenses and Tasks built with Laravel and Flutter

Invoice Ninja Hosted | Self-Hosted We're on Slack, join us at slack.invoiceninja.com or if you like StackOverflow Just make sure to add the invoice-ni

Fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent Resources, Translatability, and Swagger.

Laravel Headless What about? This allows a fast and simple implementation of a REST API based on the Laravel Framework, Repository Pattern, Eloquent R

Collection of agnostic PHP Functions and helpers with zero dependencies to use as foundation in packages and other project

Collection of agnostic PHP Functions and helpers This package provides a lot of very usefull agnostic helpers to use as foundation in packages and oth

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.
Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and User Authentication.

Laravel Podcast is Laravel 5.5 web app that enables you to manage RSS feeds for your favorite podcasts and listen to the episodes in a seamless UI and

GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.

What is GitScrum? GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivit

Laravel 5 Flash Notifications with icons and animations and with a timeout

Notify (Laravel) Notify alert boxes to the browser with sound and font awesome icons and give it a timeout to fly out. Works great to notify the user

Releases(1.0.1)
Owner
Soapbox Innovations Inc.
Helping managers and employees have better meetings, one byte at a time.
Soapbox Innovations Inc.
Let users pick a color from a fixed list of options.

Let users pick a color from a fixed list of options. This packages implements a new ColorPalette field as described in the mini-series on my blog. It

Ryan Chandler 2 Oct 7, 2022
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Livewire 17.7k Jan 1, 2023
🧙‍♀️ Arcanist takes the pain out of building multi-step form wizards in Laravel.

Installation Arcanist requires PHP 8 and Laravel 8. composer require laravel-arcanist/arcanist Documentation You can find the full documentation here

Arcanist 378 Jan 3, 2023
A Laravel 8 and Livewire 2 demo showing how to search and filter by tags, showing article and video counts for each tag (Polymorphic relationship)

Advanced search and filter with Laravel and Livewire A demo app using Laravel 8 and Livewire 2 showing how to implement a list of articles and tags, v

Sérgio Jardim 19 Aug 29, 2022
Laravel package to generate and to validate a UUID according to the RFC 4122 standard. Only support for version 1, 3, 4 and 5 UUID are built-in.

Laravel Uuid Laravel package to generate and to validate a universally unique identifier (UUID) according to the RFC 4122 standard. Support for versio

Christoph Kempen 1.7k Dec 28, 2022
Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Boilerplate code for protecting a form with proof of work. Uses javascript in the browser to generate the hashcash and PHP on the server to generate the puzzle and validate the proof of work.

Jameson Lopp 28 Dec 19, 2022
List of 77 languages for Laravel Framework 4, 5, 6, 7 and 8, Laravel Jetstream , Laravel Fortify, Laravel Breeze, Laravel Cashier, Laravel Nova and Laravel Spark.

Laravel Lang In this repository, you can find the lang files for the Laravel Framework 4/5/6/7/8, Laravel Jetstream , Laravel Fortify, Laravel Cashier

Laravel Lang 6.9k Jan 2, 2023
Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes and constraints by adding them as a subquery.

Laravel Eloquent Scope as Select Stop duplicating your Eloquent query scopes and constraints in PHP. This package lets you re-use your query scopes an

Protone Media 75 Dec 7, 2022
symfony workflow component for laravel7 and 8 ,php 7 and 8

Laravel workflow Use the Symfony Workflow component in Laravel8,PHP7,PHP8 This repository based on @brexis,his project since 2019-09 No longer maintai

null 3 Jul 21, 2022
An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality.

Support An opinionated support package for Laravel, that provides flexible and reusable helper methods and traits for commonly used functionality. Ins

Ian Olson 3 Apr 14, 2021