craftcms/hexdec

Adds a new hexdec filter to Craft, which will convert a hexadecimal value to a decimal.

Installs: 3 277

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 5

Forks: 1

Open Issues: 2

Type:craft-plugin

3.1.0 2024-03-19 23:25 UTC

README

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 %}

Requirements

This plugin requires Craft CMS 4.0.0+ or 5.0.0+.

Installation

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