PHPackages                             redweb/colormixer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. redweb/colormixer

ActiveCraft-package

redweb/colormixer
=================

craft Package

011.7k[1 PRs](https://github.com/redCOMPONENT-COM/colormixer/pulls)PHP

Since May 17Pushed 5y ago13 watchersCompare

[ Source](https://github.com/redCOMPONENT-COM/colormixer)[ Packagist](https://packagist.org/packages/redweb/colormixer)[ RSS](/packages/redweb-colormixer/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Color Mixer for Craft CMS](resources/banner.gif)](resources/banner.gif)

Color Mixer
===========

[](#color-mixer)

A set of Twig filters for modifying hex colors in [Craft](http://buildwithcraft.com/).

### Install

[](#install)

Download / clone this repo into `craft/plugins/colormixer`.

**Important:** Make sure you create the `colormixer` folder in the plugins directory. We've left the folder out to make it easy for anyone wanting to use the plugin as a Git Sub-module!

### Filters

[](#filters)

**hexToHsl**

```
hexToHsl

hexToHsl($returnAsArray)
```

Converts a hex to HSL. Returns a comma separated string unless `$returnAsArray` is set to true.

**hexToRgb**

```
hexToRgb

hexToRgb($returnAsArray)
```

Converts a hex to RGB. Returns a comma separated string unless `$returnAsArray` is set to true.

**darken**

```
darken($amount)
```

Darkens a hex by the `$amount` percentage.

**lighten**

```
lighten($amount)
```

Lightens a hex by the `$amount` percentage.

**mix**

```
mix($hexToMixWith, $amount)
```

Mixes two hexes together. The `$amount` to mix the colors together by is set between -100..0..+100, where 0 is an equal amount of both colors. `$amount` defaults to 0 if not set.

**isLight**

```
isLight($threshold)
```

Returns true if the color is considered "light", false if not. The *optional* `$threshold` value determines at what point the color is considered light. Anything above this value is considered light. Defaults to 130, range is 0..255.

**isDark**

```
isDark($threshold)
```

Returns true if the color is considered "dark", false if not. The *optional* `$threshold` value determines at what point the color is considered dark. Anything below or equal to this value is considered dark. Defaults to 130, range is 0..255.

**complementary**

```
complementary
```

Returns the complimentary color.

**gradientColors**

```
gradientColors($amount, $threshold)
```

Returns an array with the input color and a slightly darkened / lightened counterpart (depending on whether the input color is light or dark). Both parameters are *optional*.
`$amount` defines how much lighter or darker the color should be made (defaults to 10, range is 0..100).
`$threshold` determines at what point the color is considered dark. Anything below or equal to this value is considered dark. Defaults to 130, range is 0..255.

**gradient**

```
gradient($direction, $amountOrSecondary, $threshold)
```

Returns a string of CSS containing the styling to give an element a background gradient. All parameters are *optional*.
`$direction` defines the direction of the gradient. Must be either: `horizontal` (→), `vertical` (↓), `diagonalDown` (↘), `diagonalUp` (↗), `radial` (○). Defaults to `horizontal`.
`$amountOrSecondary` defines the amount to lighten or darken the input color (defaults to 10, range is 0..100) or a hex string for the secondary color. `$threshold` determines at what point the color is considered dark. Anything below or equal to this value is considered dark. Defaults to 130, range is 0..255. If `$amountOrSecondary` is a hex string, this value is ignored.

Changelog
---------

[](#changelog)

### 1.1.1

[](#111)

- Fixed bug where `gradient` filter would prepend an additional `#` when the `$amountOrSecondary` param is left blank.

### 1.1.0

[](#110)

- Added `gradientColors` filter
- Added `gradient` filter

### 1.0.0

[](#100)

- Added docs link &amp; Craft releases updates
- Added plugin branding
- Bumped version number to 1.0.0

### 0.1.2

[](#012)

- Initial Release
- The first full release of ColorMixer for Craft CMS.
- New features include the ability to specify at what point a color is considered light or dark.

---

Copyright © 2016 Ether Creative

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/cbb38a1b33b82b2c54ae0b5d36d0b9492001cc4ce68c5ab32270e5c39a625270?d=identicon)[LLNet](/maintainers/LLNet)

---

Top Contributors

[![Tam](https://avatars.githubusercontent.com/u/977594?v=4)](https://github.com/Tam "Tam (12 commits)")

### Embed Badge

![Health badge](/badges/redweb-colormixer/health.svg)

```
[![Health](https://phpackages.com/badges/redweb-colormixer/health.svg)](https://phpackages.com/packages/redweb-colormixer)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
