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

Array color input for Canvas2D #5616

Closed
Tracked by #5613
fserb opened this issue Jun 8, 2020 · 10 comments
Closed
Tracked by #5613

Array color input for Canvas2D #5616

fserb opened this issue Jun 8, 2020 · 10 comments
Labels
addition/proposal New features or enhancements topic: canvas

Comments

@fserb
Copy link
Contributor

fserb commented Jun 8, 2020

Allow RGB and RGBA colors to be specified by a sequence of floats on canvas2D.

Working proposal: https://github.com/fserb/canvas2D/blob/master/spec/array-color-input.md

(cc @whatwg/canvas )

@fserb fserb mentioned this issue Jun 8, 2020
9 tasks
@litherum
Copy link

litherum commented Jun 9, 2020

In general, the WebKit team feels this is a good direction.

A few comments:

  1. It should be possible to specify a color space along with these color values, like how the CSS color() function does.
  2. Presumably, CSS Typed OM will want a color type. We should make sure that we don't have two competing color types. Instead, the same type should work for both.

@annevk annevk added addition/proposal New features or enhancements topic: canvas labels Jun 9, 2020
@fserb
Copy link
Contributor Author

fserb commented Feb 11, 2021

We had a conversation with the CSS WG and CSS Typed OM is very close to have a Color type. Given that, we are working on modifying this to simply support the Typed OM color type described here: https://drafts.css-houdini.org/css-typed-om-1/#colorvalue-objects

@svgeesus
Copy link

the current proposal

@annevk
Copy link
Member

annevk commented May 11, 2021

#6609 too.

@annevk
Copy link
Member

annevk commented May 14, 2021

Given

ISSUE 6 TODO add stringifiers

in CSS Typed OM there is no need for this as developers could pass these objects anyway and implementations could optimize the stringification away if they wanted to. The one perhaps annoying edge case would have if someone had overwritten the stringification behavior.

Generally we avoid overloading if (default) stringification ends up doing the same thing. (Although to be fair those code paths might have been less hot than this one.)

@mysteryDate
Copy link
Contributor

ISSUE 6 TODO add stringifiers

You're referring to CSSColorValue objects themselves? From the perspective of Canvas2D style input they definitely don't need to stringify.

@annevk
Copy link
Member

annevk commented May 18, 2021

I think you might be missing my point? I'm saying that if they will stringify I see less of a need to accept them directly as in most cases you cannot tell the difference. Implementations could optimize those cases where there is no difference if they wanted to.

@domenic
Copy link
Member

domenic commented May 18, 2021

In particular, if they stringify, then the existing setter in spec and implementations will automatically call that stringifier (like it does for every JS object) so there's no need to write spec text to handle it.

@mysteryDate
Copy link
Contributor

mysteryDate commented May 18, 2021

Oh yeah, I definitely missed your point. Thanks for clearing that up.

@annevk
Copy link
Member

annevk commented Feb 20, 2023

Closing this as we decided in #6609 that stringification of CSSColorValue objects is sufficient. Folks interested in this issue might want to follow #8708 for new developments in this space.

@annevk annevk closed this as completed Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements topic: canvas
Development

No branches or pull requests

6 participants