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/
- Host: GitHub
- URL: https://github.com/vincent7128/color-object
- Owner: vincent7128
- License: mit
- Created: 2017-11-09T10:06:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-07-10T23:36:38.000Z (almost 3 years ago)
- Last Synced: 2025-08-25T17:03:47.754Z (10 months ago)
- Topics: color, convert, css, hex, rgb, rgba, vec3, vec4, webgl
- Language: JavaScript
- Size: 201 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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