Updating styles resets all text overrides

Hello. I’m not sure this is a desired behaviour or if there is any way to change it. I am trying to use less text styles in my documents, since options such as colour, underline, and alignment can be overridden.

However, whenever I edit something in these styles and they are updated from the library, all the texts that use that style have their overrides reset. Is there any way around in that doesn’t involve creating variants of each text style?

Hi Camila, this is the expected behavior and it helps keep consistency with the library when you make changes: all layers or symbols that use the updated text styles will be updated too.

But I see your point, you want to have less styles but then updating the library erases any changes you made to help reduce the number of styles.

One way around it could be to detaching layers with out of sync styles before updating the library; and then decide whether those changes will likely be reused in the future and create a new style from them or if it was just a one off change and the layer can remain detached.

Hey, Camila,

Is your problem related to the fact that text styles must also always contain the corresponding colour in Sketch? This is a very annoying problem in Sketch that we Sketch users have been facing for years… Without a solution.

My workaround for this is this: wherever you use text layers based on text styles and want to assign the colour, do NOT assign it to the text, but group the text layer and assign a tint to the group. Then the colours will be preserved even if you change the underlying text style.

Unfortunately, the developers cannot read the colour of the text coloured in this way in the Inspect mode of the web app.

For other variants bold, italic … I unfortunately don’t have a workaround. For that you have to create individual text styles.

PLEASE Sketch-Team please remove the link between text styles and text colour.

Hi @Xhaust , this topic has definitely been discussed: how to improve text styles to allow flexibility when needed but also help enforce consistency for scenarios / teams that require them. I’ll share this one with the team too.

1 Like

Hi @dfmedrano, when thinking of text styles and how they are implemented in stylesheets, we hardly define all the aspects of the text the way Sketch defines styles. A H1 CSS style will hardly ever define the colour or orientation of the text, as these are specific on the use context.

Personally, my biggest issue with this is the orientation of the texts. I understand underline being reset, I don’t think styles shouldn’t carry over colour, but this is a discussion on another thread.

Having a variable for each text orientation (left, center, right), multiplied by colour (primary, secondary, disabled, white), creates so way too many different styles. A single H1 would have 12 different styles. And then multiply it with headers from H1 to H6, subtitles, body, labels, inputs, buttons, links, table texts, and many other elements which will contain 12 styles each.

Detaching the text means any global change in the design, or in my case, whenever we duplicate the library for a new project with a different font-family, means the unattached text in the design will have to be hand-picked and changed manually.

Sketch has the feature which allows users to enable/disable overrides from symbols. I’d like to see an option that specifies which text characteristics are carried over in the style, so the user can make these the decision of forgoing the current strict consistency for a flexibility that is closer to the actual implementation of text styles.

3 Likes

Hi @Camila, thanks for sharing the context! Indeed, CSS works quite differently from text styles, and thinking about it, perhaps it’s not necessary to map text styles to CSS, because they work quite different and CSS allows you to build all you need from a few basic blocks and reuse them through inheritance.

So I’m thinking that, strictly for CSS, there’s no need to read the whole list of styles, but just extract these specs independently, that is, they don’t need to be extracted from a long list of text styles, CSS rules can be built from these specifications:

  • Font
  • List of weights
  • List of sizes
  • Text decoration

Now color, that can be extracted from color variables, as isolated components, and those can be defined, used and inherited in CSS.

Alignment for example, can be implemented as a modifier class that does just that one thing text-align:value; and you can add it to a text HTML tag only when necessary.

With these building blocks, all the rules that will target text selectors can be created. Of course, when using Sketch there’s still the issue of having more styles than we want, just to make sure we can keep it consistent, and in this matter we do want to improve and support better flexibility and consistency when using text styles.