Skip to content
This repository was archived by the owner on Aug 6, 2019. It is now read-only.
This repository was archived by the owner on Aug 6, 2019. It is now read-only.

Color value formatting #22

@pdokas

Description

@pdokas

Browsers frustratingly deliver all sorts of different results for color properties in CSS.

Webkit returns rgb/a() values no matter what the CSS specifies. red, #f00, they all come back as rgb(255, 0, 0). I can't see any native way around this. Even worse, webkit gets opacity values off by a frustratingly miniscule value. E.g. what should be rgba(0, 0, 0, 0.3) is reported as rgba(0, 0, 0, 0.296875). Firefox reports it correctly as 0.3.

jQuery itself suffers the same problems and a fix has been long deemed out of scope. I've begun a normalization library that can break down any valid format into an [r,g,b,a] tuple but it'd be nice to not coerce users CSS color values into rgb/a. For instance, all my test cases have expected values in rgb/a format even though I'm explicitly setting values in other formats.

Any ideas on how to work around these inconsistencies? Especially those absurd opacity values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions