Comments (3)
This also raises the question for when we should allow users to construct these values. It's clear per the CSS spec that lab(110% 0 0)
should be clamped, and clear that color.to-space(color(xyz 1 1 1), lab)
should not be clamped, but what about like color.change(lab(0% 0 0), $lightness: 110%)
? If we don't allow that, what do we do with color.change(color.to-space(color(xyz 1 1 1), lab), $a: 50%)
, since it already has an out-of-gamut lightness and that's not being explicitly changed?
@mirisuzanne I'm interested in your design thoughts here. I think I'm leaning towards allowing color.change()
et al to produce out-of-gamut colors—basically going with the design principle that we never clamp except where the CSS spec explicitly mandates clamping. But I'm not strongly convinced of that yet.
from sass.
That's my instinct as well - let it happen, and let CSS resolve the outcome if authors don't do ggamut-mapping. But I'm not sure that I've thought through all the implications of that.
from sass.
This issue actually also exists for other channels in the latest spec: in legacy RGB, all three channels are clamped at parsed-value time; and in LCH and OKLCH, the lower bound of chroma is clamped at parsed-value time. We also currently clamp HSL's saturation and lightness channels and HWB's whiteness and blackness channels, but these are not specified (anymore) as being clamped.
Following the principle above that we should allow out-of-gamut colors as much as possible while only clamping where the spec explicitly mandates, we should:
- Update the
rgb()
andrgba()
functions to clamp their inputs, but not clamp conversions to RGB. - Update the
lch()
andoklch()
functions to clamp the lower bound of their chroma. - Remove all clamping for HSL and HWB.
- Serialize out-of-gamut legacy RGB colors as
hsl()
, since this can represent those values without being clamped at parsed-value time while also being compatible with older browsers. (I'm double-checking with @tabatkins that this will work as expected.) - Serialize LCH and OKLCH colors with negative Chroma values using the same XYZ conversion trick we use for out-of-gamut lightness in #3741.
from sass.
Related Issues (20)
- Migration from @import to @use and @forward in a scss components library. Willing to pay a consultancy HOT 1
- Migration from @import to @use seems impossible with !default HOT 5
- If Sass also adopts Rust implementation for some implementations, will there be many changes. HOT 1
- How to use $each to set variables HOT 1
- Compatibility with the CSS custom function and mixin proposal HOT 6
- Allow two underscores on index files __index.scss HOT 1
- Node.js Package Importer shouldn't be strict about require.main.filename
- Sass is converting var(--c,) into var(--c) which leads to wrong code HOT 4
- Suggestion: Improve documentation around CSS Layers HOT 6
- Sass break a specific border-image syntax HOT 4
- Handle semicolons as function separators HOT 1
- Support an optional modulus argument to the round() function
- & selector in SCSS and CSS behaves differently HOT 2
- Please remove "free alestine" banner
- Please remove "free Palestine" banner HOT 2
- what is the relation between politics and css? remove that free Palestine immidiatly
- Multi asign, list deconstruction and better support for multiple returns HOT 2
- Generate deprecations list from a single source-of-truth
- Include loaded URLs in failed compilation result HOT 3
- Explicitly allow a base importer without a base URL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sass.