Coder Social home page Coder Social logo

Hex about color-space HOT 4 CLOSED

lafriakh avatar lafriakh commented on July 19, 2024
Hex

from color-space.

Comments (4)

dy avatar dy commented on July 19, 2024

hex is actually rgb color space. Prob you want to see color-parse or color-stringify

from color-space.

edwardhorsford avatar edwardhorsford commented on July 19, 2024

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.

dy avatar dy commented on July 19, 2024

Can you elaborate use-case?

from color-space.

edwardhorsford avatar edwardhorsford commented on July 19, 2024

@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 in hex 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 to hsl 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.