I'm stuck at challenge 96 of picrel using C, when test(191, 191, 191) is ran, it outputs a hsl color of value 0°, 0, 0. Seems function calc_l is always returning 0.0 for some reason. Any help is highly appreciated :(
i can't help you aside from recommending you just use hex codes but rolling
James Anderson
fuck. reroll.
Adrian Sanchez
Nope, you will work on 83 and you will be happy.
Justin Turner
roll
Leo Richardson
roller
Camden Taylor
fuck
Anthony Price
r
Robert Foster
roll
Leo Gomez
Forgot to mention updated function signatures in earlier post. Anyway: a few general C tips that you desperately need. Will start looking into the actual problem now. // ALWAYS use parentheses around macro arguments (linebreaks added by // clang-format, just ignore that) #define CMAX(r, g, b) \ ((r) > (g) ? (r) > (b) ? (r) : (b) : (g) > (b) ? (g) : (b)) #define CMIN(r, g, b) \ ((r) < (g) ? (r) < (b) ? (r) : (b) : (g) < (b) ? (g) : (b)) #define CDELTA(max, min) ((max) - (min))
void foo() { // small structs such as these can be passed by value // (see modified function signature above) RGB_color rgb = {.r = r, .g = g, .b = b}; HSL_color hsl = rgb_to_hsl(rgb); // or via pointers to stack memory HSL_color hsl2; rgb_to_hsl2(&rgb, &hsl); // If this doesn't yet make sense to you: keep going, it will. }
(nvm the extra comments and printfs, copied everything real quick just so you don't waste your time with stuff that has been solved already, again, many thanks!)
Ryder Green
roll
Luke Hughes
Complimentary is just the opposite colour on the colour wheel.
Tyler Hall
Looks like an interesting one. I think you should go for it. Me on the other hand, I'll reroll if I land on 83.
Juan Foster
>now the problem is actually making the conversion from hsl back to rgb What's the expected output? What do you get instead?
Liam Adams
for example, for input (191,191,191) i should be receiving around (189,189,189), but am receiving (255,255,255) instead.
I'm basically using app.c as a little test suite, and then i use this site: hslpicker.com/#808080 to check if the conversions make sense
Adam Brown
fuck it
Gavin Barnes
ooh mama
Jackson Morgan
I suspect your memcpy logic may be at fault. What I did was replace it with this and I get (188, 188, 188) for (191, 191, 191): struct raw_rgb { float r; float g; float b; };