glslify-hex
A transform stream for [glslify](http://github.com/chrisdickinson/glslify) that replaces CSS-style hexadecimal colors with `vec3/vec4` definitions.
Last updated 4 years ago by hughsk .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install glslify-hex 
SYNC missed versions from official npm registry.

glslify-hex experimental

A transform stream for glslify that replaces CSS-style hexadecimal colors with vec3/vec4 definitions.

Usage

NPM

Once you've enabled the stream, you simply put your hex colors in your file like so:

void main() {
  gl_FragColor = vec4(#ff0000, 1.0);
}

The above color will be (naïvely) replaced with a GLSL vec3 definition, i.e.:

void main() {
  gl_FragColor = vec4(vec3(1.0, 0.0, 0.0), 1.0);
}

You can also use 8-digit hexadecimals for vec4 definitions. The above example could also be expressed like so:

void main() {
  gl_FragColor = #ff0000ff;
}

To use glslify transform streams, you currently need to use glslify-stream directly:

var createStream = requrire('glslify-stream')

var stream = createStream('./shader.vert', {
  transform: ['glslify-hex']
})

stream.pipe(process.stdout)

This might have changed by the time you read this though, so be sure to double check the glslify documentation!

License

MIT. See LICENSE.md for details.

Current Tags

  • 2.1.1                                ...           latest (4 years ago)

6 Versions

  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.0.0                                ...           7 years ago
Downloads
Today 0
This Week 7
This Month 17
Last Day 0
Last Week 6
Last Month 2
Dependencies (0)
None
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |