# Elements 0.6.8 (23389)

**URL:** <https://forums.realmacsoftware.com/t/elements-0-6-8-23389/46819>\
**Category:** Announcements\
**Created:** [March 21, 2025, 12:11pm UTC](https://forums.realmacsoftware.com/t/elements-0-6-8-23389/46819 "2025-03-21T12:11:19Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![dan](https://dub1.discourse-cdn.com/flex005/user_avatar/forums.realmacsoftware.com/dan/32/28516_2.png) [@dan](https://forums.realmacsoftware.com/u/dan)\
**Post date:** [March 21, 2025, 12:40pm UTC](https://forums.realmacsoftware.com/t/elements-0-6-8-23389/46819/7 "2025-03-21T12:40:42Z")

</div>

> [@Beblebroks](#):
>
> I think there is something off in the color calculcation.  
> Starting from `white` at 50 generates the same colors at 100-900 like when starting from 950 with `black`. But why is then 50 not white and the other way arround 950 is not black on the white palette.

We generate 13 colours and drop the first and last, otherwise we get a black and white on every gradient. I wouldn’t get too hung up on it; it’s just there as a means to generate gradients quickly. We’ll probably refine it further in the future.

Here’s the code we currently use… and yes, we’re open to improvements 😊

```auto
import chroma from "chroma-js"

rw.color = function(colorJS) {

    const brightness = colorJS.brightness
    const actualColor = chroma(colorJS.color)

    const lightColor = chroma(colorJS.color)
        .luminance(1.0)

    const darkColor = chroma(colorJS.color)
        .luminance(0.0)

    var colors = chroma
        .scale([lightColor, actualColor, darkColor])
        .domain([0, brightness / 10, 1.0])
        .mode('lab')
        .colors(13)

    // Add 1 because we generate 13 colors and strip the first/last
    colors[brightness + 1] = colorJS.color

    // Return the middle 11 colors
    colorJS.colors = colors.splice(1,11)
}

```

---

_[View the full topic](https://forums.realmacsoftware.com/t/elements-0-6-8-23389/46819)._
