Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm looking for any way possible to implement an HSL color scheme in my threejs project. I don't see anything after 2013 in the documentation that implements the .setHSL() or .offsetHSL().

What is the best/easiest way to use only HSL in a threejs scene? Thanks!

h — hue value between 0.0 and 1.0
s — saturation value between 0.0 and 1.0
l — lightness value between 0.0 and 1.0

Sets color from hsl

.getHSL () hsl

Returns an object with properties h, s, and l.

.offsetHSL ( h, s, l ) this

Adds given h, s, and l to this color's existing h, s, and l values.

three.js - reference - color

var color = new THREE.Color();
color.setHSL( .74, .64, .59 );
console.log('HSL Object:', color.getHSL());
console.log('Hex String:', color.getHexString());
console.log('RGB:', color.getStyle());
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r79/three.js"></script>

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question . Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers .