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.
How It Works
Section titled “How It Works”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.
Band-to-Segment Mapping
Section titled “Band-to-Segment Mapping”The IEEE zigzag symbol has 7 sub-segments. Each is assigned a color role:
| Segment | Role | Color |
|---|---|---|
| 0 (entry) | Wire | Default wire color |
| 1 | 1st significant digit | Color band |
| 2 | 2nd significant digit | Color band |
| 3 | Multiplier | Color band |
| 4 (gap) | Physical spacing | Default wire color |
| 5 | Tolerance | Color band |
| 6 (exit) | Wire | Default 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.
Color Code Reference
Section titled “Color Code Reference”| Digit | Color | Hex |
|---|---|---|
| 0 | Black | #1a1a1a |
| 1 | Brown | #8B4513 |
| 2 | Red | #cc0000 |
| 3 | Orange | #ff6600 |
| 4 | Yellow | #cccc00 |
| 5 | Green | #006400 |
| 6 | Blue | #0000cc |
| 7 | Violet | #7b1fa2 |
| 8 | Gray | #555555 |
| 9 | White | #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.
Value Range
Section titled “Value Range”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.
Example
Section titled “Example”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.