# Has something changed in code for the "background" property of Scene?

**URL:** <https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427>\
**Category:** Questions\
**Tags:** background, color\
**Created:** [September 26, 2023, 10:00am UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427 "2023-09-26T10:00:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [September 26, 2023, 10:00am UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/1 "2023-09-26T10:00:07Z")

</div>

I have the following lines of code in my application:

```javascript
// background color

	grandScene.background = new THREE.Color( 'rgb(200,200,200)');
	
	console.log(grandScene.background);

```

When I run this using an earlier version of THREE, the console shows:

```javascript
Object { isColor: true, r: 0.7843137254901961, g: 0.7843137254901961, b: 0.7843137254901961 }

```

When I run this using a more recent version of THREE, the console shows:

```javascript
Object { isColor: true, r: 0.5775804404214573, g: 0.5775804404214573, b: 0.5775804404214573 }

```

I don’t know how to find out which THREE version numbers these are.

Thanks much

OLDMAN

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [September 26, 2023, 10:32am UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/2 "2023-09-26T10:32:44Z")

</div>

This is likely a color management related issue. Read the following guide for more details:

> [@Updates to Color Management in three.js r152](https://discourse.threejs.org/t/updates-to-color-management-in-three-js-r152/50791):
>
> The upcoming release r152 will contain changes affecting color and lighting. These updates enable a [“linear workflow”](https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-24-importance-being-linear) by default, for better image quality in both physically-based and non-physically-based scenes. By “linear workflow”, we mean that any sRGB input colors (as found in most textures, color pickers, CSS, and HTML) are converted from sRGB to a linear working color space for rendering, and the rendered image is converted back to sRGB for display. What does that mean for me? These cha…

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [September 26, 2023, 1:17pm UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/3 "2023-09-26T13:17:04Z")

</div>

Exactly as @Mugen87 says! The more recent version interprets the color as sRGB, as CSS engines would. Assuming the rest of your scene and renderer are set up correctly the output should match HTML/CSS. (Tone mapping would change that result a bit though).

If you did need to revert to the previous behavior, this should do it:

```js
grandScene.background = new THREE.Color().setStyle(
  'rgb(200,200,200)',
  THREE.LinearSRGBColorSpace
);

```

---

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [September 27, 2023, 3:13pm UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/4 "2023-09-27T15:13:01Z")

</div>

> [@donmccurdy](#):
>
> ```javascript
> grandScene.background = new THREE.Color().setStyle(
> 'rgb(200,200,200)',
> THREE.LinearSRGBColorSpace
> );
> 
> ```

After going through the color management changes notes for the recent version of THREE, I made the following changes to my application:

```javascript
	THREE.ColorManagement.enabled = false;
	renderer01.outputColorSpace = THREE.LinearSRGBColorSpace;	

```

This fixed the earlier problem with the background color.

That is to say, when now I do

```javascript
grandScene.background = new THREE.Color( 'rgb(200,200,200)');

```

I now get:

```javascript
Object { isColor: true, r: 0.7843137254901961, g: 0.7843137254901961, b: 0.7843137254901961 }

```

which agrees with 200/255.

However, there is still a difference in the visual quality of the rendering.

The first image represents a rendering using the earlier version of THREE

![old](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/f/2fc66d1119b71383d2b67bf74473c16a65c08233.jpeg)

The second image represents a rendering using the recent version of THREE (even after applying the two lines mentioned above)

![new](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/d/9/d97b766b068bc7f25e32ffd43c2002b4f5a7519c.jpeg)

I would like to get the earlier look back (first image).

Is there something more I need to do in my code?

All the color assignments in my code are done through RGB assignments between 0 and 255.

Do I need to be doing something like the following for each color assignment in my code?

```javascript
grandScene.background = new THREE.Color().setStyle('rgb(200,200,200)',THREE.LinearSRGBColorSpace);

```

Thanks much

OLDMAN

---

<div class="post-metadata">

**Author:** ![drcmda](https://avatars.discourse-cdn.com/v4/letter/d/91b2a8/32.png) [@drcmda](https://discourse.threejs.org/u/drcmda)\
**Post date:** [September 27, 2023, 4:26pm UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/5 "2023-09-27T16:26:35Z")

</div>

for this you need to consult [Updates to lighting in three.js r155](https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733)

---

<div class="post-metadata">

**Author:** ![oldman](https://avatars.discourse-cdn.com/v4/letter/o/b2d939/32.png) [@oldman](https://discourse.threejs.org/u/oldman)\
**Post date:** [September 27, 2023, 5:28pm UTC](https://discourse.threejs.org/t/has-something-changed-in-code-for-the-background-property-of-scene/56427/6 "2023-09-27T17:28:50Z")

</div>

worked!!

thank you V M

OLDMAN
