Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgba Color Values are incorrect #50

Open
jheimbach opened this issue Jan 28, 2014 · 4 comments
Open

rgba Color Values are incorrect #50

jheimbach opened this issue Jan 28, 2014 · 4 comments
Assignees

Comments

@jheimbach
Copy link

I have searched a lot for this issue, and i know that the Problem isn't dalekjs but maybe there is a solution for this.

Webdriver/the Browser gives 'wrong' rgba values.

For example if you write something like this.
'backgroundcolor is correct': function (test) { test.open(url) .assert.css('.backgroundStripe', 'background-color', 'rgba(98, 202, 217, 0.7)', 'backgroundStripe has right color') .done(); }

Instead of the expected (and in the stylesheet defined) value rgba(98, 202, 217, 0.7) phantomjs returns rgba(98, 202, 217, 0.699219) and chrome returns rgba(98, 202, 217, 0.701961)

I think the reason why this happend is:
http://stackoverflow.com/a/13754993/3233058

Maybe there is a simple solution for this, but i haven't found one.

Versions i used:

  • dalekjs: 0.0.8
  • dalek-browser-chrome: 0.0.9
  • dalek-browser-phantomjs: 0.0.3
@asciidisco
Copy link
Member

I´ve seen this before but totally forgot about it. Indeed your findings seem to be the root of the issue.
Maybe @rodneyrehm has heard about this before and can add something to the discussion?

@ghost ghost assigned asciidisco Jan 28, 2014
@rodneyrehm
Copy link
Contributor

While specifications CSS2 Color and CSS3 Color define the computed value to be formatted "as specified", no browser reliably does this at this point.

I'm not sure I like the notion of testing for a given color in the first place. I'd argue that you should be testing for an element being in a given state (certain class name present, data-attribute filled, etc). But if you must check for a specific style, you'll have to deal with the short comings of computedValue() yourself.

For colors I can recommend chromath for working with colors and this SO question might help with creating a fuzzy color compare function

@Munter
Copy link

Munter commented Feb 5, 2014

I've had to deal with these comparisons myself in the color library I wrote because I use floating point representations internally. This is how I solved it: https://github.com/One-com/one-color#comparing-color-objects

@MrOutput
Copy link

my rgba values don't even work on phantom 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants