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

Add linear RGB color space. #56

Open
mbostock opened this issue Jun 26, 2019 · 0 comments
Open

Add linear RGB color space. #56

mbostock opened this issue Jun 26, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@mbostock
Copy link
Member

As defined here:

https://www.w3.org/TR/css-color-4/#color-conversion-code
https://observablehq.com/@mbostock/lab-and-rgb

function rgb_lrgb1(v) {
  return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;
}
function lrgb_rgb1(v) {
  return v <= 0.0031308 ? 12.92 * v : 1.055 * (v ** (1 / 2.4)) - 0.055;
}

Related d3/d3-interpolate#66.

@mbostock mbostock added the enhancement New feature or request label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant