{"data":{"slug":"discovered-7e991b137a3a23768d87eadac3ba9f954ed7d019d5a2fea0","title":"Optikit Icons","summary":"Audit and correct icons for visual alignment by calculating their centre of mass and applying measured shifts. The tool ensures icons appear visually centred in buttons, badges, and other UI elements by adjusting SVG paths and adding metadata for future audits.","url":"https:\/\/skillshunter.net\/skills\/discovered-7e991b137a3a23768d87eadac3ba9f954ed7d019d5a2fea0","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-7e991b137a3a23768d87eadac3ba9f954ed7d019d5a2fea0","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-7e991b137a3a23768d87eadac3ba9f954ed7d019d5a2fea0.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-7e991b137a3a23768d87eadac3ba9f954ed7d019d5a2fea0\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before running `optikit icon audit`, ensure the project has optikit as a dev dependency. Use `npx --no -- optikit` for local projects or `optikit` for global installs. Always run the audit before any fix to avoid double-correction of icons from pre-aligned sets.","instructions":"---\nname: optikit-icons\ndescription: 'Find icons that look off-centre and correct them by their visual weight. Use when an icon looks shifted in a button, a badge or a circle though its box is centred (a play triangle, an arrow, a paper plane); when a set of icons is finished for a site; and when two state icons jump on toggle. Runs optikit icon audit.'\n---\n\n# optikit-icons\n\nA browser centres an icon's box; the eye centres its ink. A play triangle centred by its box looks pushed left, because most of its mass sits near the flat side. `optikit icon audit` renders each SVG, finds the centre of mass and reports the gap from the centre of the canvas. Use it in place of nudging by eye or by padding: the number is measured, and the fix lives inside the SVG, so the icon is right wherever it is used.\n\n## 1. Report first\n\nIn a project that has optikit as a dev dependency, write every command as `npx --no -- optikit \u2026`; for a global install, `optikit \u2026`. `--no` keeps npx from downloading and `--` keeps it from taking optikit's flags as its own: the bare name `optikit` on npm is someone else's package.\n\nRun `optikit icon audit <dir or file>` before any fix. It changes nothing and gives one line per icon:\n\n- `centred`: under the threshold (1% of the canvas by default; even-stroke chevrons land near 0.8%). Leave it.\n- `shift`: a filled shape, safe to fix. The line says the shift it would apply.\n- `check by eye`: the icon has strokes. Decorative lines count as mass, so the number can be off: show it to the person instead of fixing.\n- `on purpose`: the SVG carries a `data-optical` mark. It is never fixed twice.\n\n## 2. Decide what to fix\n\n| The icon | Do | Why |\n| --- | --- | --- |\n| Static, in a button or a badge | `--fix` (half the correction, the default) | The centre of mass is the upper bound, not the target. In a small badge the eye also weighs the gaps to the edges, and a full correction looked over-shifted on a 36 px badge. |\n| Turns (an accordion caret, an expand arrow) | `--fix --amount full` | It rotates around the centre of the canvas; a mass left off-centre swings in an arc. |\n| A pair of states (play\/pause, sound on\/off) | `--fix --same-as <one of them>` | Fixed apart, the part they share would jump on toggle. |\n| Beside text | no fix; add `data-optical=\"none\"` to its root `<svg>` | There the eye measures the gap to the word, not the centre. |\n| From a set aligned by its authors (Lucide, Phosphor, SF Symbols) | no fix | It would be corrected twice. |\n| An illustration with rays or sparks | report only | Strokes pull the result off. |\n\n## 3. Fix and read the result\n\n1. `optikit icon audit <dir> --fix` writes corrected copies to `--out` (default `optimized\/`); the sources stay as they were. The shift is baked into the path coordinates, so no `transform` is left behind, and `data-optical=\"half\"` (or `full`) is written on the root, so the next audit leaves the icon alone.\n2. When the drawing reaches the edge of its canvas, the shift would cut it off. The path is then left alone and the `viewBox` grows instead, and the line says how much smaller the icon renders in the same CSS box (\"~8% smaller\"). Tell the person that number: it may need a larger size in the CSS.\n3. Every fixed file is measured again on a canvas with a margin. A fix that cuts ink off or misses the target fails the command; do not report it as done.\n4. Ask the person to look at the corrected icon in its real place. A number cannot judge the gaps to the edge of a badge.\n\nAn icon the person tuned by hand: add `data-optical=\"half\"` (or the strength they chose) to its root `<svg>`, so the audit stops flagging the remainder.\n\n## Before you finish\n\n| Check | Why |\n| --- | --- |\n| The report ran before any `--fix` | a set aligned by its authors gets corrected twice |\n| Rotating icons got `--amount full`, state pairs `--same-as` | a swing in an arc, a jump on toggle |\n| Icons beside text carry `data-optical=\"none\"` | they are aligned to the word, not the centre |\n| Every grown `viewBox` was reported with its percentage | the icon renders smaller in the same box |\n| The person saw the result in the real badge | the formula is the upper bound |\n","use_cases":["Correcting icons that appear visually off-centre in buttons or badges","Auditing a complete set of icons for a site or application","Fixing state icons (e.g., play\/pause) to prevent visual jumps on toggle","Adjusting icons that are aligned by their authors (e.g., Lucide, Phosphor) without double-correction"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/OlgaGulyakevich\/optikit\/blob\/618377ecfa9df6c1e2e797cfbe0a329519162abf\/skills\/optikit-icons\/SKILL.md","source_commit":"618377ecfa9df6c1e2e797cfbe0a329519162abf","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:56:25.000000Z","updated_at":"2026-11-29T10:53:52.000000Z","seo_title":"Optikit Icons - Visual Alignment Audit Tool","seo_description":"Optikit Icons is a tool that audits and corrects SVG icons for visual alignment by calculating their centre of mass and applying measured shifts. It ensures icons appear,","seo_keywords":["icon alignment","SVG audit","visual centre correction","optikit icons","icon optimization"]}}