网页 综合 更新时间 2026-11-12 00:00:00

Color Variables · Sketch

自动蜘蛛 www.sketch.com 正文约 5558 字
Color Variables · Sketch
With Color Variables, you can set colors and gradients that synchronize across your document. When you make changes to a Color Variable, those changes appear across all of the layers that use it. You can create Color Variables that are local to a specific document or share them in a Library to use across different documents.
Color Variables are also available in the web app Inspector, useful during handoff.
You can create a new Color Variable from the color well in the Inspector, from the Components View, or from Edit > Find and Replace Color.
Select any layer and click on the color well in the Inspector. Select the solid color you want to use, then click to add a Color Variable. Type a name and click Add or press ↵ to save. You can also use the eyedropper tool to create Color Variables from your display, inside or outside of the Mac app.
How to create a Color Variable from the Inspector.
Switch to Components View
Click the Color Variables tab in the toolbar, then click
Set the color you want in the color panel that appears in the Inspector, then type a name
Press ↵ or click anywhere in the Previews Grid to save
How to create a Color Variable from the Components View.
To group your Color Variables:
Switch to Components View and click the Color Variables tab
Hold ⇧ and click the Color Variables you want to group
Control-click your selection and choose Group from the context menu
Double-click the group title in the left sidebar to rename it
You can also drag Color Variables into existing groups in the left sidebar.
How to group Color Variables in the Components View.
Like Symbols or Text Styles, you can also group Color Variables by using a / in their names. Anything before / will become the group name, and anything after will be the name of the Component within that group. For example, Primary/light and Primary/dark will become part of a group named Primary.
Color Variables and groups will organize automatically in alphabetical order. You can use numbers in front of Color Variables so they appear in the order that works best for you. For example, 1 Primary or 2 Secondary. You can also add numbers to the end of similarly named variables, such as Neutral-100, Neutral-200.
Color Variables appear in the Inspector wherever a color is applied — fills, borders, etc. They also show up in the Colors section, so you can quickly spot them and change them across your whole selection at once.
Select a layer, then apply a Color Variable in one of these ways:
You can switch between Color Variables from your document or any enabled Library.
How to apply a Color Variable from the Inspector.
Note: When you use a Color Variable for the color of a text layer and then create a new text layer in the same document, your new text layer will also use that Color Variable.
You can apply a Color Variable by picking it directly from the Canvas with the eyedropper:
Press ⌃C or click the eyedropper in the color panel.
Hover over a layer that uses a Color Variable — the loupe labels show the variable name alongside the color value.
Hold ⇧ and click to apply the Color Variable. Without ⇧, you’ll pick the raw color value instead.
In the Find and Replace menu, click on the color well next to “Replace with”, and select the Color Variable you want to apply. Click anywhere to close the color picker, and hit Replace to update the colors.
You can edit Color Variables from the Inspector, the Components View or Find and Replace menu.
You can Control-click on any Color Variable and choose Copy Value to copy its value as HEX, RGB, HSL, Objective-C, Swift or SwiftUI.
Select any layer, and click on a color well in the Inspector. In the color picker, click Edit and pick a new color. Choose Update to save. Keep in mind you can only edit Color Variables that are local to your document. If you want to edit Color Variables from a Library, you will have to edit them in their Library document.
How to edit a Color Variable from the Inspector.
Switch to the Components View and click on the Color Variables tab. Click on the color swatch you want to edit and choose the new color using the Inspector. Changes will preview and save automatically.
To rename a Color Variable, switch to the Components View and click on the Color Variables tab. Select the color swatch you want to rename, then type the new name in the Name field at the top of the Inspector. Your changes save automatically. You can also Control-click the color swatch and choose Rename.
To delete a Color Variable, switch to the Components View, and click on the Color Variables tab. Select the swatch of the Color Variable you want to delete and hit backspace. You can also Control-click on the color swatch and select Delete.
Choose Edit > Find and Replace Color to bring up the Find and Replace Color menu, or open the Command Bar and type “replace” to find it quickly. From there, select the color or Color Variable you want to find within your design and the color or Color Variable you want to replace it with.
Enable “Include all opacities of this color” to find all colors with different alphas, but the same RGB or HEX values.
Enable “Preserve original opacity” to keep those different alphas intact when you replace the color.
Note: We built a plugin to help you migrate to Color Variables. They’ve been around for a while, but this plugin makes it easier to apply them consistently across your documents. It automatically assigns Color Variables to any layers, Text Styles, or Layer Styles using the same color — even if they weren’t using a Color Variable before.
访问原文 返回搜索 https://www.sketch.com/docs/symbols-and-styles/color-variables/
本页为82搜索生成的网页快照,内容来自站内索引;演示数据的原文链接仅作示例。