Color Variables & Layer Styles (Reusable Appearance)

Free Sketch Tutorial

This exercise is excerpted from Noble Desktop’s past web design training materials and is compatible with Sketch updates through 2021. Noble Desktop now teaches Figma as the primary tool for web and UX & UI design. To learn current skills in web design, check out our Figma Bootcamp and graphic design classes in NYC and live online.

Note: These materials are provided to give prospective students a sense of how we structure our class exercises and supplementary materials. During the course, you will get access to the accompanying class files, live instructor demonstrations, and hands-on instruction.

Topics covered in this Sketch tutorial:

Creating & Using Color Variables (Color Swatches), Creating a layer style, Making a style to darken full-width background photos, Renaming, Grouping, & Deleting Styles,

Exercise Preview

preview shared graphic styles

Exercise Overview

To globally updates colors throughout a file, we can use color variables. When we want multiple objects to have the same styling (fill color, border, drop shadow, etc.), we can use layer style. You’ll learn about both of these in this exercise.

Creating a Color Variable (Color Swatches)

  1. In Sketch, go to File > Open Local Document.
  2. Navigate into Desktop > Class Files > Sketch Class > iTastify and double–click on iTastify Ready for Layer Styles.sketch to open it.

    This webpage design is for an iPhone app called iTastify.

  3. Below the navigation, click on the peach background rectangle (under the Be Your Own Food Critic heading and iPhone photo).
  4. In the Sidebar, notice that the iphone-mockup group is selected.
  5. In the Inspector notice that Select group’s content on click is not checked.

    This group contains an image with a mask, so it’s not grouped solely for organizational purposes. We want to select the mask because that has the background color, but we don’t want to enable select group’s content.

  6. Instead of going into the Sidebar and selecting the Mask, we can hold Cmd to temporarily click-through a group and select an item inside! Cmd–click on the peach colored area to the left of the hand image.
  7. In the Sidebar, make sure the iphone-mockup group’s Mask is selected.
  8. In the Inspector, notice the fill color is the peach color.
  9. We want to save this color so we can easily reuse it elsewhere (and globally update it). In the Inspector, under Fills, click the color box color selector to open the color picker.
  10. Near the bottom of the color picker, click Create Color Variable.
  11. A name field will appear. Name it section bg and hit Return to apply.
  12. To close the color picker, press Esc or click anywhere outside it.
  13. Scroll down the page and find the sky blue section with three circular photos.
  14. Click on the blue background to select it.
  15. To make it the same peach color we used above, in the Inspector, under Fills, click the color box color selector to open the color picker.
  16. At the bottom of the color picker (you may have to scroll down to see it), under This Document click on the peach colored swatch.

    The blue background should now have changed to peach.

Editing a Color Variable

Now that we can see the peach color in multiple places, we’ve decided to change it to gray instead. One of the reasons to use a color variable is that editing it will globally update all places you’ve used that color!

  1. With the peach colored testimonials-bg still selected, if you closed the Fill color picker, re-open it.
  2. Towards the bottom of the color picker click Edit Variable.
  3. Change Hex to ebebeb and hit Return to apply it (or click Update).
  4. To close the color picker, press Esc.
  5. Scroll back up to the top of the page and notice that the background color under Be Your Own Food Critic has also changed to the gray! That’s because it’s linked to the same color variable.

Making a Layer Style

When you want to save the appearance of more than just a color (such as fill, border, shadows, etc.) you’ll want to use a layer style.

  1. Scroll down to the Rate What You Ate section with 4 icons with circle borders.

    These icons are a bit hard to see over the photo background. Let’s make them stand out a bit more.

  2. Click on the circle for the Appetizers icon.
  3. In the Sidebar, notice it too is in a group.
  4. As shown below, hover over the Appetizers icon’s circle border and Cmd–click when it is highlighted in blue. This should select only the Oval shape.

    itastify select appetizers oval

  5. In the Inspector, under Fills:

    • Check on the checkbox to turn the fill on.
    • The color should be solid white. To the right of the fill, set Opacity to 20%.
  6. In the Inspector, find the menu that says No Layer Style.
  7. Below that menu click the Create button layer style new to create a style.
  8. Name it category icon bg and hit Return to apply.
  9. Let’s apply the style to the other circle. To select them:

    • Cmd–click on the Entrees circle.
    • Then Cmd–Shift–click on the other circles (Drinks and Desserts).
  10. In the Inspector, click on the No Layer Style menu and choose This Document > category icon bg style.
  11. Click on a blank area of the canvas to deselect everything.
  12. Now we want to make a change to the style. Cmd–click on any of the circles. Because they’re all associated with the style, it does not matter which one you select.
  13. Let’s try a dark background instead of the current light background. Click the Fill color box and:

    • Set the color to black.
    • Change Alpha (transparency) to 50.
    • Close the color picker when done.
  14. In the Inspector to the right of Shadows, click the plus button.
  15. Change the following options:

    Y: 0
    Blur: 60
  16. Click the Shadows’ color box color selector, then change Alpha to 100.
  17. Close the color picker when done.
  18. In the Inspector, below the category icon bg menu click the Update button layer style update.
  19. Let’s make the border thinner. Under Borders, click into the Width field to put the cursor there.
  20. Hit the Down Arrow key to reduce the Width value to 2.
  21. In the Inspector, click the Update button layer style update or hit Ctrl–S (for Sync).

    NOTE: If you do not update the style, the individual layer will appear different than the style, but only if you never update that style again! If a layer is not in sync with the style, it will still be updated (and become in sync with the style) the next time you update the style (even if you update the style from a different layer). So if you really want a layer to be different than the style, click the Detach button layer style detach below the style’s menu.

Rounded Corners Are Not Part of a Layer Style

Please note that Corners setting (for rounding corners) cannot be saved into a layer style. In the Inspector, only the options in the Style section are saved into a style. While rounded corners cannot be saved as a style, we can make reusable buttons using symbols (which you’ll learn about in a later exercise).

Making a Style to Darken Full-Width Background Photos

  1. Make sure you can see the Rate What You Ate section with 4 icons with circle borders.
  2. To select the photo within its mask, double–click on the photo behind the icons.
  3. In the Inspector, to the right of Fills, click the plus button.
  4. Set the color to black.
  5. Set Alpha to 40.
  6. Close the color picker.
  7. Below the No Layer Style menu click the Create button layer style new.
  8. Name it darken image and hit Return to apply.
  9. Scroll down near the bottom of the page and under Start Remembering Now.
  10. Double–click on the full-width photo background (to select the photo in the mask).
  11. In the Inspector, click on the No Layer Style menu and select This Document > darken image.
  12. Let’s also make the photos black and white. At the bottom of the Inspector, check on Color Adjust.
  13. Reduce Saturation to -100% and notice the photo has become black and white.
  14. To update (sync) the style click the Update button layer style update or hit Ctrl–S.
  15. Scroll up to the Rate What You Ate section to see that its photo background has also changed to black and white.
  16. Nice! Save and close the file.

Renaming, Grouping, & Deleting Styles

  1. At the top-left of the Toolbar, click on the Components button show components button.

    show components location

  2. In the middle of the Toolbar, click on the Colors button show colors.
  3. Here’s where you can manage color variables (delete, rename, group, etc.).
  4. In the middle of the Toolbar, click on the Layers button show layer styles.
  5. Select the category icon bg style.
  6. In the Inspector on the right, change the name to rating icon and hit Return.
  7. Let’s put these styles into a group. Select the darken image style.
  8. Hold Shift and click on rating icon so both styles are selected.
  9. Choose Arrange > Group.
  10. In the Sidebar on the left, double–click on the Group name and change it to Backgrounds

    NOTE: To delete a style, select it and press the Delete key, or Right–click (or Control–click) on a style and choose Delete.

  11. At the top-left of the Toolbar, click on the Canvas button show canvas button.

    show canvas location

  12. Hit Cmd–S to save the file.

Reset Layer Style

If an object with a layer style has overrides (meaning it now looks different than the layer style), you can remove the overrides using either of these methods:

  • Hit Ctrl–Option–S
  • In the Inspector, below the style’s menu, click the More button layer style more and choose Reset Style.

This will reset the object’s appearance to how the layer style looks.

Yelp Facebook LinkedIn YouTube Twitter Instagram