{ "id": "174156", "key": "TIMOB-27519", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20950", "name": "Release 9.1.0", "archived": false, "released": true, "releaseDate": "2020-08-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2020-05-26T17:31:52.000+0000", "created": "2019-09-21T17:54:43.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "darkmode", "engSchedule", "parity" ], "versions": [], "issuelinks": [ { "id": "57851", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "174203", "key": "TIMOB-27501", "fields": { "summary": "Android: Be able to determine dark / light theme, as well as changes on it", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "updated": "2020-08-25T00:41:08.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [], "attachment": [ { "id": "67039", "filename": "0001-fix-android-semantic-colors-with-alpha-value.patch", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2019-10-10T09:53:12.000+0000", "size": 2504, "mimeType": "text/x-patch" } ], "flagged": false, "summary": "Android: Semantic Colors with alpha value", "creator": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "comment": { "comments": [ { "id": "451558", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Are you sure it doesn't use the alpha value? This works for us:\r\n{code:json}\r\n{\r\n \"mainColor\": {\r\n \"dark\": {\r\n \"color: \"#000000\",\r\n \"alpha: \"50\"\r\n },\r\n \"light\": {\r\n \"color: \"#ffffff\",\r\n \"alpha: \"50\"\r\n }\r\n }\r\n}\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-09-22T11:58:14.000+0000", "updated": "2019-09-22T11:58:14.000+0000" }, { "id": "451561", "author": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "updateAuthor": { "name": "michael", "key": "michael", "displayName": "Michael Gangolf", "active": true, "timeZone": "Europe/Berlin" }, "created": "2019-09-22T12:07:39.000+0000", "updated": "2019-09-22T12:07:39.000+0000" }, { "id": "451711", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "Ti.UI.fetchSemanticColor() on Android (and I assume iOS < 13) returns only {{\"color\"}}, and is loosing the {{\"alpha\"}}:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/3b925d3b89e0d59bf89b846bfa127e9656746dbf/common/Resources/ti.internal/extensions/ti/ti.ui.js#L55\r\n\r\nTo fix it, I put this code into my alloy.js (based on [iphone/cli/commands/_build.js#generateSemanticColors|https://github.com/appcelerator/titanium_mobile/blob/3b925d3b89e0d59bf89b846bfa127e9656746dbf/iphone/cli/commands/_build.js#L5802]):\r\n{code:javascript}\r\n(function() {\r\n const osVersion = parseInt(Ti.Platform.version.split('.')[0]);\r\n\r\n if (Ti.App.iOS && osVersion >= 13) {\r\n return;\r\n }\r\n const colorset = require('/semantic.colors.json');\r\n const shorthandRegex = /^#?([a-f\\d])([a-f\\d])([a-f\\d])$/i;\r\n const fallbackColor = 'black'; // To match iphone/Classes/TiUIiOSProxy.m#fetchSemanticColor\r\n\r\n const hexToRgb = function hexToRgb(hex) {\r\n let alpha = 1;\r\n let color = hex;\r\n if (hex.color) {\r\n alpha = hex.alpha / 100; // convert from 0-100 range to 0-1 range\r\n color = hex.color;\r\n }\r\n // Expand shorthand form (e.g. \"03F\") to full form (e.g. \"0033FF\")\r\n color = color.replace(shorthandRegex, (m, r, g, b) => r + r + g + g + b + b);\r\n\r\n const r = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(color);\r\n return r ? `rgba(${parseInt(r[1], 16)}, ${parseInt(r[2], 16)}, ${parseInt(r[3], 16)}, ${alpha.toFixed(3)})`: null;\r\n };\r\n Ti.UI.fetchSemanticColor = function(name) {\r\n if (!colorset[name]) {\r\n return fallbackColor;\r\n }\r\n const color = colorset[name][Ti.UI.semanticColorType];\r\n if (typeof color === 'string') {\r\n return color;\r\n }\r\n if (!color || typeof color !== 'object') {\r\n return fallbackColor;\r\n }\r\n if (color['color'] && color['alpha']) {\r\n const result = hexToRgb(color);\r\n if (result) {\r\n return result;\r\n }\r\n }\r\n return fallbackColor;\r\n }\r\n})();\r\n\r\nif (Alloy && Alloy.CFG && Alloy.CFG.color) {\r\n const colorset = require('/semantic.colors.json');\r\n\r\n Object.keys(colorset).forEach(name => {\r\n const color = Ti.UI.fetchSemanticColor(name);\r\n console.log(`Alloy.CFG.color[${name}]: ${color}`);\r\n Alloy.CFG.color[name] = color;\r\n });\r\n}\r\n{code}", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2019-09-30T16:21:42.000+0000", "updated": "2019-10-01T17:02:42.000+0000" }, { "id": "451946", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "I attached patch for the SDK with fix for this issue.\r\nWill send a PR after the ticket is approved (don't like commits without reference to ticket).", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2019-10-10T10:06:49.000+0000", "updated": "2019-10-10T10:06:49.000+0000" }, { "id": "452431", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello [~s.volkov], Please share the PR here. Moving to TIMOB. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2019-11-03T00:12:37.000+0000", "updated": "2019-11-03T00:12:37.000+0000" }, { "id": "452469", "author": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/11315", "updateAuthor": { "name": "s.volkov", "key": "s.volkov", "displayName": "Sergey Volkov", "active": true, "timeZone": "Europe/Moscow" }, "created": "2019-11-05T10:58:22.000+0000", "updated": "2019-11-05T10:58:22.000+0000" }, { "id": "455539", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "https://github.com/appcelerator/titanium_mobile/pull/11315", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-05-21T19:48:44.000+0000", "updated": "2020-05-21T19:48:44.000+0000" }, { "id": "455556", "author": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "body": "merged to master for 9.1.0 target", "updateAuthor": { "name": "cwilliams", "key": "cwilliams", "displayName": "Christopher Williams", "active": true, "timeZone": "America/New_York" }, "created": "2020-05-26T17:31:52.000+0000", "updated": "2020-05-26T17:31:52.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }