Skip to content

Commit

Permalink
Implementing ISSUE #18 to migrate to Chrome V8 runtime, instead of th…
Browse files Browse the repository at this point in the history
…e old Rhino
  • Loading branch information
CarlosMendonca committed Nov 1, 2020
1 parent 3eb4bd0 commit c76e683
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/appsscript.json.release
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/presentations.currentonly"
]
],
"runtimeVersion": "V8"
}
3 changes: 2 additions & 1 deletion src/appsscript.json.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"access": "ANYONE",
"executeAs": "USER_ACCESSING"
},
"exceptionLogging": "STACKDRIVER"
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}
8 changes: 4 additions & 4 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function calculateLuminosity(color) {

// According to WCAG 2.0 (https://www.w3.org/TR/WCAG20-TECHS/G17.html)
function calculateRelativeLuminosity(rgbColorVector1, rgbColorVector2) {
var sRgbColorVector1 = rgbColorVector1.map(function(e) { return e / 255; });
var sRgbColorVector2 = rgbColorVector2.map(function(e) { return e / 255; });
var sRgbColorVector1 = rgbColorVector1.map((e) => { return e / 255; });
var sRgbColorVector2 = rgbColorVector2.map((e) => { return e / 255; });

sRgbColorVector1.forEach(function(e, index, array) { (e < 0.03928) ? array[index] = e/12.92 : array[index] = Math.pow(((e+0.055)/1.055),2.4); });
sRgbColorVector2.forEach(function(e, index, array) { (e < 0.03928) ? array[index] = e/12.92 : array[index] = Math.pow(((e+0.055)/1.055),2.4); });
sRgbColorVector1.forEach((e, index, array) => { (e < 0.03928) ? array[index] = e/12.92 : array[index] = Math.pow(((e+0.055)/1.055),2.4); });
sRgbColorVector2.forEach((e, index, array) => { (e < 0.03928) ? array[index] = e/12.92 : array[index] = Math.pow(((e+0.055)/1.055),2.4); });

var L1 = 0.2126 * sRgbColorVector1[0] + 0.7152 * sRgbColorVector1[1] + 0.0722 * sRgbColorVector1[2];
var L2 = 0.2126 * sRgbColorVector2[0] + 0.7152 * sRgbColorVector2[1] + 0.0722 * sRgbColorVector2[2];
Expand Down

0 comments on commit c76e683

Please sign in to comment.