Questions tagged [hsb]
59 questions
64
votes
5 answers
HSB vs HSL vs HSV
I am making a Color class as a part of a very basic graphics API in c++. So I decided to take a look at Microsoft's .NET framework and noticed that their Color class has functions for HSB.
Then I started a research to determine whether I should…

Giwrgos Tsopanoglou
- 1,165
- 2
- 8
- 15
52
votes
6 answers
Javascript convert HSB/HSV color to RGB accurately
I need to accurately convert HSB to RGB but I am not sure how to get around the problem of turning decimals into whole numbers without rounding. This is the current function I have out of a colorpicker library:
HSBToRGB = function (hsb) {
var…

that_guy
- 2,313
- 4
- 33
- 46
26
votes
9 answers
Color Theory: How to convert Munsell HVC to RGB/HSB/HSL
I'm looking at at document that describes the standard colors used in dentistry to describe the color of a tooth. They quote hue, value, chroma values, and indicate they are from the 1905 Munsell description of color:
The system of colour notation
…

Ian Boyd
- 246,734
- 253
- 869
- 1,219
24
votes
4 answers
Is there function to convert UIColor to Hue Saturation Brightness?
i can set uicolor with RGB values:
[UIColor colorWithRed:0.53 green:0.37 blue:0.11 alpha:1.00];
i can set uicolor with hsb values:
[UIColor colorWithHue:0.10 saturation:0.16 brightness:0.13 alpha:1.00];
i also could convert it back to…

Horhe Garcia
- 882
- 1
- 13
- 28
19
votes
9 answers
Convert HSB/HSV color to HSL
How do I convert HSB color to HSL?
Photoshop shows HSB color in its color picker. HSB color cannot be used in CSS, but HSL can.
I tried this JS:
function hsb2hsl(h, s, b) {
return {
h: h,
s: s,
l: b-s/2
}
}
But hsb2hsl(0, 100, 50).l…

NVI
- 14,907
- 16
- 65
- 104
12
votes
4 answers
In RGB model how many distinct hues are available?
In RGB model, each pixel is defined by 3 bytes, for R,G and B respectively. This gives a total of 224 colors, including 256 tones of grey.
It is very common to represent HSV/HSB/HSL models with floats (not bytes). Most descriptions describe hue as…

emesx
- 12,555
- 10
- 58
- 91
10
votes
1 answer
Does the .Net Color struct use an HSB or HSL colour space?
As I understand it HSL and HSB colour spaces are very similar, both use the same 0-360 colour wheel for hue and the same 0-1 value for saturation. The one difference between them is that in the HSB model you have brightness, where 0 is black and 1…

Keith
- 150,284
- 78
- 298
- 434
7
votes
3 answers
k-means clustering on RGB or HSV scale?
I want to segment an image but someone told me that the Euclidean distance for RGB is not as good as HSV -- but for HSV, as not all H, S, V are of the same range so I need to normalize it. Is it a good idea to normalize HSV and then do clustering?…

nobody
- 815
- 1
- 9
- 24
7
votes
4 answers
Converting an RGBW color to a standard RGB/HSB representation
I am building an interface for light management in a home automation system. I managed to control standard on/off and dimmable light for various providers with little problem, but now I am stuck with a problem related to RGB light.
The light I am…

SPArcheon
- 1,273
- 1
- 19
- 36
7
votes
1 answer
.NET 4.5 DateTime format/convert bug with Upper Sorbian culture
Using the Upper Sorbian culture (hsb) a DateTime object converted to a string uses the format "d. M. yyyy H.mm.ss 'hodź.'". ToString("G") for example returns "31. 12. 2011 5.06.07 hodź." for the 31. of December 2011, 05:06:07 AM.
Problem is though…

Jürgen Bayer
- 2,993
- 3
- 26
- 51
6
votes
2 answers
Iterating over colors
Is there a good way to iterate over colors? I know it sounds like a strange question but here's an analogy.
Suppose you write a game where you travel around the Earth. You pick a starting point and then you define a rule that you apply repeatedly.…

Mark Lutton
- 6,959
- 7
- 41
- 57
5
votes
2 answers
Generate a n-color rainbow palette
I'm trying to generate a rainbow with 15 different colors with (runnable code here):
size(360,100);
colorMode(HSB, 360, 100, 100); // Hue in degrees in [0, 360],
// saturation/brightness in [0, 100]
…

Basj
- 41,386
- 99
- 383
- 673
5
votes
6 answers
Algorithm to Switch Between RGB and HSB Color Values
I read the article Algorithm to Switch Between RGB and HSB Color Values
Type RGBColor
Red As Byte
Green As Byte
Blue As Byte
End Type
Type HSBColor
Hue As Double
Saturation As Double
Brightness As Double
End…

Jiew Meng
- 84,767
- 185
- 495
- 805
5
votes
3 answers
How to create X% percent gray color in Java?
Suppose I want 25% or 31% gray color in Java?
The following code shows
BufferedImage image = new BufferedImage(2, 2, BufferedImage.TYPE_BYTE_GRAY);
image.setRGB(0, 0, new Color(0,0,0).getRGB());
image.setRGB(1, 0, new Color(50, 50,…

Suzan Cioc
- 29,281
- 63
- 213
- 385
3
votes
2 answers
how to calculate Brightness of RGB color?
i've got my function:
-(void)rgbToHSBWithR:(float)red G:(float)green B:(float)blue {
float brightness = red * 0.3 + green * 0.59 + blue * 0.11; // found in stackoverflow
NSLog(@"%f",brightness);
}
and it isn't work for me.
for example: r:84 g:67…

Tomasz Szulc
- 4,217
- 4
- 43
- 79