Skip to content
Snippets Groups Projects
Commit 133860c0 authored by David Galeano's avatar David Galeano
Browse files

Issue #3494266: Add icon color parameter to Iconify Icons extractor

parent c2ee1ab2
No related branches found
Tags 8.x-1.0
1 merge request!24Issue #3494266: Add icon color parameter to Iconify Icons extractor
Pipeline #370869 passed with warnings
# Collections from https://icon-sets.iconify.design/
iconify_flags:
enabled: true
label: Iconify Flags
extractor: iconify
config:
collections:
- flag
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
iconify_circle_flags:
enabled: true
label: Iconify Circle flags
extractor: iconify
config:
collections:
- circle-flags
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
iconify_geo:
enabled: true
label: Iconify Geo
extractor: iconify
config:
collections:
- geo
- gis
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
color:
title: "Color"
type: "string"
format: "color"
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip,
color: color
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
iconify_animated:
enabled: true
label: Iconify Animated
extractor: iconify
config:
collections:
- line-md
- meteocons
- svg-spinners
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
color:
title: "Color"
type: "string"
format: "color"
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip,
color: color
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
iconify_emoji:
enabled: true
label: Iconify Emoji
extractor: iconify
config:
collections:
- fluent-emoji
- fxemoji
- emojione-v1
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
iconify_programming:
enabled: true
label: Iconify Programming
extractor: iconify
config:
collections:
- vscode-icons
- devicon
- unjs
settings:
size:
title: "Size"
type: "integer"
default: 32
flip:
title: "Flip"
type: "string"
enum:
- original
- horizontal
- vertical
- horizontal,vertical
rotate:
title: "Rotate"
type: "string"
enum:
- 0deg
- 90deg
- 180deg
- 270deg
template: >-
{% set params = {
width: size,
height: size,
rotate: rotate,
flip: flip
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
......@@ -43,7 +43,7 @@ function iconify_icons_provider_icon_pack_alter(array &$icon_pack_definitions):
* The machine name in the format 'iconify_prefix_suffix'.
*/
function _iconify_icons_provider_generate_icon_pack_name(string $collection_name): string {
return 'iconify_' . strtolower(preg_replace('/[^a-z0-9_]/', '_', $collection_name));
return strtolower(preg_replace('/[^a-z0-9_]/', '_', $collection_name));
}
/**
......@@ -59,7 +59,7 @@ function _iconify_icons_provider_create_icon_pack_definition(string $collection)
// Build the icon pack definition based on the template structure.
return [
'enabled' => TRUE,
'label' => t('Iconify ' . $collection),
'label' => t('Iconify @collection', ['@collection' => $collection]),
'extractor' => 'iconify',
'config' => [
'collections' => [$collection],
......@@ -70,6 +70,12 @@ function _iconify_icons_provider_create_icon_pack_definition(string $collection)
'type' => 'integer',
'default' => 32,
],
'color' => [
'title' => 'Color',
'type' => 'string',
'default' => '#000000',
'format' => 'color',
],
'flip' => [
'title' => 'Flip',
'type' => 'string',
......@@ -93,7 +99,7 @@ function _iconify_icons_provider_create_icon_pack_definition(string $collection)
],
'template' => _iconify_icons_provider_build_icon_template(),
'provider' => 'iconify_icons_provider',
'id' => _iconify_icons_provider_generate_icon_pack_name($collection),
'id' => $collection,
];
}
......@@ -110,7 +116,8 @@ function _iconify_icons_provider_build_icon_template(): string {
width: size,
height: size,
rotate: rotate,
flip: flip
flip: flip,
color: color,
}|filter(v => v is not null) %}
<img src="{{ source }}?{{ params|url_encode }}" />
EOT;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment