I created a library of custom colours in Objective-C that I now want to use in JavaScript. Each custom colour is defined like so
+ (UIColor *)darkYellow
{
return [UIColor colorWithRed:(235.0/255.0) green:(235.0/255.0) blue:(0.0/255.0) alpha:1.0];
}
Rather than rewrite the library, is it possible to read the above RGBA tuplet from a file named UIColor+CustomColors.m and return a value that can be used in JavaScript?
e.g.
var view = document.getElementById("myCanvas");
var context = view.getContext("2d");
context.beginPath();
var colour = // values returned from RGBA tuplet
context.fillStyle = colour;
context.rect(20, 20, 150, 100);
context.fill();