Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text Layer style.textColor reads previous color on Undo #792

Open
davebaraka opened this issue Jul 10, 2020 · 0 comments
Open

Text Layer style.textColor reads previous color on Undo #792

davebaraka opened this issue Jul 10, 2020 · 0 comments

Comments

@davebaraka
Copy link

When changing the textColor through the api and then 'undoing' (cmd + z), Sketch API will read the color before 'undoing' while the Sketch UI shows the correct previous color.

For example, if you run the following script on a project with just a text layer with a textColor = '#ffffff' (white)

var document = require('sketch/dom').getSelectedDocument()
document.selectedPage.layers.forEach(layer => {
  layer.style.textColor = "#000000"
  console.log(layer.style.textColor)
})

The textColor will appropriately change to black, '#000000'. Though, if you do an undo (cmd + z), to change the textColor back to white, sketch will show the appropriate white color on the layer and in the inspector, but the api will read black when running the following script

var document = require('sketch/dom').getSelectedDocument()
document.selectedPage.layers.forEach(layer => {
  console.log(layer.style.textColor)
})

This does not seem to happen on fills or borders...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant