A Free Terminal Tool for Resistor Color Codes — No Browser Required
A Free Terminal Tool for Resistor Color Codes — No Browser Required
一款免费的电阻色环终端工具——无需浏览器
Every electronics workbench eventually has the same pile: unmarked resistors, half-read color bands, and the reflex to open a browser tab just to confirm what you already suspected. I got tired of that. So I built a CLI tool in pure C++17 that does it in the terminal, with no internet connection, no dependencies, and ANSI color output that actually shows you what the bands look like. It’s called resistor. It’s free. MIT license.
每个电子工作台上最终都会堆积着同样的东西:没有标记的电阻、难以辨认的色环,以及为了确认心中猜想而不得不打开浏览器标签页的条件反射。我厌倦了这一切。所以我用纯 C++17 构建了一个命令行工具,它可以在终端中完成这些工作,无需联网,没有依赖项,并且通过 ANSI 彩色输出直观地展示色环的样子。它叫 resistor,完全免费,采用 MIT 许可证。
What it does
功能介绍
Two directions: 支持两个方向的转换:
-
Value to color bands:
resistor -v 4.7k -p 5 -
Color bands to value:
resistor -c yellow,violet,black,brown,brown -
阻值转色环:
resistor -v 4.7k -p 5 -
色环转阻值:
resistor -c yellow,violet,black,brown,brown
Output: 输出示例:
Your resistor’s color code should look like this: [ye][vt][bk][bn][bn]
The resistor value is: 47.0KΩ +/- 1.0%
Valid range: 46.53KΩ - 47.47KΩ
If the measured value is outside this range, return the resistors lot. You’ve been scammed!
你的电阻色环应该是这样的:[ye][vt][bk][bn][bn]
电阻阻值为:47.0KΩ +/- 1.0%
有效范围:46.53KΩ - 47.47KΩ
如果测量值超出此范围,请退货。你被坑了!
-
Supports 4-band and 5-band resistors.
-
Supports engineering notation — 2k2, 4R7, 1M, 470k.
-
Validates tolerance values against the standard IEC series.
-
Shows the valid measurement range so you know when a resistor is out of spec.
-
支持 4 色环和 5 色环电阻。
-
支持工程计数法——如 2k2, 4R7, 1M, 470k。
-
根据标准 IEC 系列验证公差值。
-
显示有效测量范围,让你知道电阻何时超出规格。
Why terminal
为什么选择终端?
Because it’s always there. No tab to open, no page to load, no cookie banner. Build it once and it lives in your PATH.
因为它随时可用。无需打开标签页,无需加载页面,也没有烦人的 Cookie 横幅。编译一次,它就会常驻在你的 PATH 路径中。
Part of Rosito Bench
Rosito Bench 项目的一部分
resistor is the first public tool in Rosito Bench — a collection of small, dependency-free C++17 CLI utilities for engineers and makers. The second tool in the bench is Hasaki 刃先, which trains neural networks on the desktop and exports standalone C headers for microcontrollers. Different problems. Same philosophy: do one thing, do it well, no runtime overhead.
resistor 是 Rosito Bench 的首个公开工具——这是一个为工程师和创客打造的、小型且无依赖的 C++17 命令行工具集。该工具集的第二个工具是 Hasaki(刃先),它可以在桌面上训练神经网络,并为微控制器导出独立的 C 头文件。虽然解决的问题不同,但理念一致:专注于一件事,把它做好,且没有运行时开销。
GitHub: github.com/AlexRosito67/resistor
If it saves you a browser tab, that’s enough.
如果它能为你省下一个浏览器标签页,那就足够了。