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

collit

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collit - npm Package Compare versions

Comparing version 0.8.0 to 0.8.1

.coveralls.yml

11

karma.conf.js

@@ -8,2 +8,5 @@ // Karma configuration

frameworks: ['jasmine'],
coverageReporter: {
type: 'lcov', dir: 'coverage/'
},
files: [

@@ -16,8 +19,8 @@ 'dist/collit.js',

},
reporters: ['kjhtml', 'coverage'],
reporters: ['progress', 'coverage', 'coveralls'],
port: 9876,
browsers: [],
singleRun: false,
autoWatch: true
browsers: ['PhantomJS'],
singleRun: true,
captureTimeout: 4 * 60 * 1000
})
};
{
"name": "collit",
"version": "0.8.0",
"version": "0.8.1",
"description": "A modern JavaScript library delivering fast and modular color utils. (eg. color convertor, css color validator and parser etc.)",

@@ -12,3 +12,4 @@ "main": "dist/collit.js",

"webpack": "webpack",
"watch": "webpack --watch"
"watch": "webpack --watch",
"test": "karma start"
},

@@ -35,9 +36,9 @@ "keywords": [

"babel-preset-es2016": "^6.24.1",
"jasmine-core": "^2.5.2",
"jasmine-core": "^2.7.0",
"karma": "^1.7.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-coveralls": "^1.1.2",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"require-dir": "^0.3.0",
"karma-phantomjs-launcher": "^1.0.4",
"phantomjs": "^2.1.7",
"webpack": "^1.14.0"

@@ -44,0 +45,0 @@ },

@@ -1,6 +0,45 @@

# Collit
A modern JavaScript library delivering fast and modular color utils. (eg. color convertor, css color validator and parser etc.)
<p align="center">
<img src="https://raw.githubusercontent.com/eugeneford/collit/master/.github/collit-logo.png" width="100" height="100">
</p>
<h3 align="center">
Collit
</h3>
<p align="center">
A modern JavaScript library delivering fast and modular color utils.
</p>
<p align="center">
<a href="https://travis-ci.org/eugeneford/collit">
<img src="https://travis-ci.org/eugeneford/collit.svg?branch=master" alt="Build Status">
</a>
<a href='https://coveralls.io/github/eugeneford/collit?branch=master'>
<img src='https://coveralls.io/repos/github/eugeneford/collit/badge.svg?branch=master' alt='Coverage Status' />
</a>
<a href='https://www.npmjs.com/package/collit'>
<img src='https://img.shields.io/npm/v/collit.svg' alt='NPM Version' />
</a>
</p>
## Basic Overview
Collit is a modern JavaScript library delivering fast and modular color utils.
> Our mission is to create a complete, fast, modular and well-documented library for any kind of color operations
(eg. parsers, converters, transformers, manipulation etc.).
Library can be used both in Node.js and directly in Browser.
It is well-documented and completely covered with test specs (excluding webpack bundling definitions and expressions).
If you want to add some features or to suggest any idea, feel free — [contributions are always welcome](#contributing-to-collit).
## What Included
There are several modules available in Collit so far:
* [Converter](#converter) — convert one specific color format into another. (Hex, RGB, HSL)
* [Validator](#validator) — validate CSS color values eg. #000, rgb(0,0,0), rgba(0,0,0,1), hsl(0,0%,0%) etc.
* [Parser](#parser) — parse CSS color values to [Color](#color-object) objects.
## How to Install
#### Using NPM
To use Collit with NPM simply call:
```js

@@ -11,2 +50,4 @@ npm install --save collit

#### In Browser
To use Collit directly in browser simply download this repository and copy dist/collit.js into your project.
Next, include it on your .html page:
```html

@@ -38,4 +79,4 @@ <script src="path/to/your/js/collit.js"></script>

## Converter
Converter helper allows you to convert hex to rgb, rgb to hex, hsl to rgb, rgb to hsl, hex to hsl, hsl to hex etc.
Convert one specific color format into another. (Hex, RGB, HSL).
### hexToRgb(hex)

@@ -45,3 +86,3 @@ Converts an HEX color value to RGB.

```js
import { Converter } from "collit";
import Converter from "collit"; // or var Converter = Collit.Converter if using in browser

@@ -56,3 +97,3 @@ var rgb = Converter.hexToRgb("#333"); // rgb => {r:51, g:51, b: 51};

```js
import { Converter } from "collit";
import Converter from "collit"; // or var Converter = Collit.Converter if using in browser

@@ -65,3 +106,3 @@ var hsl = Converter.hexToHsl("#333"); // hsl => {h: 0, s: 0, l: 0.2};

```js
import { Converter } from "collit";
import Converter from "collit"; // or var Converter = Collit.Converter if using in browser

@@ -74,4 +115,2 @@ var hex = Converter.rgbToHex({r: 51, g: 51, b: 51}); // hex => "#333";

```js
import { Converter } from "collit";
var hsl = Converter.rgbToHsl({r: 11, g: 11, b: 11}); // hsl => {h: 0, s: 0, l: 0.04};

@@ -85,3 +124,3 @@ ```

```js
import { Converter } from "collit";
import Converter from "collit"; // or var Converter = Collit.Converter if using in browser

@@ -94,3 +133,3 @@ var hex = Converter.hslToHex({h: 0, s: 0.5, l: 0.3}); // hex => "#732626;

```js
import { Converter } from "collit";
import Converter from "collit"; // or var Converter = Collit.Converter if using in browser

@@ -106,2 +145,4 @@ var rgb = Converter.hslToRgb({h: 300, s: 0.5, l: 0.5}); // rgb => {r: 191, g: 64, b: 191};

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isColor = Validator.isColorName("black"); // true

@@ -114,2 +155,4 @@ var isNotColor = Validator.isColorName("avadakedavra"); // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isHex = Validator.isHex("#333"); // true

@@ -122,2 +165,4 @@ var isNotHex = Validator.isHex("#rgb"); // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isRgb = Validator.isRgb("rgb( 0, 0, 0 )") // true

@@ -131,2 +176,4 @@ var isNotRgb = Validator.isRgb("hsl( 0, 0, 100% )") // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isHsl = Validator.isHsl("hsl(0,0%,0%)") // true

@@ -139,2 +186,4 @@ var isNotHsl = Validator.isHsl("hsl( 0, 5, 100% )") // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isRgba = Validator.isRgba("rgba(255,255,255,.5)") // true

@@ -147,2 +196,4 @@ var isNotRgba = Validator.isRgba("hsla(255,100%,100%,.5)") // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isHsla = Validator.isHsla("hsla(0,0%,0%, .5)") // true

@@ -155,2 +206,4 @@ var isNotHsla = Validator.isHsla("hsl( 0, 5, 100% )") // false

```js
import Validator from "collit"; // or var Validator = Collit.Validator if using in browser
var isColor = Validator.isColor("hsla(0,0%,0%, .5)") // true

@@ -167,2 +220,4 @@ var isColorToo = Validator.isColor("black") // true

```js
import Parser from "collit"; // or var Parser = Collit.Parser if using in browser
var color = Parser.parseColorName("black");

@@ -175,2 +230,4 @@ // color => { hex: "#000", rgb: {r:0, g:0, b:0}, hsl: {h:0, s:0, l:0}}

```js
import Parser from "collit"; // or var Parser = Collit.Parser if using in browser
var color = Parser.parseHex("#000");

@@ -183,2 +240,4 @@ // color => { hex: "#000", rgb: {r:0, g:0, b:0}, hsl: {h:0, s:0, l:0}}

```js
import Parser from "collit"; // or var Parser = Collit.Parser if using in browser
var color = Parser.parseRgb("rgb(128,128,128");

@@ -191,2 +250,4 @@ // color => { hex: "#808080", rgb: {r:128, g:128, b:128}, hsl: {h:0, s:0, l:0.5}}

```js
import Parser from "collit"; // or var Parser = Collit.Parser if using in browser
var color = Parser.parseHsl("hsl(240,100%,50%");

@@ -202,2 +263,17 @@ // color => { hex: "#00f", rgb: {r:0, g:0, b:255}, hsl: {h:240, s:1, l:0.5}}

## Contributing to Collit
Contributions are always welcome.
Before contributing please read the [code of conduct](https://js.foundation/community/code-of-conduct) &
[search the issue tracker](https://github.com/eugeneford/collit/issues) (your issue may have already been discussed or fixed).
To contribute, follow next steps:
* Fork Collit
* Commit your changes
* Open a Pull Request.
### Feature Requests
Feature requests should be submitted in the issue tracker, with a description
of the expected behavior & use case, where they’ll remain closed until sufficient interest (e.g. 👍 reactions).
Before submitting a feature request, please search for similar ones in the closed issues.
## Manifest

@@ -204,0 +280,0 @@ The entire logic of modules is and should be based on use of the Color, LinearGradient and RadialGradient data types.

var Converter = Collit.Converter;
describe("Converter Helper", function () {
describe("hexToRgb()", function () {
it('#1 Successfully converted hex to rgb when hex was in short form ("#333")', function () {
var rgbExpected = {r: 51, g: 51, b: 51};

@@ -9,0 +7,0 @@ expect(Converter.hexToRgb("#333")).toEqual(rgbExpected);

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