There are so many conversion programs on the internet, and I’m sure lots of apps have that functionality, too. Or you could just uniformly use HSB or RGB for all colors.
Actually what would be really cool is a project that converts HSB to RGB, and vice versa (I believe there already is one, actually)
yep, i saw one on hopscotch and it was really awesome
i guess what bobinny wishes is that the conversion is more convenient (like you dont need memorize the three values and exit the app and blablabla) but we shouldnt forget tht is a super small team so they won’t focus on having convenient stuff atm
Even after reading the posts here, I can’t figure out what you mean by a color conversion block…
It makes no sense to me being in a color parameter, because it’s just going to be the same color as your input. Like, if you say set color to “convert HSB(0,100,100)” it would be set color to rgb(255, 0, 0), but that’s the same thing…?
Or do you mean an operator, like “add” and “subtract” – those return a value, but I’m still not sure how that would return a color (especially cause HS doesn’t have arrays).
Could you elaborate more on the use case? Like, what sort of project would you make with it?
If you have a HSB color, changing the B value (which stands for “Brightness”) is an easy way to make a color lighter/darker!
So, for example, to make the color HSB(200,40,50) lighter, increasing 50 (for example to 80) makes the color lighter.
If you’re looking for some websites to help you with colors, you can try looking at the one I linked in the aqua text in this post or look here. If you’re using online converters, keep in mind that many of them call it “HSV” instead of “HSB”. They are exactly the same! You might see HSL too, and that’s, however, different.
I guess so, but again I’m not sure where the proposed editor change is – what would probably help is having a sketch or concept of a converter or something in the HS editor.
Once you are super familiar with RGB and hex, you’ll know how to do this without converting. That said though, it would be something really useful to have as a built-in tool in some way.
(I’m going off the assumption that you’d use it to make adjustments to a hex or rgb color you found online that doesn’t have its own way of adjusting the color?)
If someone wanted to convert RGB to HSV programmatically in Hopscotch, there’s a Wikipedia article with the formula for that here:
It’s kinda complicated to read but the math there adds up!
I found this JavaScript code snippet from this website that can convert from RGB to HSV, but I’m not sure if it works. I tried converting it to Hopscotch and I didn’t get it to work.
const RGBToHSB = (r, g, b) => {
r /= 255;
g /= 255;
b /= 255;
const v = Math.max(r, g, b),
n = v - Math.min(r, g, b);
const h =
n === 0 ? 0 : n && v === r ? (g - b) / n : v === g ? 2 + (b - r) / n : 4 + (r - g) / n;
return [60 * (h < 0 ? h + 6 : h), v && (n / v) * 100, v * 100];
};
RGBToHSB(252, 111, 48);
// [18.529411764705856, 80.95238095238095, 98.82352941176471]