# socket-colors-chance

> Get the chances of rolling specific socket colors on an item

Latest version **5.0.0** (published 2026-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install socket-colors-chance
pnpm add socket-colors-chance
yarn add socket-colors-chance
bun add socket-colors-chance
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2026-07-23 |
| First published | 2016-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | 22 \|\| 24 \|\| >=26 |
| Dependencies | 1 |
| Unpacked size | 11.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Kenan Yildirim <kenan@kenany.me> (https://kenany.me/) |
| Maintainers | kenan |
| Keywords | path of exile |

## Links

- npm: https://www.npmjs.com/package/socket-colors-chance
- Repository: https://github.com/kenany/socket-colors-chance
- npm.io page: https://npm.io/package/socket-colors-chance

## Dependencies (1)

- [factorial](https://npm.io/package/factorial.md) ^2.0.0

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 5.0.0 (latest) — 2026-07-23
- 4.0.0 — 2023-09-04
- 3.0.0 — 2022-12-26
- 2.0.0 — 2021-12-21
- 1.1.1 — 2021-12-21
- 1.1.0 — 2016-08-18
- 1.0.1 — 2016-07-12
- 1.0.0 — 2016-01-20

## README

# socket-colors-chance

Get the chances of getting specific socket colors on a [Path of Exile][poe]
item.

This was extracted out of [`chromatic-orb`][chromatic] since the math also
applies to [Vorici's][vorici] recipes. Formula is based on
[Siveran's calculator][siveran], which is based on
[Lawphill's calculator][lawphill].

## Example

``` javascript
import { socketColorsChance } from 'socket-colors-chance';

socketColorsChance({
  sockets: 3,
  red: 1,
  green: 1,
  blue: 1
});
// => 0.2222222222222222
```

## Installation

``` bash
$ npm install socket-colors-chance
```

## API

``` javascript
import { socketColorsChance } from 'socket-colors-chance';
```

### `socketColorsChance(opts)`

Given `opts`, an _Object_, returns the probability of rolling the desired socket
colors as a _Number_.

  - `opts.sockets`: number of sockets
  - `opts.strength`: strength requirement
  - `opts.dexterity`: dexterity requirement
  - `opts.intelligence`: intelligence requirement
  - `opts.red`: desired number of red sockets
  - `opts.green`: desired number of green sockets
  - `opts.blue`: desired number of blue sockets

`opts.sockets` and at least one of `opts.{red,green,blue}` are the only required
parameters.


   [poe]: https://www.pathofexile.com/
   [chromatic]: https://github.com/KenanY/chromatic-orb
   [vorici]: http://pathofexile.gamepedia.com/Vorici,_Master_Assassin
   [siveran]: https://github.com/Siveran/siveran.github.io
   [lawphill]: http://shouldichromeit.herokuapp.com/howitworks

---
_Source: https://npm.io/package/socket-colors-chance · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
