Closed teschmitz closed 12 years ago
easily fixed: divide h by 360, not 255!
function! s:hue2rgb(m1, m2, h) " let h = (a:h + 0.0)/255 let h = (a:h + 0.0)/360
Also: should ColorHSLValues not return str rather than a:val? Maybe I am not understanding the purpose of this function?
On Fri, May 4, 2012 22:09, teschmitz wrote:
So far I have only been using hex colour codes and it is a real joy working with CSS now!
To-day, I used hsl() for the first time and the colourization doesn't seem correct or am I doing something dumb?
024d75 = hsl(201,97%,23%) = rgb(2,77,117)
The hex code and rgb() give me the right shade of blue. But hsl() gives me a shade of purple.
Thanks for the feedback. I look into it.
regards, Christian
I just noticed another minor issue with hsl/rgb functions:
When used in a comment, for example:
The colourization goes to the last closing bracket on that line. (greedy matching); I think it's in StripParantheses(val)
I have just spent absolutely ages trying to figure out what the problem with the following HSL colour definition is:
hsl( 81, 89, 36)
This is should have been green but was displayed as red #AE0A0A, which is the same as hsl(0,89,36).
The problem was caused by the space between the open parenthesis and 81. Whenever the hue is preceded by a space it is scanned in as zero.
Remove the space and the colour display is correct (with my fix from post #2 applied). The spaces in front of the other two parameters don't cause problems.
Hi teschmitz!
On Mo, 07 Mai 2012, teschmitz wrote:
I have just spent absolutely ages trying to figure out what the problem with the following HSL colour definition is:
hsl( 81, 89, 36)
This is should have been green but was displayed as red #AE0A0A, which is the same as hsl(0,89,36).
The problem was caused by the space between the open parenthesis and 81. Whenever the hue is preceded by a space it is scanned in as zero.
Remove the space and the colour display is correct (with my fix from post #2 applied). The spaces in front of the other two parameters don't cause problems.
Thanks for that many feedback. I think I fixed all 3 issues, you raised in this ticket. Please try latest head.
regards,
Wer nicht auf seine Weise denkt, denkt überhaupt nicht. -- Oscar Wilde
All above issues fixed.
But while you're at it, her's another: it doesn't like a space between the function name and the open bracket, for example:
hsl (89,81,37) will not be colourized.
On Mon, May 7, 2012 22:28, teschmitz wrote:
All above issues fixed.
But while you're at it, her's another: it doesn't like a space between the function name and the open bracket, for example:
hsl (89,81,37) will not be colourized.
Thanks, this should also be fixed now.
regards, Christian
All working.
So far I have only been using hex colour codes and it is a real joy working with CSS now!
To-day, I used hsl() for the first time and the colourization doesn't seem correct or am I doing something dumb?
024d75 = hsl(201,97%,23%) = rgb(2,77,117)
The hex code and rgb() give me the right shade of blue. But hsl() gives me a shade of purple.