Skip to content

About

HSL to RGB color conversion in GLSL

Resources

Code of conduct

Contributing

Stars

56 stars

Watchers

20 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

glsl-hsl2rgb

stable

HSL to RGB color conversion in GLSL.

#pragma glslify: hsl2rgb = require(glsl-hsl2rgb)

...
    //75deg hue, 50% sat, 25% lightness
    vec3 rgb = hsl2rgb(75.0/360.0, 0.5, 0.25);
    gl_FragColor = vec4(rgb, 1.0);

Implementation from flixel-gdx. PRs for optimizations welcome.

Usage

NPM

vec3 rgb = hsl2rgb(vec3 hsl)

Takes hsl vec3 and returns the rgb representation. Floats are expected in the 0.0 to 1.0 range.

vec3 rgb = hsl2rgb(float h, float s, float l)

Takes individual h, s, l arguments and returns the rgb representation. Exported for convenience.

License

MIT, see LICENSE.md for details.

About

HSL to RGB color conversion in GLSL

Resources

Code of conduct

Contributing

Stars

56 stars

Watchers

20 watching

Forks

Releases

Packages

Used by

Contributors

Languages