|
7 | 7 | "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWludmVydC1jb2xvcnMiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNMTIsMTkuNThWMTkuNThDMTAuNCwxOS41OCA4Ljg5LDE4Ljk2IDcuNzYsMTcuODNDNi42MiwxNi42OSA2LDE1LjE5IDYsMTMuNThDNiwxMiA2LjYyLDEwLjQ3IDcuNzYsOS4zNEwxMiw1LjFNMTcuNjYsNy45M0wxMiwyLjI3VjIuMjdMNi4zNCw3LjkzQzMuMjIsMTEuMDUgMy4yMiwxNi4xMiA2LjM0LDE5LjI0QzcuOSwyMC44IDkuOTUsMjEuNTggMTIsMjEuNThDMTQuMDUsMjEuNTggMTYuMSwyMC44IDE3LjY2LDE5LjI0QzIwLjc4LDE2LjEyIDIwLjc4LDExLjA1IDE3LjY2LDcuOTNaIiAvPjwvc3ZnPg==", |
8 | 8 | "name": "ColorConversion", |
9 | 9 | "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/invert-colors.svg", |
10 | | - "shortDescription": "Expressions to convert color values between various formats (RGB, HSV, HSL, named colors) and get colors between 2 others.", |
11 | | - "version": "1.2.1", |
12 | | - "description": "Expressions to convert color values between various formats (RGB, HSV, HSL, named colors) and get colors between 2 others.", |
| 10 | + "shortDescription": "Expressions to convert color values between various formats (RGB, HSV, HSL, named colors), calculate luminance according to WCAG 2.0 standards, and to blend two colors.", |
| 11 | + "version": "1.3.1", |
| 12 | + "description": "Expressions to convert color values between various formats (RGB, HSV, HSL, named colors), calculate luminance according to WCAG 2.0 standards, and to blend two colors.", |
13 | 13 | "origin": { |
14 | 14 | "identifier": "ColorConversion", |
15 | 15 | "name": "gdevelop-extension-store" |
|
21 | 21 | "rgb", |
22 | 22 | "hsl", |
23 | 23 | "hsv", |
24 | | - "hsb" |
| 24 | + "hsb", |
| 25 | + "luminance", |
| 26 | + "wcag", |
| 27 | + "blend" |
25 | 28 | ], |
26 | 29 | "authorIds": [ |
27 | 30 | "gqDaZjCfevOOxBYkK6zlhtZnXCg1", |
28 | 31 | "AlZ3D1xkH0QDao7T37VZZUeYNpn1", |
29 | | - "IWykYNRvhCZBN3vEgKEbBPOR3Oc2" |
| 32 | + "IWykYNRvhCZBN3vEgKEbBPOR3Oc2", |
| 33 | + "onPsboRtDkUHNOsx7OPr8R8G1oj2" |
30 | 34 | ], |
31 | 35 | "dependencies": [], |
32 | 36 | "eventsFunctions": [ |
|
81 | 85 | "objectGroups": [] |
82 | 86 | }, |
83 | 87 | { |
84 | | - "description": "Apply a weighted mean between 2 RGB colors.", |
85 | | - "fullName": "RGB mean", |
| 88 | + "description": "Calculate luminance of a RGB color. Example input: \"0;128;255\".", |
| 89 | + "fullName": "Luminance from RGB", |
| 90 | + "functionType": "Expression", |
| 91 | + "name": "RgbToLuminance", |
| 92 | + "sentence": "", |
| 93 | + "events": [ |
| 94 | + { |
| 95 | + "type": "BuiltinCommonInstructions::JsCode", |
| 96 | + "inlineCode": [ |
| 97 | + "function toLuminance(color) {", |
| 98 | + " // Convert the color string to an array of RGB values", |
| 99 | + " let [r, g, b] = color.split(\";\");", |
| 100 | + " let luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;", |
| 101 | + " return luminance;", |
| 102 | + "}", |
| 103 | + "", |
| 104 | + "const color = eventsFunctionContext.getArgument(\"color\");", |
| 105 | + "eventsFunctionContext.returnValue = toLuminance(color);" |
| 106 | + ], |
| 107 | + "parameterObjects": "", |
| 108 | + "useStrict": true, |
| 109 | + "eventsSheetExpanded": false |
| 110 | + } |
| 111 | + ], |
| 112 | + "expressionType": { |
| 113 | + "type": "expression" |
| 114 | + }, |
| 115 | + "parameters": [ |
| 116 | + { |
| 117 | + "description": "RGB color", |
| 118 | + "name": "color", |
| 119 | + "type": "color" |
| 120 | + } |
| 121 | + ], |
| 122 | + "objectGroups": [] |
| 123 | + }, |
| 124 | + { |
| 125 | + "description": "Calculate luminance of a hexadecimal color. Example input: \"0459AF\".", |
| 126 | + "fullName": "Luminance from hexadecimal", |
| 127 | + "functionType": "Expression", |
| 128 | + "name": "HexToLuminance", |
| 129 | + "sentence": "", |
| 130 | + "events": [ |
| 131 | + { |
| 132 | + "type": "BuiltinCommonInstructions::JsCode", |
| 133 | + "inlineCode": [ |
| 134 | + "function hexToLuminance(color) {", |
| 135 | + " // Convert the color string to an array of RGB values", |
| 136 | + " let [r, g, b] = color.slice(1).match(/.{2}/g).map(x => parseInt(x, 16));", |
| 137 | + " let luminance = 0.2126 * r + 0.7152 * g + 0.0722 * b;", |
| 138 | + " return luminance;", |
| 139 | + "}", |
| 140 | + "", |
| 141 | + "const color = eventsFunctionContext.getArgument(\"color\");", |
| 142 | + "eventsFunctionContext.returnValue = hexToLuminance(color);" |
| 143 | + ], |
| 144 | + "parameterObjects": "", |
| 145 | + "useStrict": true, |
| 146 | + "eventsSheetExpanded": true |
| 147 | + } |
| 148 | + ], |
| 149 | + "expressionType": { |
| 150 | + "type": "expression" |
| 151 | + }, |
| 152 | + "parameters": [ |
| 153 | + { |
| 154 | + "description": "Hex value", |
| 155 | + "name": "color", |
| 156 | + "type": "string" |
| 157 | + } |
| 158 | + ], |
| 159 | + "objectGroups": [] |
| 160 | + }, |
| 161 | + { |
| 162 | + "description": "Blend two RGB colors by applying a weighted mean.", |
| 163 | + "fullName": "Blend RGB colors", |
86 | 164 | "functionType": "StringExpression", |
87 | 165 | "name": "RgbMean", |
88 | 166 | "sentence": "", |
|
134 | 212 | }, |
135 | 213 | { |
136 | 214 | "description": "Ratio", |
137 | | - "longDescription": "0 gives the first color, 1 gives the second color", |
| 215 | + "longDescription": "Range: 0 to 1, where 0 gives the first color and 1 gives the second color", |
138 | 216 | "name": "Ratio", |
139 | 217 | "type": "expression" |
140 | 218 | } |
|
0 commit comments