Questions tagged [hsb]

57 questions
46
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,043
  • 4
  • 27
  • 42
46
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
  • 967
  • 2
  • 7
  • 14
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
  • 220,884
  • 228
  • 805
  • 1,125
21
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
  • 842
  • 1
  • 12
  • 28
19
votes
8 answers

Convert HSB/HSV color to HSL

Ho do I convert HSB color to HSL? Photoshop shows HSB color in its color picker. HSL color can be used in CSS. I tried this JS: function hsb2hsl(h, s, b) { return { h: h, s: s, l: b-s/2 } } But hsb2hsl(0, 100, 50).l == 0 instead of…
NVI
  • 13,771
  • 16
  • 60
  • 102
11
votes
2 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,287
  • 7
  • 53
  • 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
  • 133,927
  • 68
  • 273
  • 391
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?…
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,921
  • 3
  • 23
  • 44
6
votes
3 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,129
  • 15
  • 30
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,567
  • 6
  • 36
  • 52
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
  • 74,635
  • 166
  • 442
  • 756
4
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
  • 26,725
  • 49
  • 190
  • 355
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,081
  • 3
  • 38
  • 78
3
votes
1 answer

Change Opacity in HSB Colormode

I am trying to change the opacity of my strokes, but not sure how do it in HSB color mode. Or, if I switch to RGB mode how do I make the color change over time? Here is my code: (Any help would be appreciated) float rainbow=0; int dir=1; void…
1
2 3 4