openskin
v0.0.1
Published
> Skin math — SPF protection, burn time, pH balance, ingredient concentration, and coverage calculations.
Readme
openskin
Skin math — SPF protection, burn time, pH balance, ingredient concentration, and coverage calculations.
Install
npm install openskinUsage
const openskin = require('openskin');
const result = openskin({
spf: 50,
uvIndex: 8,
skinTone: 2,
ph: 5.5,
concentration: 2,
coverage: 80,
});
console.log(result);
// {
// spfProtection: '98.00%',
// burnTime: '125.0 min',
// phBalance: 'balanced',
// effectiveConcentration: '1.6000%',
// coverageRatio: '0.80'
// }API
openskin(params)
Returns an object with calculated skin metrics.
params
| Param | Type | Default | Description |
| --------------- | -------- | ------- | ------------------------------------------------ |
| spf | number | 0 | Sun Protection Factor value |
| uvIndex | number | 0 | UV index (0–11+) |
| skinTone | number | 1 | Skin tone multiplier (1 = light, higher = darker)|
| ph | number | 7 | pH level of product or skin |
| concentration | number | 0 | Active ingredient concentration (%) |
| coverage | number | 0 | Product coverage (0–100%) |
Returns
| Key | Type | Description |
| ------------------------ | -------- | -------------------------------------------------------- |
| spfProtection | string | Percentage of UV rays blocked |
| burnTime | string | Estimated minutes before sunburn |
| phBalance | string | acidic (< 4.5), balanced (4.5–6.5), alkaline (> 6.5) |
| effectiveConcentration | string | Active ingredient % adjusted for coverage |
| coverageRatio | string | Coverage as a 0–1 ratio |
License
Apache-2.0 © Ahmad Awais
