From f7b0756abe8f3ab7add40c11416da2c3d62fb28b Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sun, 14 May 2023 21:46:59 +0400 Subject: [PATCH 1/6] * `\ddTools::getTpl` is used instead of `$modx->getTpl`. * Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.60 is required. --- README.md | 2 +- README_ru.md | 4 ++-- composer.json | 2 +- src/Snippet.php | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 189fbcd..937e61b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Converts the color to match the offset in tone, brightness, or saturation. ## Requires * PHP >= 5.6 -* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.57 +* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.60 * [(MODX)EvolutionCMS.snippets.ddGetDocumentField](https://code.divandesign.biz/modx/ddgetdocumentfield) >= 2.11.1 diff --git a/README_ru.md b/README_ru.md index b1fdef6..892d548 100644 --- a/README_ru.md +++ b/README_ru.md @@ -6,8 +6,8 @@ ## Использует * PHP >= 5.6 -* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.57 -* [(MODX)EvolutionCMS.snippets.ddGetDocumentField](https://code.divandesign.biz/modx/ddgetdocumentfield) >= 2.11.1 +* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.ru/modx/ddtools) >= 0.60 +* [(MODX)EvolutionCMS.snippets.ddGetDocumentField](https://code.divandesign.ru/modx/ddgetdocumentfield) >= 2.11.1 ## Установка diff --git a/composer.json b/composer.json index 862a69b..1161674 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ ], "require": { "php": ">=5.6.0", - "dd/evolutioncms-libraries-ddtools": ">=0.57.0", + "dd/evolutioncms-libraries-ddtools": ">=0.60.0", "dd/evolutioncms-snippets-ddgetdocumentfield": ">=2.11.1" } } \ No newline at end of file diff --git a/src/Snippet.php b/src/Snippet.php index 4933a2c..237f574 100644 --- a/src/Snippet.php +++ b/src/Snippet.php @@ -25,7 +25,7 @@ class Snippet extends \DDTools\Snippet { /** * prepareParams - * @version 1.0 (2023-03-10) + * @version 1.0.1 (2023-05-14) * * @param $this->params {stdClass|arrayAssociative|stringJsonObject|stringHjsonObject|stringQueryFormatted} * @@ -74,7 +74,7 @@ protected function prepareParams($paramsRenameMe = []){ ); } - $this->params->result_tpl = \ddTools::$modx->getTpl($this->params->result_tpl); + $this->params->result_tpl = \ddTools::getTpl($this->params->result_tpl); } /** From e6e3a57dd6cbd2976adc18bc9d4c292642198aaa Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Tue, 9 Jan 2024 17:13:41 +0400 Subject: [PATCH 2/6] * Refactoring. --- src/Snippet.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Snippet.php b/src/Snippet.php index 237f574..6a2b528 100644 --- a/src/Snippet.php +++ b/src/Snippet.php @@ -354,27 +354,29 @@ private static function stringToHsl($paramString): \stdClass { /** * hexToHsl - * @version 3.0.1 (2023-03-10$this->params->inputColor$hex {string} — Color in HEX format without first '#'. @required + * @version 3.0.2 (2024-01-09) + * + * @param $hexString {string} — Color in HEX format without first '#'. @required * * @return $result {stdClass} * @return $result->h {integer} * @return $result->s {integer} * @return $result->l {integer} */ - private static function hexToHsl($hex): \stdClass { + private static function hexToHsl($hexString): \stdClass { //Получаем цвета в 10чной системе $red = hexdec(substr( - $hex, + $hexString, 0, 2 )); $green = hexdec(substr( - $hex, + $hexString, 2, 2 )); $blue = hexdec(substr( - $hex, + $hexString, 4, 2 )); From 07b1c0c221c582fb2fb06fed442f25bb7254957e Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sat, 20 Jan 2024 00:16:56 +0400 Subject: [PATCH 3/6] =?UTF-8?q?+=20Parameters=20=E2=86=92=C2=A0`inputColor?= =?UTF-8?q?`:=20Supports=20values=20with=20alpha-channel.=20+=20Parameters?= =?UTF-8?q?=20=E2=86=92=C2=A0`offset=5Fa`:=20The=20new=20parameter.=20Allo?= =?UTF-8?q?ws=20you=20to=20modify=20alpha-channel.=20+=20Parameters=20?= =?UTF-8?q?=E2=86=92=C2=A0`result=5Ftpl`=20=E2=86=92=20Placeholders=20?= =?UTF-8?q?=E2=86=92=20`[+ddA+]`:=20The=20new=20placeholder.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 ++++- README_ru.md | 17 ++++- src/Snippet.php | 189 +++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 196 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 937e61b..732e017 100644 --- a/README.md +++ b/README.md @@ -59,15 +59,19 @@ require_once( ### Input color * `inputColor` - * Desctription: Input color as HEX, HSL or HSB/HSV. + * Desctription: Input color as HEX, HSL or HSB/HSV, with or without alpha-channel. Case-insensitive. Valid format examples: * `ffffff` * `#FFFFFF` + * `#FFFFFFFF` * `hsl(0, 0%, 100%)` + * `hsla(0, 0%, 100%)` * `HSL(0, 0, 100)` * `hsb(0, 0%, 100%)` + * `hsba(0, 0%, 100%)` * `hsv(0, 0%, 100%)` + * `hsva(0, 0%, 100%)` * `hsb(0, 0, 100)` * `hsv(0, 0, 100)` * Valid values: `string` @@ -124,6 +128,16 @@ All parameters can contain the following special operators: * Desctription: Offset of the lightness in persents (`[-100; +100]`). * Valid values: `string` * **Required** + +* `offset_a` + * Desctription: Operations of the alpha-channel offset separated by commas. + * Valid values: `stringCommaSeparated` + * Default value: `'+0'` + +* `offset_a[i]` + * Desctription: Offset of the alpha-channel in persents (`[-100; +100]`). + * Valid values: `string` + * **Required** ### Output @@ -144,6 +158,7 @@ All parameters can contain the following special operators: * `[+ddH+]` — hue * `[+ddS+]` — saturation * `[+ddL+]` — lightness + * `[+ddA+]` — alpha-channel * `[+ddIsDark+]` — is color dark (`0` || `1`)? * Valid values: * `stringChunkName` diff --git a/README_ru.md b/README_ru.md index 892d548..6a4403f 100644 --- a/README_ru.md +++ b/README_ru.md @@ -59,15 +59,19 @@ require_once( ### Исходный цвет * `inputColor` - * Описание: Исходный цвет в HEX, HSL или HSB/HSV. + * Описание: Исходный цвет в HEX, HSL или HSB/HSV, с альфа-каналом или без. Значение регистронезависимо. Примеры валидных значений: * `ffffff` * `#FFFFFF` + * `#FFFFFFFF` * `hsl(0, 0%, 100%)` + * `hsla(0, 0%, 100%)` * `HSL(0, 0, 100)` * `hsb(0, 0%, 100%)` + * `hsba(0, 0%, 100%)` * `hsv(0, 0%, 100%)` + * `hsva(0, 0%, 100%)` * `hsb(0, 0, 100)` * `hsv(0, 0, 100)` * Допустимые значения: `string` @@ -124,6 +128,16 @@ require_once( * Описание: Смещение яркости в процентах (`[-100; +100]`). * Допустимые значения: `string` * **Обязателен** + +* `offset_a` + * Описание: Операции смещения альфа-канала через запятую. + * Допустимые значения: `stringCommaSeparated` + * Значение по умолчанию: `'+0'` + +* `offset_a[i]` + * Описание: Смещение альфа-канала в процентах (`[-100; +100]`). + * Допустимые значения: `string` + * **Обязателен** ### Вывод результата @@ -144,6 +158,7 @@ require_once( * `[+ddH+]` — цветовой тон * `[+ddS+]` — насыщенность * `[+ddL+]` — яркость + * `[+ddA+]` — альфа-канал * `[+ddIsDark+]` — является ли цвет тёмным (`0` || `1`) * Допустимые значения: * `stringChunkName` diff --git a/src/Snippet.php b/src/Snippet.php index 6a2b528..6304596 100644 --- a/src/Snippet.php +++ b/src/Snippet.php @@ -13,6 +13,7 @@ class Snippet extends \DDTools\Snippet { 'offset_h' => '+0', 'offset_s' => '+0', 'offset_l' => '+0', + 'offset_a' => '+0', 'result_outputFormat' => 'hsl', 'result_tpl' => '', 'result_tpl_placeholders' => [], @@ -25,7 +26,7 @@ class Snippet extends \DDTools\Snippet { /** * prepareParams - * @version 1.0.1 (2023-05-14) + * @version 1.1 (2024-01-19) * * @param $this->params {stdClass|arrayAssociative|stringJsonObject|stringHjsonObject|stringQueryFormatted} * @@ -65,6 +66,7 @@ protected function prepareParams($paramsRenameMe = []){ 'offset_h', 'offset_s', 'offset_l', + 'offset_a', ] as $paramName ){ @@ -79,7 +81,7 @@ protected function prepareParams($paramsRenameMe = []){ /** * run - * @version 1.4 (2023-03-10) + * @version 1.5 (2024-01-19) * * @return {string} */ @@ -92,17 +94,33 @@ public function run(){ $hslRange = (object) [ 'h' => $this->params->offset_h, 's' => $this->params->offset_s, - 'l' => $this->params->offset_l + 'l' => $this->params->offset_l, + 'a' => $this->params->offset_l, ]; $hslMax = (object) [ 'h' => 360, 's' => 100, - 'l' => 100 + 'l' => 100, + 'a' => 100, ]; $resultColorHsl = static::stringToHsl($this->params->inputColor); + $isAlphaUsed = \DDTools\ObjectTools::isPropExists([ + 'object' => $resultColorHsl, + 'propName' => 'a' + ]); + + if ( + !$isAlphaUsed + && $this->params->offset_a != '+0' + ){ + $isAlphaUsed = true; + + $resultColorHsl->a = 100; + } + foreach( $resultColorHsl as $key => @@ -199,17 +217,32 @@ public function run(){ if($resultColorHsl->l > $hslMax->l){ $resultColorHsl->l = $hslMax->l; } + if( + $isAlphaUsed + && $resultColorHsl->a > $hslMax->a + ){ + $resultColorHsl->a = $hslMax->a; + } switch($this->params->result_outputFormat){ case 'hsl': $result = - 'hsl(' . - $resultColorHsl->h . - ',' . - $resultColorHsl->s . - '%,' . - $resultColorHsl->l . - '%)' + 'hsl' + . ( + $isAlphaUsed + ? 'a' + : '' + ) + . '(' + . $resultColorHsl->h . ',' + . $resultColorHsl->s . '%,' + . $resultColorHsl->l . '%' + . ( + $isAlphaUsed + ? $resultColorHsl->a . '%' + : '' + ) + . ')' ; break; @@ -225,13 +258,22 @@ public function run(){ ); $result = - 'rgb(' . - $result->r . - ',' . - $result->g . - ',' . - $result->b . - ')' + 'rgb(' + . ( + $isAlphaUsed + ? 'a' + : '' + ) + . '(' + . $result->r . ',' + . $result->g . ',' + . $result->b + . ( + $isAlphaUsed + ? $result->a + : '' + ) + . ')' ; break; } @@ -242,6 +284,7 @@ public function run(){ 'ddH' => $resultColorHsl->h, 'ddS' => $resultColorHsl->s, 'ddL' => $resultColorHsl->l, + 'ddA' => $resultColorHsl->a, 'ddIsDark' => intval( static::isRgbDark( static::hsbToRgb( @@ -273,7 +316,7 @@ public function run(){ /** * stringToHsl - * @version 1.0 (2023-03-10) + * @version 1.1 (2024-01-19) * * @param $paramString {string} — Color string in the HEX, HSL or HSB/HSV formats. @required * @@ -281,6 +324,7 @@ public function run(){ * @return $result->h {integer} * @return $result->s {integer} * @return $result->l {integer} + * @return $result->a {integer} — Can be absent. */ private static function stringToHsl($paramString): \stdClass { //If input color set as HSL || HSB/HSV @@ -301,8 +345,11 @@ private static function stringToHsl($paramString): \stdClass { //Remove unwanted chars $paramString = str_replace( [ + 'hsla', 'hsl', + 'hsba', 'hsb', + 'hsva', 'hsv', '%', '(', @@ -336,6 +383,16 @@ private static function stringToHsl($paramString): \stdClass { 'b' => $paramString[2] ]); } + + //Alpha-channel + if ( + \DDTools\ObjectTools::isPropExists([ + 'object' => $paramString, + 'propName' => 3 + ]) + ){ + $resultHsl->a = $paramString[3]; + } //AS RGB }else{ //Удалим из цвета символ '#' @@ -349,12 +406,31 @@ private static function stringToHsl($paramString): \stdClass { $resultHsl = static::hexToHsl($paramString); } + //Alpha-channel + if ( + \DDTools\ObjectTools::isPropExists([ + 'object' => $resultHsl, + 'propName' => 'a' + ]) + ){ + if ($resultHsl->a < 1){ + $resultHsl->a = $resultHsl->a * 100; + } + + if ( + !is_numeric($resultHsl->a) || + $resultHsl->a == 100 + ){ + unset($resultHsl->a); + } + } + return $resultHsl; } /** * hexToHsl - * @version 3.0.2 (2024-01-09) + * @version 3.1 (2024-01-19) * * @param $hexString {string} — Color in HEX format without first '#'. @required * @@ -362,8 +438,11 @@ private static function stringToHsl($paramString): \stdClass { * @return $result->h {integer} * @return $result->s {integer} * @return $result->l {integer} + * @return $result->a {integer} — Can be absent. */ private static function hexToHsl($hexString): \stdClass { + $resultHsl = new \stdClass(); + //Получаем цвета в 10чной системе $red = hexdec(substr( $hexString, @@ -380,6 +459,18 @@ private static function hexToHsl($hexString): \stdClass { 4, 2 )); + $alpha = substr( + $hexString, + 6, + 2 + ); + if (!empty($alpha)){ + $resultHsl->a = + hexdec($alpha) + / 255 + * 100 + ; + } //Находим максимальное и минимальное значения $max = max( @@ -393,8 +484,6 @@ private static function hexToHsl($hexString): \stdClass { $blue ); - $resultHsl = new \stdClass(); - //Вычисляем яркость (от 0 до 100) $resultHsl->l = round( ($max + $min) / 2 * 100 / 255 @@ -458,17 +547,19 @@ private static function hexToHsl($hexString): \stdClass { /** * hsbToRgb - * @version 2.0.1 (2023-03-10) + * @version 2.1 (2024-01-19) * * @param $paramHsb {stdClass|arrayAssociative} — Color in HSB format. @required * @param $paramHsb->h {integer} — Hue. @required * @param $paramHsb->s {integer} — Saturation. @required * @param $paramHsb->b {integer} — Brightness. @required + * @param $paramHsb->a {integer} — Alpha-channel. Default —. * * @return $result {stdClass} * @return $result->r {integer} * @return $result->g {integer} * @return $result->b {integer} + * @return $result->a {integer} — Can be absent. */ private static function hsbToRgb($paramHsb): \stdClass { $paramHsb = (object) $paramHsb; @@ -540,6 +631,20 @@ private static function hsbToRgb($paramHsb): \stdClass { } } + if ( + \DDTools\ObjectTools::isPropExists([ + 'object' => $paramHsb, + 'propName' => 'a' + ]) + && $paramHsb->a < 100 + ){ + $resultRgb->a = $paramHsb->a; + + if ($resultRgb->a < 1){ + $resultRgb->a = $resultRgb->a * 100; + } + } + //Переводим из системы счисления от 0 до 100 в от 0 до 255 foreach ( $resultRgb as @@ -562,6 +667,7 @@ private static function hsbToRgb($paramHsb): \stdClass { * @param $paramRgb->r {integer} — Hue. @required * @param $paramRgb->g {integer} — Saturation. @required * @param $paramRgb->b {integer} — Brightness. @required + * @param $paramRgb->a {integer} — Alpha-channel. Default —. * * @return $result {string} */ @@ -596,6 +702,7 @@ private static function rgbToHex($paramRgb): string { * @param $paramHsb->h {integer} — Hue. @required * @param $paramHsb->s {integer} — Saturation. @required * @param $paramHsb->b {integer} — Brightness. @required + * @param $paramHsb->a {integer} — Alpha-channel. Default —. * * @return $result {string} */ @@ -607,17 +714,19 @@ private static function hsbToHex($paramHsb): string { /** * hsbToHsl - * @version 1.0 (2023-03-10) + * @version 1.1 (2024-01-19) * * @param $paramHsb {stdClass|arrayAssociative} — Color in HSB format. @required * @param $paramHsb->h {integer} — Hue. @required * @param $paramHsb->s {integer} — Saturation. @required * @param $paramHsb->b {integer} — Brightness. @required + * @param $paramHsb->a {integer} — Alpha-channel. Default —. * * @return $result {stdClass} * @return $result->h {integer} * @return $result->s {integer} * @return $result->l {integer} + * @return $result->a {integer} — Can be absent. */ private static function hsbToHsl($paramHsb): \stdClass { $paramHsb = (object) $paramHsb; @@ -648,22 +757,38 @@ private static function hsbToHsl($paramHsb): \stdClass { } } + if ( + \DDTools\ObjectTools::isPropExists([ + 'object' => $paramHsb, + 'propName' => 'a' + ]) + && $paramHsb->a < 100 + ){ + $resultHsl->a = $paramHsb->a; + + if ($resultHsl->a < 1){ + $resultHsl->a = $resultHsl->a * 100; + } + } + return $resultHsl; } /** * hslToHsb - * @version 1.0 (2023-03-10) + * @version 1.1 (2024-01-19) * * @param $paramHsl {stdClass|arrayAssociative} — Color in HSL format. @required * @param $paramHsl->h {integer} — Hue. @required * @param $paramHsl->s {integer} — Saturation. @required * @param $paramHsl->l {integer} — Lightness. @required + * @param $paramHsl->a {integer} — Alpha-channel. Default —. * * @return $result {stdClass} * @return $result->h {integer} * @return $result->s {integer} * @return $result->b {integer} + * @return $result->a {integer} — Can be absent. */ private static function hslToHsb($paramHsl): \stdClass { $paramHsl = (object) $paramHsl; @@ -694,6 +819,20 @@ private static function hslToHsb($paramHsl): \stdClass { )); } + if ( + \DDTools\ObjectTools::isPropExists([ + 'object' => $paramHsl, + 'propName' => 'a' + ]) + && $paramHsl->a < 100 + ){ + $resultHsb->a = $paramHsl->a; + + if ($resultHsb->a < 1){ + $resultHsb->a = $resultHsb->a * 100; + } + } + return $resultHsb; } From 1773f0a0ae7c396f627ed449fa8d087d8927f061 Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sat, 20 Jan 2024 02:08:17 +0400 Subject: [PATCH 4/6] * README, CHANGELOG: CSS is included directly from GitHub. --- CHANGELOG.md | 2 +- CHANGELOG_ru.md | 2 +- README.md | 2 +- README_ru.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c20bc3..c95af55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,5 +53,5 @@ * \+ Initial commit. - + \ No newline at end of file diff --git a/CHANGELOG_ru.md b/CHANGELOG_ru.md index 92baac1..d6859e5 100644 --- a/CHANGELOG_ru.md +++ b/CHANGELOG_ru.md @@ -53,5 +53,5 @@ * \+ Начальный кэммит. - + \ No newline at end of file diff --git a/README.md b/README.md index 732e017..470c188 100644 --- a/README.md +++ b/README.md @@ -238,4 +238,4 @@ require_once( * [GitHub](https://github.com/DivanDesign/EvolutionCMS.snippets.ddColorTools) - \ No newline at end of file + \ No newline at end of file diff --git a/README_ru.md b/README_ru.md index 6a4403f..9976dc4 100644 --- a/README_ru.md +++ b/README_ru.md @@ -238,4 +238,4 @@ require_once( * [GitHub](https://github.com/DivanDesign/EvolutionCMS.snippets.ddColorTools) - \ No newline at end of file + \ No newline at end of file From 6d70069af94a2a48d3e66dc5160d485d99de9256 Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sat, 20 Jan 2024 02:11:49 +0400 Subject: [PATCH 5/6] * Minor changes (fixed inactive DivanDesign.biz links). --- README.md | 6 +++--- composer.json | 8 +------- ddColorTools_snippet.php | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 470c188..a8adb13 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ Converts the color to match the offset in tone, brightness, or saturation. ## Requires * PHP >= 5.6 -* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.biz/modx/ddtools) >= 0.60 -* [(MODX)EvolutionCMS.snippets.ddGetDocumentField](https://code.divandesign.biz/modx/ddgetdocumentfield) >= 2.11.1 +* [(MODX)EvolutionCMS.libraries.ddTools](https://code.divandesign.ru/modx/ddtools) >= 0.60 +* [(MODX)EvolutionCMS.snippets.ddGetDocumentField](https://code.divandesign.ru/modx/ddgetdocumentfield) >= 2.11.1 ## Installation @@ -232,7 +232,7 @@ require_once( ## Links -* [Home page](https://code.divandesign.biz/modx/ddcolortools) +* [Home page](https://code.divandesign.ru/modx/ddcolortools) * [Telegram chat](https://t.me/dd_code) * [Packagist](https://packagist.org/packages/dd/evolutioncms-snippets-ddcolortools) * [GitHub](https://github.com/DivanDesign/EvolutionCMS.snippets.ddColorTools) diff --git a/composer.json b/composer.json index 1161674..b27e87c 100644 --- a/composer.json +++ b/composer.json @@ -22,17 +22,11 @@ "rgb to hsl", "hsl to rgb" ], - "homepage": "https://code.divandesign.biz/modx/ddstartsnippet", + "homepage": "https://code.divandesign.ru/modx/ddstartsnippet", "support": { "chat": "https://t.me/dd_code" }, "authors": [ - { - "name": "DD Group", - "email": "code@DivanDesign.biz", - "homepage": "https://code.divandesign.biz", - "role": "Owner" - }, { "name": "Ilyas Ronef", "email": "ilyas@DivanDesign.ru", diff --git a/ddColorTools_snippet.php b/ddColorTools_snippet.php index 3d89752..a4dce46 100644 --- a/ddColorTools_snippet.php +++ b/ddColorTools_snippet.php @@ -5,9 +5,9 @@ * * @see README.md * - * @link https://code.divandesign.biz/modx/ddcolortools + * @link https://code.divandesign.ru/modx/ddcolortools * - * @copyright 2011–2023 DD Group {@link https://DivanDesign.biz } + * @copyright 2011–2023 Ronef {@link https://Ronef.ru } */ //Include (MODX)EvolutionCMS.libraries.ddTools From 027eb268f0724ec7ba0077926fe49d9702b34fdc Mon Sep 17 00:00:00 2001 From: Ilyas Ronef Date: Sat, 20 Jan 2024 02:12:22 +0400 Subject: [PATCH 6/6] Prerelease --- CHANGELOG.md | 8 ++++++++ CHANGELOG_ru.md | 8 ++++++++ README.md | 2 +- README_ru.md | 2 +- composer.json | 2 +- ddColorTools_snippet.php | 4 ++-- src/Snippet.php | 2 +- 7 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c95af55..5f937c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # (MODX)EvolutionCMS.snippets.ddColorTools changelog +## Version 3.2 (2023-03-10) +* \+ Parameters → `inputColor`: Supports values with alpha-channel. + * \+ `offset_a`: The new parameter. Allows you to modify alpha-channel. + * \+ `result_tpl` → Placeholders → `[+ddA+]`: The new placeholder. +* \* `\ddTools::getTpl` is used instead of `$modx->getTpl`. +* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.60 is required. + + ## Version 3.1 (2023-03-10) * \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.57 is required. * \* Attention! (MODX)EvolutionCMS.snippets.ddGetDocumentField >= 2.11.1 is required. diff --git a/CHANGELOG_ru.md b/CHANGELOG_ru.md index d6859e5..7c1bfa7 100644 --- a/CHANGELOG_ru.md +++ b/CHANGELOG_ru.md @@ -1,6 +1,14 @@ # (MODX)EvolutionCMS.snippets.ddColorTools changelog +## Версия 3.2 (2023-03-10) +* \+ Parameters → `inputColor`: Supports values with alpha-channel. + * \+ `offset_a`: The new parameter. Allows you to modify alpha-channel. + * \+ `result_tpl` → Placeholders → `[+ddA+]`: The new placeholder. +* \* `\ddTools::getTpl` is used instead of `$modx->getTpl`. +* \* Attention! (MODX)EvolutionCMS.libraries.ddTools >= 0.60 is required. + + ## Версия 3.1 (2023-03-10) * \* Внимание! Требуется (MODX)EvolutionCMS.libraries.ddTools >= 0.57. * \* Внимание! Требуется (MODX)EvolutionCMS.snippets.ddGetDocumentField >= 2.11.1. diff --git a/README.md b/README.md index a8adb13..ff6036d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Converts the color to match the offset in tone, brightness, or saturation. #### 1. Elements → Snippets: Create a new snippet with the following data 1. Snippet name: `ddColorTools`. -2. Description: `3.1 Converts the color to match the offset in tone, brightness, or saturation.`. +2. Description: `3.2 Converts the color to match the offset in tone, brightness, or saturation.`. 3. Category: `Core`. 4. Parse DocBlock: `no`. 5. Snippet code (php): Insert content of the `ddColorTools_snippet.php` file from the archive. diff --git a/README_ru.md b/README_ru.md index 9976dc4..a4c59bd 100644 --- a/README_ru.md +++ b/README_ru.md @@ -19,7 +19,7 @@ #### 1. Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами 1. Название сниппета: `ddColorTools`. -2. Описание: `3.1 Преобразует цвет в соответствии со смещением по тону, яркости или насыщенности.`. +2. Описание: `3.2 Преобразует цвет в соответствии со смещением по тону, яркости или насыщенности.`. 3. Категория: `Core`. 4. Анализировать DocBlock: `no`. 5. Код сниппета (php): Вставьте содержимое файла `ddColorTools_snippet.php` из архива. diff --git a/composer.json b/composer.json index b27e87c..e125149 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dd/evolutioncms-snippets-ddcolortools", "type": "modxevo-snippet", - "version": "3.1.0", + "version": "3.2.0", "description": "Converts the color to match the offset in tone, brightness, or saturation.", "keywords": [ "modx", diff --git a/ddColorTools_snippet.php b/ddColorTools_snippet.php index a4dce46..74bb40e 100644 --- a/ddColorTools_snippet.php +++ b/ddColorTools_snippet.php @@ -1,13 +1,13 @@