Comments (3)
After exploring this a bit, this is a very non-trivial problem. Removing the milestone from this (which was incorrect anyway, since Public release happened 2 years ago!)
from color.js.
Sass color functions lighten() and darken() vs. mix() with black and white
These increase or decrease HSL Lightness by a fixed amount. Therefore they will drive fairly light or fairly dark colors to white or black respectively. The amount of visible lightening and darkening also depends strongly on the hue.
Because darken() is usually not the best way to make a color darker, itβs not included directly in the new module system. However, if you have to preserve the existing behavior, darken($color, $amount) can be written color.adjust($color, $lightness: -$amount).
// #036 has lightness 20%, so when darken() subtracts 30% it just returns black.
@debug darken(#036, 30%); // black
// scale() instead makes it 30% darker than it was originally.
@debug color.scale(#036, $lightness: -30%); // #002447
from color.js.
Looking at that one in Lab, #036
is lab(20.75% 1.89 -34.99)
so 30% darker is 20.75 * .7 = 14.525 so lab(14.525% 1.89 -34.99)
which is color(srgb -0.0705 0.1486 0.34)
which when gamut mapped becomes rgb(3.32% 14.67% 28.97%)
#08254A
.
from color.js.
Related Issues (20)
- How should angle coordinates be handled in nonstandard color spaces HOT 9
- Support `rec2100-linear`? HOT 1
- Docs: getAll(), setAll() HOT 2
- Docs: mapping of color space names - CSS space ids/function names, Color.js serialized, and Color.js space ids HOT 6
- Document `getAll()` and `setAll()` HOT 1
- Carrying forward analogous components in color interpolation HOT 5
- Gray color is not correctly cast to a string HOT 7
- New API to normalize color values without NaN. HOT 1
- Tests for HSLuv/HPLuv clogging up the test runner HOT 10
- Auto-generated API docs seem not to be using TypeScript files HOT 6
- How to have a single source of truth for types and docs? HOT 11
- 'https://colorjs.io/docs/spaces' doesn't always load the list of color spaces HOT 2
- Add interpolation support for OkLrCH HOT 7
- Color scales: gradient-like interpolation across multiple color stops HOT 4
- Scientific notation causes error in OKLCH? HOT 2
- new Color("--acescg").space.coords[i].range does not match coordinates of actual colors HOT 30
- OKHsl is on docs but actually not in the published version HOT 2
- Make it possible to serialize to the same format as parsed
- OkHSL/OkHSV does not use NaN for hue-less colors HOT 2
- Color.js is very error-happy
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 color.js.