Download the PHP package hananils/colors without Composer

On this page you can find all versions of the php package hananils/colors. 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 colors

Colors is a field for Kirby 3 that allows the selection of a color using the native color selector. Colors can be viewed and edited in either HEX, RGB or HSL. Additionally, the field automatically calculates the most readable contrast color. This can be useful, if you'd like to specify background colors and would like to adjust the text colors accordingly. The field displays the color contrast ratings AA, AALarge, AAA and AAALarge according to WCAG accessibility guidelines.

[!IMPORTANT] With the release of version 4, Kirby now offers a core color field which offers similar options for color input. It should be used as an replacement for this plugin which is now deprecated. The one feature missing form the core field is color contrast checking. An new plugin for this purpose is in preparation.

Installation

Download

Download and copy this repository to /site/plugins/colors.

Git submodule

Composer

Blueprint

This field is provided under the type colors:

Dynamic contrast options

In order to set contrast colors, it possible to query another field:

You will have to make sure that the references field returns either a single color or an array of colors. Use methods like split to handle comma-separated strings, e. g. site.contrasts.split.

If you'd like to reference a field on the same page as your colors field, you'll have to watch for changes in order to get live updates:

If you need to split values of the watched field, you have to define the split character as well:

Examples

Field Methods

$field->isHex()

Verifies if the current color is stored as hexadecimal value, returns true or false.

$field->isRgb()

Verifies if the current color is stored as RGB value, returns true or false.

$field->isHsl()

Verifies if the current color is stored as HSL value, returns true or false.

$field->toClass()

Returns the current color object, Hananils\Color, see lib\Color.php.

$field->toColor($space)

Returns the current color as string. Accepts an optional $space attribute to set the output color space, either hex, rgb or hsl.

$field->toSpace()

Returns the current color space, either hex, rgb or hsl.

$field->toValues()

Returns all color values, e. g.:

$field->toReadabilityReport()

Returns a readability report for the contrast colors defined in the blueprint, defaults to black and white:

$field->toMostReadable()

Returns the most readable color for the contrast colors defined in the blueprint, defaults to black and white.

Color calculation

This plugin bundles two classes, one for JavaScript and one for PHP, with the identical API to perform color calculations. See lib/Color.php and src/lib/color.js.

Tips and tricks

  1. Click on the left color preview to open the color picker.
  2. Click the arrow icon to switch between color spaces.
  3. When editing RGB or HSL colors, use the up and down arrow keys to adjust the value by +1 or -1.
  4. Hold the meta key (or the shift key) to adjust values by +10 or -10.
  5. Click on the grey unit indicator of a value then drag the mouse vertically to adjust the values on the fly.

Alternatives

Please note that there is another color field for Kirby 3 developed by Tim Ötting called Kirby Color, see https://github.com/TimOetting/kirby-color.

License

This plugin is provided freely under the hana+nils · Büro für Gestaltung. We create visual designs for digital and analog media.


All versions of colors with dependencies

PHP Build Version
Package Version
Requires getkirby/composer-installer Version ^1.2
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 hananils/colors contains the following files

Loading the files please wait ....