Adds a ‘hexdec’ filter to Craft
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Hexdec for Craft CMS

This plugin adds a new |hexdec Twig filter to Craft, which will convert a hexadecimal value to a decimal.

It is a wrapper for PHP’s hexdec() function.

{% set r = entry.colorField[1:2]|hexdec %}
{% set g = entry.colorField[3:2]|hexdec %}
{% set b = entry.colorField[5:2]|hexdec %}


This plugin requires Craft CMS 3.0.0-beta.27 or later.


You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “Hexdec”. Then click on the “Install” button in its modal window.

With Composer

Open your terminal and run the following commands:

# go to the project directory
cd /path/to/my-project.test

# tell Composer to load the plugin
composer require craftcms/hexdec

# tell Craft to install the plugin
./craft install/plugin hexdec