Download the PHP package webzille/colorutility without Composer

On this page you can find all versions of the php package webzille/colorutility. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package colorutility

Webzille Color Utility

The Webzille Color Utility is a comprehensive PHP package designed for advanced color manipulation across multiple color models, including CylindricalLAB, HEX, HSL, HSLA, HSV, LAB, RGB, RGBA and RYB. This powerful utility allows developers to perform various operations on colors, such as conversions, calculations, and transformations, using an intuitive and flexible API.

Features

Installation

To use the Webzille Color Utility in your project, include it via Composer:

Color Space / Wheel

This package includes the following color spaces / wheels to be used in scheme creation.

Usage

Basic Usage

After including the package, you can start by creating color objects in any supported color space.

Setting color from string factory

You may set a color object from string from any of the websafe color formats (RGBA, RGB, HSLA, HSL, HEX and named colors) using the SetColor::fromString(string $string) factory.

Going between color spaces / wheels

By default the package uses the RYB Traditional Painter color wheel for creating color schemes or for any of the color manipulating methods available. It is easy though to change the color wheel from RYB to either HSV or to LAB by passing the class string name to setSpace() method.

You could also simply convert the color object from RGB to one of the color spaces like RYB::class, LAB::class or HSV::class instead of specifying for a specific color space.

Which is the same as

If the color model you are working with has it's own methods for findColorByAngle() and the like, it will use it's own such methods instead of what $this->colorSpace is set to. For instance:

In the above example, even though I set the color space to be used to be in RYB::class, since LAB color model has that method of it's own it will use it, resulting in it using it's own color space. To manipulate colors in LAB while utilizing RYB color space, you would need to explicitly convert between the methods

Catching colors from string

You can catch color from strings for whatever parsing you need. This method also catches most popular named colors.

If you set $transparency to false, than it would ignore the 'transparent' colors.

Viewing color

The color class provides a way to view a sample of the color that the object holds. The method accepts an optional string parameter that allows you to add a label to the color sample to help keep track of each color object.

The method detects if the object is in a websafe color format and converts to RGB in case the color object is not in a websafe color format (like LAB or RYB).

Manipulating Colors

Adjust color properties, blend colors, or calculate color harmonies.

Blending colors are done only within RYB color space at the moment. You may convert the color objects to RYB, blend them and then convert the resulting color back to your own color model you using. The weight is a number between 0 and 1 that determines how the colors blend. If weight is 0, the blend will show only the first color. If weight is 1, it will show only the second color. The closer the weight is to 1, the more the blend will favor the second color. This method smooths out the transition between colors, making the blend gradual and more natural-looking.

All colors can be brighter then they are, even fully saturated yellow (rgb(255, 255, 0)). You could adjust the shade of the color (lighten it or darken it) using a percentage relative to the current brightness/shade of the color.

Analyzing Colors

Calculate angles, distances, and perform advanced analysis like checking if the color is light or dark.

Generating Color Schemes

Generate color schemes based on predefined harmonies.

Random Color Generation

You can generate a random color with or without a seed. The random color factory returns an array with the first element being the color object and the second being the seed used to generate that color object.

The random color factory accepts the optional $seed parameter if you want to create the color object generated before.

theme.php provides an example using the random color factory utilizing various other features of this package.

Color Conversions

The Webzille Color Utility provides extensive support for converting between various color models, allowing seamless transitions across different color formats. This feature is crucial for applications that need to work with multiple color specifications or require specific color manipulations that are easier in certain models.

Converting Colors

Convert colors between different models to fit the context of your application.

If you ever need to use a different color space which would require you to convert a color from one color model to another and than need the color model converted back to what it was before you converted it, you could chain the backTo() method to the end of the method chains.

That is good if the color object would be dynamically set and the result needs to be the same as what it was before any conversions took place. Otherwise you could simply chain the proper conversion method to get back to the original color model.

Conversion Examples

Here’s how you can convert between different color formats using the Webzille Color Utility:

Every color format has a method to convert to any of the other available formats.

Credit

The original authoer for the conversion methods between RYB and RGB methods is Arah J. Leonard used under the MIT license. Source code that was ported to JavaScript that I ported to PHP. I don't know where the original code is but that is what I found and used that works here.

Contributing

Contributions to the Webzille Color Utility are welcome! Please ensure that you submit pull requests to the development branch.

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of colorutility with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package webzille/colorutility contains the following files

Loading the files please wait ....