An open API service indexing awesome lists of open source software.

https://github.com/vincent7128/color-object

Create a color object and convert to rgb, rgba or hex string and WebGL color array. https://vincent7128.github.io/color-object/
https://github.com/vincent7128/color-object

color convert css hex rgb rgba vec3 vec4 webgl

Last synced: about 2 months ago
JSON representation

Create a color object and convert to rgb, rgba or hex string and WebGL color array. https://vincent7128.github.io/color-object/

Awesome Lists containing this project

README

          

Color Object
======

[📺 Live Demo](https://vincent7128.github.io/color-object/)
Create a color object and convert to rgb, rgba or hex string and WebGL color array.

## Usage
NPM:
```
npm install color-object

var color = require('color-object');
```
CDN:
```

```
Code example:
```
/* Init color object */
/* values */
var color = Color('aqua');
var color = Color('coral');

/* values */
var color = Color('#090');
var color = Color('#009900');
var color = Color('#090a');
var color = Color('#009900aa');

/* values */
var color = Color('rgb(34, 12, 64)');
var color = Color('rgba(34, 12, 64, 0.6)');

/* color convert */
color.hex(); // covent to css hex color string, like #00FFCC
color.hexa(); // covent to css hex color string, like #00FFCCAA
color.rgb(); // covent to css rgb color string, like rgb(34, 12, 64)
color.rgba(); // covent to css rgba color string, like rgb(34, 12, 64, 0.6)
color.vec3(); // covent to WebGL vec3 color array, like [0, 0, 0]
color.vec4(); // covent to WebGL vec4 color array, like [0, 0, 0, 1]
```
🔗 [keyword color list](KEYWORD-LIST.md)

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details