3 ms·
I found the colours here to be a little bit muted - since you're using Oklab [0], it would be quite nice to make the saturation level user defined. I was messi
by yarg 4y ago
I found the colours here to be a little bit muted - since you're using Oklab [0], it would be quite nice to make the saturation level user defined.
I was messing around with something similar (before I found out about Oklab), that generated a nice pastel colour ring.
(I didn't (at the time) know how to get the colours to a fixed perceptual saturation level, so gave up intending to come back to it.)
//something like this
static final int MAX = 255;
static final float OFFSET_R = 0f;
static final float OFFSET_G = (float)(TWO_PI/3);
static final float OFFSET_B = 2 * OFFSET_G;
public int buildColour(float theta){
final int r = round(MAX * sin(theta + OFFSET_R));
final int g = round(MAX * sin(theta + OFFSET_G));
final int b = round(MAX * sin(theta + OFFSET_B));
return 0xFF000000 | (r << 0x10) | (g << 0x08) | b;
}
(If I were doing it now, I'd use Oklab for normalisation.)
[0] - https://bottosson.github.io/posts/oklab/ https://bottosson.github.io/posts/oklab/
- yarg 4y ago//fix the sine wave amplitude and offset static final float CHANNEL_MUL = 127.5f; static final float OFFSET_R = 0f; static final float OFFSET_G = (float)(TWO_PI/3); static final float OFFSET_B = 2 * OFFSET_G; public int buildColour(float theta){ final int r = round(CHANNEL_MUL * (1f + sin(theta + OFFSET_R))); final int g = round(CHANNEL_MUL * (1f + sin(theta + OFFSET_G))); final int b = round(CHANNEL_MUL * (1f + sin(theta + OFFSET_B))); return 0xFF000000 | (r << 0x10) | (g << 0x08) | b; }
- solasluaith 4y agoThe saturation (or to be more accurate in this case, chroma) is actually already as high as possible (unless I’ve made a fundamental mistake) given the constraint that we want it to be uniform across colours and also uniform luminance. sRGB simply doesn’t allow for more sadly and I’m afraid it will probably be a long time before a new standard colour space for consumer displays comes around that would improve this. This tool that others have linked is pretty good if you’re fine with relaxing the constraints (just make sure to change to colour space to LCH OKlab): https://huetone.ardov.me https://huetone.ardov.me.