Comments (3)
I see the point. This is tricky because the color is stored in RGB internally. So since hsl(11, 100%, 100%)
converts to rgb(255,255,255)
once the call to toString() happens later the data has been lost.
I can't think of an easy way to work around this off the top of my head. I'd like to avoid storing _h, _s, _l for every color, since we would potentially want to do the same thing for every color format.
from tinycolor.
I see the problem...and is not that easy to solve..
I think the only way is to keep hsl internally instead of RGB.
since we would potentially want to do the same thing for every color format.
I don't understand why this is bad
from tinycolor.
I agree with hackhat. The internal format should keep the original values passed. RGB internal representation is the worst as it does not contain any info: hue, luminescence, lightness, saturation... Everything must be converted to these systems through mapping functions.
I was animating colors and as soon as I would reach a saturation or lightness of 0 (in HSL), everything would go red (hue 0). In these cases, the RGB values are all equal, eg. rgb(64,64,64). No formula can extract back any of the original hue. Arbitrarily, tinycolor resets them to default values: 0 for hue (red).
RGB is a thing from the 90s to represent colors. It can be useful in some cases for some type of applications, but we now use other color systems to represent human perception (not LCD/CRT physical intensities). Modern applications require: luminescence, brightness, contrast, triad, complementary, themes...
RGB can't keep any original info, they don't exist in its system. I agree with hackhat, the internal representation should keep all the parameters of all the original formats that were passed. These are minuscule structures compared to other JS objects. It would still be tiny.
I realized that tinycolor is basically just a structure storing RGB values with conversion formulas. I will be looking for other tools that are more sophisticated and that represent the actual color theories.
from tinycolor.
Related Issues (20)
- Details lost when lightening or brightening an image
- Monochrome is only working in in darker range.
- Trying to get in touch regarding a security issue
- In built way to automatically Darken or Lighten by amount depending on the color luminance
- Is toFloatString() implemented?
- React 18 types mismatch
- Feature: include alpha in Hex HOT 2
- Is there a way to reverse a colour, like a negative image?
- Support for LCH?
- Octal literal in strict mode
- tinycolor.mix(color1, color2, amount = 50) not working in React native HOT 1
- Doesn't work with calc HOT 1
- tinycolor is not a function HOT 39
- remove `engines` field from package.json
- Task: Publish 1.6.0 to npm
- Remove tinycolor.js and dist/tinycolor-min.js once we confirm they aren't used HOT 1
- Include a Changelog HOT 4
- asset files includes ES6 syntax HOT 2
- Task: Publish 1.6.1
- [Question] Overlay Colors
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 tinycolor.