Skip to content

Can not read generated file with layer style. TypeError: Cannot read property 'MSAttributedStringColorAttribute' of undefined #139

@Koshub

Description

@Koshub

Hello. Reading generated file with a shared layer style produces an error.

if (fs.existsSync(path)) {
  Sketch.fromFile(path)
  .then(sketch => {
    console.log(sketch)
  })
  .catch(error => console.log(error))    
} else {
  const sketch = new Sketch()
  sketch.addLayerStyle({
    name: 'Test Layer Style',
    fills: [
      {
        color: '#008AE7'
      }
    ],
    borders: [
      {
        color: '#859099'
      }
    ]        
  })
  sketch.build(path)
}

Error on reading:

TypeError: Cannot read property 'MSAttributedStringColorAttribute' of undefined
    at new TextStyle (/node_modules/sketch-constructor/models/TextStyle/TextStyle.js:56:32)
    at new Style (/node_modules/sketch-constructor/models/Style/Style.js:81:44)
    at new SharedStyle (/node_modules/sketch-constructor/models/SharedStyle/SharedStyle.js:42:20)
    at /node_modules/sketch-constructor/models/Document/Document.js:68:80
    at Array.map (<anonymous>)
    at new Document (/node_modules/sketch-constructor/models/Document/Document.js:68:59)
    at /node_modules/sketch-constructor/models/Sketch/Sketch.js:39:29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions