Skip to content

Color-Coded Resistors

When SpiceBook generates a schematic, resistors with parseable values render as IEEE zigzag symbols with color-coded segments matching the standard 4-band resistor color code.

A resistor value like 1k (1000Ω) is decomposed into:

  • 1st significant digit: 1 → Brown
  • 2nd significant digit: 0 → Black
  • Multiplier: ×100 → Red
  • Tolerance: ±5% → Gold (default)

These colors are applied directly to the zigzag segments in the SVG, mimicking how a physical resistor looks.

The IEEE zigzag symbol has 7 sub-segments. Each is assigned a color role:

SegmentRoleColor
0 (entry)WireDefault wire color
11st significant digitColor band
22nd significant digitColor band
3MultiplierColor band
4 (gap)Physical spacingDefault wire color
5ToleranceColor band
6 (exit)WireDefault wire color

The entry/exit segments and the gap before the tolerance band use the default wire color. This mimics the physical spacing on a real resistor that indicates reading direction — you read bands from the end closest to the first band.

DigitColorHex
0Black#1a1a1a
1Brown#8B4513
2Red#cc0000
3Orange#ff6600
4Yellow#cccc00
5Green#006400
6Blue#0000cc
7Violet#7b1fa2
8Gray#555555
9White#e0e0e0

Multiplier bands use the same color mapping (Black = ×1, Brown = ×10, Red = ×100, etc.).

Tolerance: Gold (±5%) is the default when no tolerance is specified.

Color-coded rendering applies to resistor values between 0.01Ω and 1GΩ. Outside this range, or for parametric values (e.g., {R_val}), the resistor falls back to a standard monochrome zigzag.

A 4.7k resistor renders with:

  • Yellow (4) — 1st digit
  • Violet (7) — 2nd digit
  • Red (×100) — multiplier
  • Gold (±5%) — tolerance

The result is immediately recognizable to anyone who’s read resistor bands by hand — the schematic tells you both the circuit topology and the component values at a glance.