Giter VIP home page Giter VIP logo

Comments (4)

bgrins avatar bgrins commented on May 23, 2024

Thanks for the info. This will be a little tricky, since IE filters use the backwards hex8 format. But I think we can special case that in the toFilter function. I doubt that too many people are using hex8 right now (it was added mainly to support toFilter), so the risk of changing the semantics is probably not too big.

from tinycolor.

bgrins avatar bgrins commented on May 23, 2024

If you'd like to contribute these changes, I'd be happy to accept a patch. Here's what would need to be done:

  1. modify rgbaToHex to flip where transparency shows up:
    function rgbaToHex(r, g, b, a) {
    .
  2. Add an 'allow4Char' parameter to that function that behaves just like 'allow3Char' does here:
    if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
    .
  3. Add the 'allow4Char' parameter to toHex8() and toHex8String(). We could consider renaming it to toHexAlpha or something.
  4. Add some tests for these features:
    equal (tinycolor("rgba 255 0 0 0.5").toHex8String(), "#80ff0000");
    .
  5. We also should move the current logic in rgbaToHex into the toFilter function, since it's important the semantics stay the same for this.

from tinycolor.

ColinLondon avatar ColinLondon commented on May 23, 2024

Does anyone know how to code this (I do not code myself!).

Cin cin

from tinycolor.

elvisvoer avatar elvisvoer commented on May 23, 2024

This is closed by #136

from tinycolor.

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.