I'm trying to create a plugin for Sketch, and I'd like to know how to change the color space of a Sketch document file to P3. Can anyone help?
var onRun = function(context) {
    var doc = context.document;
    doc.changeColorSpace(ColorSpace.P3, true);
    var colorName = [doc colorSpace];
    doc.showMessage("Color space changed to Display " + colorName);
}
Why isn’t the code working??
                        
The problem with the code you posted seems to be that you're trying to call a new Sketch JS API method (
changeColorSpace()) on an object derived from the old API (context).Here's how I'd rewrite your snippet to use the modern Sketch API only: