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

Punt custom serialization to L2 #31

Open
LeaVerou opened this issue Feb 14, 2023 · 0 comments
Open

Punt custom serialization to L2 #31

LeaVerou opened this issue Feb 14, 2023 · 0 comments

Comments

@LeaVerou
Copy link
Collaborator

Currently, the README includes:

Extensibility: Adding hsv as a transformation of sRGB

ColorSpace.register(new ColorSpace("hsv", {
    base: "srgb",
    coords: ["h", "s", "v"],
    toBase: srgb => {
        ...
        return [h, s, v];
    },
    fromBase: hsv => {
        ...
        return [r, g, b]
    },
    serialize(c) {
        return "hsv("
            + c.coords.join(" ")
            + (c.alpha < 1? "/"
            + c.alpha : "")
            + ")";
    }
}));

It's unclear what the use cases are for outputting custom formats that are not supported by CSS, and it's trivial for author code to emulate this functionality. Also, this is not part of the spec, it's only in the readme. So I'm inclined to just remove it from the readme.

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

No branches or pull requests

1 participant