# Color of cubes face not changing

**URL:** <https://discourse.threejs.org/t/color-of-cubes-face-not-changing/9546>\
**Category:** Questions\
**Tags:** color\
**Created:** [September 9, 2019, 4:53pm UTC](https://discourse.threejs.org/t/color-of-cubes-face-not-changing/9546 "2019-09-09T16:53:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheWebs](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@TheWebs](https://discourse.threejs.org/u/TheWebs)\
**Post date:** [September 9, 2019, 4:53pm UTC](https://discourse.threejs.org/t/color-of-cubes-face-not-changing/9546/1 "2019-09-09T16:53:37Z")

</div>

This was supposed to change the colors of the faces of the cube but it doesnt.  
What am i doing wrong?

```
var scene = new THREE.Scene();
		var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

		var renderer = new THREE.WebGLRenderer();
		renderer.setSize( window.innerWidth, window.innerHeight );
		document.body.appendChild( renderer.domElement );

		var geometry = new THREE.BoxGeometry( 1, 1, 1 );
		var material = new THREE.MeshBasicMaterial( { color: 0xffffff, vertexColors: THREE.FaceColors});
		var cube = new THREE.Mesh( geometry, material );
		
		scene.add( cube );

		camera.position.z = 5;

		var animate = function () {
			requestAnimationFrame( animate );
			cube.geometry.faces[0].color.setRGB(getRandomInt(0, 256), getRandomInt(0, 256), getRandomInt(0, 256));
			cube.geometry.faces[1].color.setRGB(getRandomInt(0, 256), getRandomInt(0, 256), getRandomInt(0, 256));
			cube.geometry.faces[2].color.setRGB(getRandomInt(0, 256), getRandomInt(0, 256), getRandomInt(0, 256));
			cube.geometry.faces[3].color.setRGB(getRandomInt(0, 256), getRandomInt(0, 256), getRandomInt(0, 256));
			cube.geometry.colorsNeedUpdate = true;
			cube.rotation.y += 0.01;
			cube.rotation.x += 0.01;
			

			renderer.render( scene, camera );
		};

		animate();
		
		function getRandomInt(min, max) {
          min = Math.ceil(min);
          max = Math.floor(max);
          return Math.floor(Math.random() * (max - min)) + min;
        }
```

---

<div class="post-metadata">

**Author:** ![marquizzo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/marquizzo/32/25192_2.png) [@marquizzo](https://discourse.threejs.org/u/marquizzo)\
**Post date:** [September 9, 2019, 5:07pm UTC](https://discourse.threejs.org/t/color-of-cubes-face-not-changing/9546/2 "2019-09-09T17:07:48Z")

</div>

It could be that [`Color.setRGB()`](https://threejs.org/docs/index.html#api/en/math/Color.setRGB) expects values in the `[0, 1]` range, not in the `[0, 255]` range.
