New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

contrastrast

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

contrastrast - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

esm/_dnt.test_polyfills.d.ts.map

67

package.json
{
"name": "contrastrast",
"version": "0.3.0",
"description": "A lightweight tool that parses color strings and recommends text contrast based on WCAG Standards",
"license": "MIT",
"version": "0.2.0",
"type": "module",
"main": "./dist/index.umd.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"index.d.ts"
],
"repository": {
"type": "git",
"url": "https://github.com/ammuench/contrastrast.git"
},
"keywords": [

@@ -30,43 +17,29 @@ "wcag",

],
"author": "Alex Muench <ammuench@gmail.com> (https://alexmuen.ch/)",
"author": "Alex Muench <hello@alexmuen.ch> (https://alexmuen.ch/)",
"repository": {
"type": "git",
"url": "https://github.com/ammuench/contrastrast.git"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/ammuench/contrastrast/issues"
},
"main": "./script/main.js",
"module": "./esm/main.js",
"exports": {
".": {
"import": {
"default": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"require": {
"default": "./dist/index.umd.cjs",
"types": "./dist/index.d.cts"
}
"import": "./esm/main.js",
"require": "./script/main.js"
}
},
"devDependencies": {
"@faker-js/faker": "^8.4.1",
"@types/node": "^20.11.17",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vitest/coverage-istanbul": "^1.2.2",
"@vitest/ui": "^1.2.2",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"glob": "^10.3.10",
"husky": "^9.0.10",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"typescript": "^5.2.2",
"vite": "^5.1.0",
"vite-plugin-dts": "^3.7.2",
"vitest": "^1.2.2"
"@types/node": "^20.9.0",
"picocolors": "^1.0.0",
"@faker-js/faker": "*",
"@deno/shim-deno": "~0.18.0"
},
"_generatedBy": "dnt@dev",
"scripts": {
"build": "tsc -p ./tsconfig.build.json && vite build",
"lint": "eslint --ext .ts,.js .",
"lint:fix": "eslint --ext .ts,.js --fix .",
"lint-staged": "lint-staged",
"test": "vitest",
"test:ui": "vitest --ui --coverage",
"test:ci": "vitest --watch=false"
"test": "node test_runner.js"
}
}
![contrastrast](https://github.com/ammuench/contrastrast/assets/2099658/8b7a90b0-3874-4650-a575-1170063d3462)
[![JSR](https://jsr.io/badges/@<scope>/<package>)](https://jsr.io/@amuench/contrastrast)
[![npm version](https://badge.fury.io/js/contrastrast.svg)](https://badge.fury.io/js/contrastrast)

@@ -7,3 +8,4 @@

A lightweight tool that parses color strings and recommends text contrast based on [WCAG Standards](http://www.w3.org/TR/AERT#color-contrast)
A lightweight tool that parses color strings and recommends text contrast based
on [WCAG Standards](http://www.w3.org/TR/AERT#color-contrast)

@@ -15,8 +17,9 @@ ## Installation

```bash
npm install --save constrastrast@latest
npm install --save constrastrast
yarn add constrastrast@latest
yarn add constrastrast
pnpm install --save constrastrast@latest
pnpm install --save constrastrast
deno add contrastrast
```

@@ -26,3 +29,5 @@

`constrastrast` takes a given background color as a string in either HEX, HSL, or RGB format, and (by default) returns `"dark"` or `"light"` as a recommended text variant for that given background color
`constrastrast` takes a given background color as a string in either HEX, HSL,
or RGB format, and (by default) returns `"dark"` or `"light"` as a recommended
text variant for that given background color

@@ -39,3 +44,2 @@ For example, you may use it like this:

}
```

@@ -93,11 +97,14 @@

Currently `contrastrast` doesn't support alpha formats and will log an error and return the default value
Currently `contrastrast` doesn't support alpha formats and will log an error and
return the default value
### Unhandled Formats
If an unhandled string is passed, by default `contrastrast` will log an error and return the default value (`"dark"`)
If an unhandled string is passed, by default `contrastrast` will log an error
and return the default value (`"dark"`)
## Options
`textContrastForBGColor` takes an `ContrastrastOptions` object as an optional second parameter, it currently has the following configuration options:
`textContrastForBGColor` takes an `ContrastrastOptions` object as an optional
second parameter, it currently has the following configuration options:

@@ -113,2 +120,4 @@ ```ts

Happy for any and all contributions. Please note the project uses `pnpm` and I prefer to have git commits formatted with [`gitmoji-cli`](https://github.com/carloscuesta/gitmoji-cli)
Happy for any and all contributions. Please note the project uses `pnpm` and I
prefer to have git commits formatted with
[`gitmoji-cli`](https://github.com/carloscuesta/gitmoji-cli)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc