Before we move on to the next light, we're going to look closer at the THREE.Color object. In Three.js, when you need to provide a color (for example, for materials, lights, and so on.) you can pass in a THREE.Color object, or Three.js will create one from a passed-in string value, as we've seen for THREE.AmbientLight. Three.js is very flexible when parsing the input for the THREE.Color constructor. You can create a THREE.Color object in the following ways:
- Empty constructor: new THREE.Color() will create a white color object.
- Hex value: new THREE.Color(0xababab) will parse the passed-in hex value and create a color from that. This is the preferred way of creating colors.
- Hex string: new THREE.Color("#ababab") ...