Color & Effects

Fills and strokes

Every rectangle, ellipse, path, frame and text in Nox has a list of fills and a list of strokes. One flat color is where a surface starts. A second and third fill on the same node, a soft bloom of color or a sheen of white, is where it starts to look finished, and it costs no extra layers in the tree.

One fill, then a radial bloom on top of it, then a white sheen on top of both: three fills on one rectangle
One fill, then a radial bloom on top of it, then a white sheen on top of both: three fills on one rectangle

Several fills on one node#

Fills are drawn in order, the last on top. A paint can be a solid color, a gradient (see Gradients) or an image (see Images, masks and blend modes), and each has its own opacity, so an upper fill can tint, shade or light the one under it.

By hand
  1. Select a shape. In the inspector's Fill section, click + to add a paint.
  2. Click the row's swatch to open the color picker, and choose a color, a kind of gradient or an image.
  3. Type the paint's opacity at the right of its row. The eye hides a paint without removing it; the minus removes it.

The inspector lists the paint drawn last first, as the layer list puts the top layer first.

The Fill and Stroke sections of the inspector, with the stroke's More open
The Fill and Stroke sections of the inspector, with the stroke's More open
With an agent
Make a 320 × 200 card with 28 corners: indigo #4B49E8, a pink bloom from the top-right corner, and a white sheen that fades out halfway down. Give it a 1 pt white edge at 20% inside.

The agent calls create_nodes, with three entries in fills:

{
  "nodes": [{
    "kind": "rectangle", "name": "Hero card", "x": 0, "y": 0, "width": 320, "height": 200, "corner_radius": 28,
    "fills": [
      "#4B49E8",
      {"gradient": "radial", "from": [0.85, 0.1], "to": [0.15, 1.0], "stops": ["#FF7AC6", "#FF7AC600"]},
      {"gradient": "linear", "angle": 180, "stops": [{"offset": 0, "color": "#FFFFFF66"}, {"offset": 0.55, "color": "#FFFFFF00"}]}
    ],
    "stroke": "#FFFFFF33", "stroke_width": 1, "stroke_align": "inside"
  }]
}

Paint opacity and node opacity#

A paint's opacity fades that paint alone. Give it as the last two digits of the color (#FFFFFF99) or as {"color": "#FFFFFF", "opacity": 0.6}. The node's own opacity, the Opacity field under its size (opacity in the tools, 0 to 1), fades the whole node. Use a paint's opacity for a veil or a tint over something else; use the node's for a disabled state or a layer you are fading in.

Strokes#

A stroke has a paint, a width and a position on the outline: centered on it (the default), inside or outside.

  • Inside for cards, buttons and fields. The stroke never changes how large the thing looks, and it lines up with its neighbors.
  • Outside for a focus ring or a selection outline that should frame the thing and not eat into it.
  • Center for icons and paths, where the line itself is the drawing.

Under the stroke's More are the rest:

In the inspectorIn the toolsWhat it does
Dash, Gapstroke_dashes: [8, 6]A dashed line. Up to eight lengths make a longer pattern, as [12, 4, 2, 4] for dash-dot
Endsstroke_capbutt, round or square, for the ends of lines, open paths and each dash
Joinsstroke_joinmiter, round or bevel, for the corners of a path
Top, Right, Bottom, Leftstroke_widths: [0, 0, 1, 0]A width for each side of a rectangle or frame; 0 leaves that side bare
Stroke positions, one side, dashes, dots, ends and joins
Stroke positions, one side, dashes, dots, ends and joins

Two details make strokes look deliberate. Dots are dashes of no length with round ends: stroke_dashes: [0, 9] with stroke_cap: "round" (with square ends they are squares; with flat ends, nothing). And a line under a header or between rows is a stroke on one side of the frame (stroke_widths: [0, 0, 1, 0]), not a separate rectangle that falls out of place when the frame is resized.

With an agent
Add a 390-wide white header, 56 tall, with a hairline in #E3E6EE under it. Under that, a 320 × 160 drop zone with a 2 pt dashed outline in #5B5BF0 inside it, round dash ends, 16 corners.

The agent calls create_nodes:

{
  "nodes": [
    {"kind": "frame", "name": "Header", "x": 0, "y": 0, "width": 390, "height": 56, "fill": "#FFFFFF",
     "stroke": "#E3E6EE", "stroke_widths": [0, 0, 1, 0]},
    {"kind": "rectangle", "name": "Drop zone", "x": 0, "y": 96, "width": 320, "height": 160, "corner_radius": 16,
     "fill": "#F4F5FF", "stroke": "#5B5BF0", "stroke_width": 2, "stroke_align": "inside",
     "stroke_dashes": [8, 6], "stroke_cap": "round"}
  ]
}

A stroke takes a gradient as a fill does (see Gradients). Arrowheads and other ends for lines are in Pen and paths.

The color picker#

Click any swatch to open the picker in place. From the top:

  1. The kind of paint: Solid, Linear, Radial, Angular, Diamond or Image.
  2. A square for saturation and brightness, a bar of hues, and a bar of opacity over a checkerboard.
  3. A button that picks a color from anywhere on the screen, then the hex value and the opacity, both typed.
  4. Variables: a search field and the file's color variables. Choose one and the paint follows it; its row then shows the variable's name.
  5. In this file: the loose colors the document already uses.
  6. Contrast: the ratio against what lies behind the selection, marked AAA, AA, AA large or Below AA.
The color picker open on a fill, with the colors in the file and the contrast at its foot
The color picker open on a fill, with the colors in the file and the contrast at its foot

Reach for Variables first. A paint that follows a variable changes with its theme and is written as a token when the design becomes code; a loose hex does neither. See Variables and modes and Styles.

To give one thing the look of another, select the source and choose Edit › Copy Properties ⌥⌘C, then select the others and choose Paste Properties ⌥⌘V. Fills, strokes, effects and corners go across; place and size stay.

Find and replace colors#

Before a review, ask what colors a screen really uses. list_colors lists every color in the nodes given and everything inside them, from fills, strokes, gradient stops and shadows, each once with how often it is used. replace_color then paints everything in one color with another, as one step you can undo.

With an agent
List the colors used in the Pricing frame, then change #5B5BF0 to #4B49E8 everywhere inside it.

The agent calls list_colors with the frame's id:

{"ids": ["2:14"]}

It answers each color with its count, as {"color": "#5B5BF0", "uses": 1}. Then the agent calls replace_color:

{"ids": ["2:14"], "from": "#5B5BF0", "to": "#4B49E8"}

The reply says how many properties changed: {"changed": 1}.

Note

Matching is exact, transparency included: #FFFFFF does not match #FFFFFF66. Run list_colors first and replace each variant you find. Near-duplicates such as #5B5BF0 and #5A5BF0 are a sign the screen needs a color variable.