Comments (4)
hex is actually rgb color space. Prob you want to see color-parse or color-stringify
from color-space.
I came here looking for this too. As I see it there's two ways of representing rgb colour space - they're equivalent. It would be great to support both as I suspect many users will be needing to work with one of them.
from color-space.
Can you elaborate use-case?
from color-space.
@dy I should preface to say this library was really useful, and did what I needed 👍
My use case was for two things:
- I had an array of
hsl
values that I needed inhex
for display purposes. I'd assumed a library that converts colours would support hex. - I then had some
hex
values that I wanted to convert tohsl
to work on them.
Following your link to color-parse
above, this is what I ended up using:
let rgb = rgbToHex(round(space.lab.rgb(pantone.records[colour].lab))).toUpperCase()
let hsl = space.rgb.hsl(colorParse(`#${colour}`).values)
Where rgbToHex
was a function I grabbed from stack overflow.
Possibly I've done these in a cumbersome way - but if not it would have been really helpful if this could have been built in. To do the conversion has needed to require round
as well as the color-parse
library.
If you don't want to include, a note in the readme would have been helpful. I was confused and thought I was misunderstanding things because it seemed intuitive to me that a colour parsing library would support one of the more common colour formats.
from color-space.
Related Issues (20)
- Conversion errors HWB -> RGB -> HWB HOT 3
- example `space.lab.lch(...)` does not work
- Outdated npm package HOT 1
- HSI out of bounds values and hue shifting HOT 6
- HSP out of bounds values and hue shifting HOT 2
- Munsell
- Add new color space: NCol
- sRGB, Adobe RGB, HDTV, NTSC, PAL-SECAM, etc.
- HuSL deprecated, use HSLuv instead
- RGBA support HOT 1
- Typescript declarations HOT 4
- Documentation about RGB conversion: is it sRGB? D65/2?
- Failure to convert XYZ to RGB and back
- npm WARN deprecated [email protected]: Redundant dependency in your project. HOT 1
- Oklab, Okhsv, Okhsl HOT 1
- Query regarding TSL color space implementation HOT 2
- TypeError: space.lab.lch is not a function HOT 1
- LRGB - Linear RGB space? HOT 2
- Deprecation notice
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-space.