npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

body-highlighter

v3.0.2

Published

Framework-agnostic library for highlighting muscles on a body model

Readme

body-highlighter

[![Npm Version][npm-version-image]][npm-version-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url]

Body Highlighter is a framework‑agnostic muscle map that renders straight to the DOM with zero runtime dependencies. It started as a fork of react-body-highlighter and is now maintained as a standalone, modern alternative.

Why this fork?

  • ✅ Works in any environment (vanilla JS, React, Vue, Svelte, Astro, …)
  • ✅ Accepts human-readable muscle names and auto-maps them to the closest MuscleType
  • ✅ Kept up to date with the latest tooling (TypeScript 5, Husky 9, etc.)
  • ✅ Tiny footprint: a single SVG plus a handful of utility helpers

Jump straight to the example playground if you want to see it live.

Installation

$ npm install body-highlighter
$ yarn add body-highlighter

Usage

Example

import createBodyHighlighter, { IExerciseData, MuscleType } from 'body-highlighter';

const container = document.getElementById('model');

const data: IExerciseData[] = [
  { name: 'Bench Press', muscles: [MuscleType.CHEST, MuscleType.TRICEPS, MuscleType.FRONT_DELTOIDS] },
  { name: 'Push Ups', muscles: [MuscleType.CHEST] },

  // You can mix canonical enums with natural language names.
  { name: 'Extensions lombaires', muscles: ['Erector Spinae'] },
];

const highlighter = createBodyHighlighter({
  container,
  data,
  style: { width: '20rem', padding: '5rem' },
  onClick: ({ muscle, data }) => {
    const { exercises, frequency } = data;

    alert(`You clicked the ${muscle}! You've worked out this muscle ${frequency} time(s) through: ${JSON.stringify(exercises)}`);
  },
});

// Update highlights whenever your data changes
highlighter.update({
  data: [...data, { name: 'Dips', muscles: [MuscleType.TRICEPS] }],
});

Options

All options are optional; if omitted they fall back to the defaults shown below.

| Prop | Purpose | Type | Default | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------------------------ | | bodyColor | Default color applied to muscles with no recorded activity | string | #B6BDC3 | | container | Optional container element that will automatically receive the generated markup | HTMLElement | | | data | Array of exercise objects { name: string, muscles: Muscle[], frequency?: number } used to compute activity stats | IExerciseData[] | [] | | highlightedColors | Palette used depending on how frequently a muscle was worked (frequency - 1 = index). The last color is reused for higher reps | string[] | ['#81b1d9', '#277abf'] | | onClick | Callback fired when a muscle polygon is clicked. Receives { muscle, data: { exercises, frequency } } | (stats: IMuscleStats) => void | | | style | Inline styles applied to the wrapper element | Record<string, string | number | undefined> | | | svgStyle | Inline styles applied directly to the <svg> | Record<string, string | number | undefined> | | | type | Denotes which body view is rendered | ModelType ('anterior' | 'posterior') | 'anterior' | | wrapperClassName | Class name assigned to the wrapper div | string | 'rbh-wrapper' |

Instance helpers

createBodyHighlighter returns an object containing:

  • element: the root HTMLElement that wraps the SVG. Append it manually when no container is supplied.
  • update(options): re-computes fills and styles with the provided partial options.
  • destroy(): removes the element from the DOM and clears internal listeners.

List of muscles/parts supported

/* Back */
trapezius
upper-back
lower-back

/* Chest */
chest

/* Arms */
biceps
triceps
forearm
back-deltoids
front-deltoids

/* Abs */
abs
obliques

/* Legs */
adductor
hamstring
quadriceps
abductors
calves
gluteal

/* Head */
head
neck

Muscle aliases

Common anatomical names such as Trapezius, Pectoralis Major, or Gluteus Maximus are automatically normalised to their closest muscle group (case insensitive). Unknown aliases are simply ignored, so you can still fall back to the canonical keys above when you need full control.

Modifying

The root wrapper receives the class .rbh-wrapper and the SVG uses .rbh, so you can style everything with regular CSS. For instance:

.rbh polygon:hover {
  fill: #757782 !important;
}

Contributions are welcome—open an issue or PR if you have ideas for new features or muscle mappings!