Comments (4)
I just created a pull-request with a fix for this issue, it simply normalizes the negative value for the hue.
from color.
Thanks for the PR! 🙌
from color.
I just found another conversion issue from hsl to hex or rgb but I think it's better to open another issue for that.
from color.
The maths used for HEX/RGB to HSL conversion does sometimes output a negative value for hue, but hsl(354, 70%, 54%)
and hsl(-6, 70%, 54%)
will produce the same shade of red on display. Because of the cyclic nature of hue, values like 714 and -366 would also be equivalent.
However, the hue could be normalised before being so that it is always between 0 and 360.
while ($hue < 0) {
// can sometimes be negative
$hue += 360;
}
while ($hue > 360) {
// I don't think this is likely, but for balance
$hue -= 360;
}
edit: I just saw that the markdown preview for hsl(-6, 70%, 54%)
didn't work. Interesting. So far I've never had a problem with negative hue whenever I've used it.
from color.
Related Issues (20)
- BUG : Hex color to HSL HOT 3
- I have list of hex colors when want a unique HOT 1
- Converting Hex to Hsl for #000 & #fff gets division by zero HOT 1
- Support alpha channel for HEX colors
- Support 3 digit hex values
- Error in CIELab regexp
- Support opacity in all color types
- Idea: Add opacity support to Hex colors HOT 1
- Wrong version in `composer.json` (1.3.0 instead of 1.4.0) HOT 1
- Could not find package spatie/color in a version matching "1.4.0" HOT 1
- Convert to CMYK HOT 1
- Problem with opacity in rgba color HOT 1
- HSLA -> RGBA looses transparency value HOT 2
- RGB and RGBA should accept % values HOT 1
- Constructive bound checking on RGB/RGBA values HOT 1
- Define a common 'opacity' value for each color instance HOT 1
- Add LCH support
- Bug Division by Zero Rgb to Cmyk HOT 1
- toHSL Uppercase letters Bug? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from color.